mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-26 01:58:06 +02:00
XFA - An image can be a stream in the pdf (bug 1718521)
- hrefs can be found in catalog > Names > XFAImages
This commit is contained in:
parent
d80651e572
commit
f16828be49
10 changed files with 127 additions and 49 deletions
|
@ -869,6 +869,28 @@ class PDFDocument {
|
|||
return null;
|
||||
}
|
||||
|
||||
async loadXfaImages() {
|
||||
const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
|
||||
if (!xfaImagesDict) {
|
||||
return;
|
||||
}
|
||||
|
||||
const keys = xfaImagesDict.getKeys();
|
||||
const objectLoader = new ObjectLoader(xfaImagesDict, keys, this.xref);
|
||||
await objectLoader.load();
|
||||
|
||||
const xfaImages = new Map();
|
||||
for (const key of keys) {
|
||||
const stream = xfaImagesDict.get(key);
|
||||
if (!isStream(stream)) {
|
||||
continue;
|
||||
}
|
||||
xfaImages.set(key, stream.getBytes());
|
||||
}
|
||||
|
||||
this.xfaFactory.setImages(xfaImages);
|
||||
}
|
||||
|
||||
async loadXfaFonts(handler, task) {
|
||||
const acroForm = await this.pdfManager.ensureCatalog("acroForm");
|
||||
if (!acroForm) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue