mozilla/pdf.js

mozilla/pdf.js1 在 PDF 文件缺失 File Header(%PDF-) 的情况下,可以成功打开文件。

具体见 core/worker.js.

 async function loadDocument(recoveryMode) {
    await pdfManager.ensureDoc("checkHeader");
    await pdfManager.ensureDoc("parseStartXRef");
    await pdfManager.ensureDoc("parse", [recoveryMode]);

    if (!recoveryMode) {
    // Check that at least the first page can be successfully loaded,
    // since otherwise the XRef table is definitely not valid.
        await pdfManager.ensureDoc("checkFirstPage");
    }

    const [numPages, fingerprint] = await Promise.all([
        pdfManager.ensureDoc("numPages"),
        pdfManager.ensureDoc("fingerprint"),
    ]);
    return { numPages, fingerprint };
}

小工具

  • FreePic2Pdf,将图像文件合并、转换成PDF文件
  • PdgCntEditor,目录文件编辑器,支持PDF、DjVu、PDG

Related Posts


Published

pdf

  • Part 1: PDF 闲谈

Category

misc

Tags

Contact