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.

23 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)
5 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.

8 Likes

A timely and major addition for me, so thanks for all the effort that must have gone in to making this possible, especially in all export formats. Although still just a newbie, I will try to test out in the next week.

+1 on the two features raised by nleanba (below), and in relation to them and to YDX’s FR, it makes sense to present PDF’s in a different method than images - even if just to allow side processes.

I’m still enjoying understanding the scope of Typst whilst mapping my previous decades of experience in PDF/images to potential use cases and integrations, but off-the-top-of-my-head thoughts on potential scaling of dev on PDF’s beyond images:

  • extracting XMP metadata for use in presentation, transformation, etc.
  • checking / resizing large format sizes (engineering, blueprints, etc).
  • handling embedded files, portfolios, and mime types (and their data as children).
  • handling data and layers within CAD/BIM, plot, less standard vector types.
  • handling markup, annotations, comments, etc to new pages and resized locations.
  • handling ocr text behind images, (language, script, etc)
  • handling pages or files in relation to parent index catalogs.
  • using linebreaks and pars to transform presentation.
  • flagging known formats/content type (or error handling) so we can push a file out out to different systems to handle - such as striping out highlights/annotations or presenting them in new printed layout, translating text to target lang, etc.

Although niche areas to where I think Typst has been born from, they are significant areas the system could be utilised in.

1 Like

How can I test pdf embedding in Tynimist?

Hi @Raul_Durand!

Yes! :tada:—Thanks to @ParaN3xus’s work, as of Tinymist’s nightly release version 0.13.17 all pre-releases support PDF embedding. To use this feature in VS Code, simply “switch to pre-release version” and install your desired nightly release[1]


  1. Please note, however, that as of now, starting from nightly release version 0.13.25 onwards, Tinymist’s preview appears to be broken. Therefore, version 0.13.19 remains the most recent nightly release that supports PDF embedding without known issues as of now. ↩︎

4 Likes