pdf-lib icon indicating copy to clipboard operation
pdf-lib copied to clipboard

RE: drawPage for embedded PDF seems to lose hyperlink annotations

Open sophieyuge opened this issue 4 years ago • 5 comments

What were you trying to do?

Embed pdfs that contain hyperlink with custom text in one page

How did you attempt to do it?

// const truncatedPdUrl: path to partial pdfs that will be embedded into one large pdf
const pdfBuffer = await this.storageFacade.loadBuffer(truncatedPdfUrl);
const [embeddedPdfPage] = await pdfDoc.embedPdf(pdfBuffer);
const fullPdfUrl = await this.storageFacade.savePdfAttachment(pdfKeyPrefix, embeddedPdfPage);

Also mentioned in issue #606 and #798

What actually happened?

hyperlink annotations in the partial pdfs are lost, and the hyperlink no longer clickable after they were stitched onto the final pdf using page.embedPdf() partial_pdf_with_clickable_annotated_hyperlink.pdf

What did you expect to happen?

Hyperlinks with annotations continue to work

How can we reproduce the issue?

  1. Create a pdf that contains a annotated hyperlink (clickable at this point)
  2. Use pdfDoc.embedPdf() to embed this pdf into a new page with puppeteer
  3. print the page to pdf
  4. -> hyperlink no longer clickable

Version

1.16.0

What environment are you running pdf-lib in?

Node

Checklist

  • [X] My report includes a Short, Self Contained, Correct (Compilable) Example.
  • [X] I have attached all PDFs, images, and other files needed to run my SSCCE.

Additional Notes

No response

sophieyuge avatar Jan 27 '22 17:01 sophieyuge

+1

I've faced this issue either, the generated pdf losed all image annotations from embeded PDF.

timo-kang avatar Mar 10 '22 02:03 timo-kang

BH

similar issue here but with form fields, tried to embed a page of PDF that had non-flatten form fields, but after calling the embedPdf command, the embedded PDF lost all fields entirely, as if they were never even there

yaakovyitzchak avatar Mar 15 '22 20:03 yaakovyitzchak

I have same question. after i Convert HTML to PDF,all hyperlink lost. in html, click hyperlink and the page go to place where id are same. i hope have the same effect in pdf

liulinqiang avatar Jun 13 '23 03:06 liulinqiang

@liulinqiang how did you convert html into PDF may i ask?

alexnguyen98 avatar Jul 21 '23 10:07 alexnguyen98