embedPdf requires explicit image embedding when embedding a PDFDocument #1397
wistpotion
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am writing a little website that (in short) imports images and then exports those as a printable and easily put together zine. Imported images can be either one page or a spread, so spreads have to be split into individual pages before they can be remapped for the final print.
Essentially what is happening is:
Import images ->
copy single pages and split spreads into single pages and put those into a
PDFDocument
where each page is an a5 (let's call this document split)->remap pages and put remapped pages into a
PDFDocument
where each page is a4 (let's call this document final)->turn the document into the blob that can be downloaded
The final document ended up outputting nothing when using the split document, but did output when importing a different document (https://pdf-lib.js.org/assets/with_large_page_count.pdf). Odd. After a while I tried
.save()
:ing the split document and then embedding it into the final document, and then it worked fine. Doing the same but.embed()
:ing images in the split document and omitting the.save()
procedure also worked just fine. That is not very intuitive, and was not (that I could see) documented anywhere. Maybe that should be looked over, so it's less easy to land in the same situation as I did.Thanks for an amazing library! This is the first hiccup I've had with it, overall it's been great to use.
Beta Was this translation helpful? Give feedback.
All reactions