Embed full PDF papers into a Typst document, preserving selectable text and links.
Project description
embedpaper
Embed full PDF papers into a Typst document, preserving selectable text and links.
Typst 0.15's native image() can embed PDF pages full-width with selectable
text, but it drops link annotations. embedpaper restores them: a Typst
function places each page and records where it landed, and a small CLI
re-creates the source PDF's citation, cross-reference, and URI links on the
compiled output.
Install
uvx embedpaper --help
Requires uv and the
Typst CLI on your PATH.
Usage
-
Import
embedpaper.typand call it inside a page for each PDF you want to embed:#import "embedpaper.typ": embedpaper #page[ #embedpaper("papers/example.pdf", 12) ]
pagesis the PDF's page count (Typst can't query it, so pass it explicitly). Passwidth:to scale the paper against the page width (default100%). -
Compile, then run
embedpaperto restore the links:typst compile document.typ uvx embedpaper document.typ
This reads the placement metadata Typst embedded during compilation and incrementally saves
document.pdfwith each source link remapped onto its embedded page. -
Optionally, verify the result:
uvx embedpaper document.typ --audit
The audit re-derives where every link should point from the source PDFs and checks the compiled document against it — link count parity, correct destinations, and "Figure N" / "Table N" cross-references — exiting non-zero on any mismatch.
How it works
embedpaper.typplaces each source page as an image and emits<__paperlink>metadata (filename, source page, output page, and placement rectangle) for every embedded page.embedpaper embedqueries that metadata withtypst query, then uses PyMuPDF to copy each source page's links onto the matching output page, scaling coordinates and remapping internal destinations to their new page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file embedpaper-0.1.0.tar.gz.
File metadata
- Download URL: embedpaper-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f6bc222ee6117020a9c7d92b630e06bee1ace1404682f36531259ef6e9258fd
|
|
| MD5 |
f78ca7fba104b47d79d994ad4e72928d
|
|
| BLAKE2b-256 |
0c251a3b7d713140b53bcf189414ee1b3cddf7c0a694a7190e9d860a296a1785
|
File details
Details for the file embedpaper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: embedpaper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1cd2d409820dfb637246ab1fcdb3dabfcb44eb4e7e3020bd690a4c39a736b74
|
|
| MD5 |
1459126a9b44267d879fc1c6135b3606
|
|
| BLAKE2b-256 |
554fbcd67066de13aedc24c1a2f00ec432d83ce8f34e842cd735d68ac96f582e
|