-
-
Notifications
You must be signed in to change notification settings - Fork 691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Retain annotations when embedding pages #849
Comments
I ran into the same issue. I also needed a way to add more annotations on the fly. Here was my solution: const existingAnnots = page.node.Annots().array;
const annots = [ ...existingAnnots ];
/* create new annots, push into array */
await page.node.set(PDFName.of('Annots'), pdfDoc.context.obj(annots)); |
Hi @acoyfellow, |
https://pdf-lib.js.org/docs/api/classes/pdfpage#drawpage can't (and won't) preserve annotations. You should use https://pdf-lib.js.org/docs/api/classes/pdfdocument#addpage instead. |
Hi @Hopding, |
I've just seen a PR in progress that will solve this problem: #991 |
I don't think PR #991 completely solves the original problem: How to embed PDF at given cooridinates and scale on a page and retain annotations. This requirement comes from needing to embed an external pdf into my document, but I need my own border around the embeded pages, and my own header, footer and page numbers as the embeded pdf is part of a larger document. Here's the problems:
@Hopding can you suggest a work-around for this? |
Annotations are retained by using
copyPages
but they are not retained with theembedPage
method.Is there any way to retain annotations when embedding pages?
The text was updated successfully, but these errors were encountered: