You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been able to find the images and their sizes.... I am still trying to figure out if its possible to find what page the image is on and what the image coordinates are..... ( my issue )
Find images:
const enumeratedIndirectObjects = pdfDoc.context.enumerateIndirectObjects();
enumeratedIndirectObjects.forEach(x => {
const pdfRef = x[0];
const pdfObject = x[1];
if (!(pdfObject instanceof PDFRawStream)) return;
const { dict } = pdfObject;
const subtype = dict.get(PDFName.of('Subtype'));
const width = dict.get(PDFName.of('Width'));
const height = dict.get(PDFName.of('Height'));
const name = dict.get(PDFName.of('Name'));
if (subtype == PDFName.of('Image')) {
//FOUND IMAGE, NOW WHAT PAGE DOES IT EXIST ON
//push image coordinates into an array for page
}
});
pdf-lib doesn't currently provide good support for processing content streams. It can be done, but you'll have to read the PDF spec to understand the inner structure of PDF files. See also #963 (comment).
I've load a pdf using
and I can find many things in PDFDocument.context.indirectObjects
I've tried ways to get the content from indrectObjects. ex:
but none of ways is the right way...
can anyone help me? Thanks!!
The text was updated successfully, but these errors were encountered: