OiO.lk Blog pdf Metadata in PDFs from HTML
pdf

Metadata in PDFs from HTML


I need to carry some metadata – which could amount to just an ID – from the source HTML, through to the PDF using WeasyPrint, eventually ending up somehow addressable in the HTML rendered by pdf.js (more specifically, react-pdf).

So, for example, if I have this element in my source HTML:

<p class="x00-chapter-title---toc-level" id="my-id">Contents</p>

Using qpdf, I was able to generate a text-readable version of the generated PDF, and happily found this:

<<
  /Names <<
    /Dests <<
      /Names [
        (my-id)
        [
          25 0 R
          /XYZ
          67.25
          810.889736
          0
        ]
      ]
    >>
  >>
>>

…which gives me hope!

But now I am not sure how to use pdf.js to access these details, or even tell me what they mean. Presumably coordinates on the page.

How do I do this?



You need to sign in to view this answers

Exit mobile version