Call for testing: Embedding PDFs as images

Thanks to the valiant work by @LaurenzV, the development build of Typst now supports embedding PDFs as images (in all export formats)!

To make sure the feature works as robustly as possible once 0.14 comes out, we’d like to ask for help testing it.

You can test it locally or in the web app. To test locally, install the latest commit via cargo. To test in the web app, simply select “Development version (July 22, 2025)” under “Compiler version” in the settings side panel.

19 Likes

oooh yay cool!

In my quick testing I have found the following:

  1. It does not seem to handle forms well: it does not render the fields & checkboxes, and does not render their contents.
  2. One of the forms I tested has JS, which lead to the error “The PDF is encrypted or password-protected”, which is misleading – it opens fine (w/o passwords or anything) elsewhere. I can understand not supporting javascript, but I think the message needs to say that.
  3. It would be nice to have a way to get the number of pages to allow showing all of them as images, without having to manually specify/know how many pages the pdf has
  4. Relatedly, it would be nice to be able to insert PDFs as their own pages (this is workaroundable by creating blank pages with the PDF as background image, and some measuring to get the correct dimensions, but it would be nice to have this built in)
2 Likes

Agreed! I’ve just created PDF Embedding: Get the number of pages of a PDF image · Issue #6644 · typst/typst · GitHub on that. The question is API design.

2 Likes

It does not seem to handle forms well: it does not render the fields & checkboxes, and does not render their contents.

Yeah, you are right, forms are completely ignored. Ensuring that the actual form functionality is preserved would be rather difficult, but ensuring that the fields are at least rendered should be possible, I think.

One of the forms I tested has JS, which lead to the error “The PDF is encrypted or password-protected”, which is misleading

I know it sounds misleading and I expected it would confuse people, but it’s not: The PDF most-likely is encrypted (this is just a simple marker in the PDF), however, encryption does not mean that it’s password-protected or anything. There are many PDFs who are encrypted but can still be opened without entering anything because they don’t require a password. That is currently not supported, but I think it should be doable in a few days’ of work.

Relatedly, it would be nice to be able to insert PDFs as their own pages

I agree, I just didn’t implement this now because this would require more API-design, while just implementing PDF images was very straight-forward on the Typst side.

6 Likes