Forum How do I...?

Embed base64 PDF in HTML

pce
Using version Prince 12 attempting to embed a base64 encoded PDF in HTML to be rendered as a PDF along with the rest of the HTML document but prince does not output the PDF data and generates a blank page.

There is no issue with getting the PDF to render correctly in the browser using HTML but any attempt at rendering using prince fails, here are the errors received along with the tags tried - these all work properly when viewing in a browser.

<iframe src="data:application/pdf;base64...." type="application/pdf"></iframe>

Recieve Error : error: Start tag expected, '<' not found

<embed src="data:application/pdf;base64..." type="application/pdf"></object>

prince: debug: loaded resource: type: yes(resource_type("application/pdf", [], unknown, no))
prince: data URL: warning: Unknown image MIME type: application/pdf

<object data="data:application/pdf;base64..." type="application/pdf"></object>

prince: debug: loaded resource: data URL
prince: debug: loaded resource: type: yes(resource_type("application/pdf", [], unknown, no))

mikeday
Unfortunately Prince cannot embed PDF files within other PDF files at this time.
lglassop
Hello Mike, Is it likely that Prince will enable PDF embeds? I have three use cases:
1. PhD Dissertation by Publication [i.e., a dissertation with a compilation of published journal articles]. Commentary is provided between the articles.
2. Board of Directors reports [i.e., a compilation of papers; very much used by Company Secretary/CFO roles]
3. Large reports [i.e., a compilation of appendices]
As an interim, I could try using PDF attach, for items 2 and 3, but not for item 1. One of the key problems is that I cannot generate a TOC including the appendices (or embedded file).
mikeday
At the moment it is necessary to use a separate program such as pdftk to concatenate multiple PDFs. It would be handy to be able to do this in Prince but unfortunately reading PDF files is a significant undertaking.