mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
djvu compilation
This commit is contained in:
@ -393,14 +393,43 @@ void main() {\n\
|
||||
}
|
||||
};
|
||||
|
||||
window["AscViewer"] = window["AscViewer"] || {};
|
||||
window["AscViewer"] = window["AscViewer"] || {};
|
||||
window["AscViewer"].IFile = CFile;
|
||||
|
||||
window["AscViewer"].createFile = function(buffer)
|
||||
{
|
||||
var data = new Uint8Array(buffer);
|
||||
var file = null;
|
||||
if (data.length > 7 &&
|
||||
|
||||
var maxCheck = Math.min(100, data.length - 5);
|
||||
var pdfCheck = [
|
||||
"%".charCodeAt(0),
|
||||
"P".charCodeAt(0),
|
||||
"D".charCodeAt(0),
|
||||
"F".charCodeAt(0),
|
||||
"-".charCodeAt(0)
|
||||
];
|
||||
var isPdf = false;
|
||||
for (var i = 0; i < maxCheck; i++)
|
||||
{
|
||||
if (data[i + 0] == pdfCheck[0] &&
|
||||
data[i + 1] == pdfCheck[1] &&
|
||||
data[i + 2] == pdfCheck[2] &&
|
||||
data[i + 3] == pdfCheck[3] &&
|
||||
data[i + 4] == pdfCheck[4])
|
||||
{
|
||||
isPdf = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPdf)
|
||||
{
|
||||
file = new window["AscViewer"].PdfFile();
|
||||
file.type = 0;
|
||||
}
|
||||
|
||||
if (data.length > 7 && !file &&
|
||||
0x41 == data[0] && 0x54 == data[1] && 0x26 == data[2] && 0x54 == data[3] &&
|
||||
0x46 == data[4] && 0x4f == data[5] && 0x52 == data[6] && 0x4d == data[7])
|
||||
{
|
||||
@ -409,41 +438,10 @@ void main() {\n\
|
||||
|
||||
if (!file)
|
||||
{
|
||||
var maxCheck = Math.min(100, data.length - 5);
|
||||
var pdfCheck = [
|
||||
"%".charCodeAt(0),
|
||||
"P".charCodeAt(0),
|
||||
"D".charCodeAt(0),
|
||||
"F".charCodeAt(0),
|
||||
"-".charCodeAt(0)
|
||||
];
|
||||
var isPdf = false;
|
||||
for (var i = 0; i < maxCheck; i++)
|
||||
{
|
||||
if (data[i + 0] == pdfCheck[0] &&
|
||||
data[i + 1] == pdfCheck[1] &&
|
||||
data[i + 2] == pdfCheck[2] &&
|
||||
data[i + 3] == pdfCheck[3] &&
|
||||
data[i + 4] == pdfCheck[4])
|
||||
{
|
||||
isPdf = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isPdf)
|
||||
{
|
||||
file = new window["AscViewer"].PdfFile();
|
||||
file.type = 0;
|
||||
}
|
||||
file = new window["AscViewer"].XpsFile();
|
||||
}
|
||||
|
||||
if (!file)
|
||||
{
|
||||
file = new window["AscViewer"].XpsFile();
|
||||
}
|
||||
|
||||
if (!file)
|
||||
{
|
||||
file = new window["AscViewer"].PdfFile();
|
||||
file.type = 1;
|
||||
|
||||
@ -51,7 +51,7 @@ for item in input_wasmdjvu_sources:
|
||||
sources.append(libWasmDjVu_src_path + item)
|
||||
sources.append("djvu_common.cpp")
|
||||
|
||||
compiler_flags.append("-DWIN32 -DNDEBUG -D_LIB -D_CRT_SECURE_NO_WARNINGS -DWASM_MODE -Derrno=0 \"-DUINT=unsigned int\" -DTHREADMODEL=0 -DDEBUGLVL=0")
|
||||
compiler_flags.append("-DWIN32 -DNDEBUG -D_LIB -D_CRT_SECURE_NO_WARNINGS -DWASM_MODE -Derrno=0 -DTHREADMODEL=0 -DDEBUGLVL=0")
|
||||
|
||||
# arguments
|
||||
arguments = ""
|
||||
|
||||
Reference in New Issue
Block a user