Emit native PDF page resources and named transparency states

This commit is contained in:
gloamxun committed 2026-11-21 00:53:46 +08:00
1 parent 2bced813a2
commit 4f4a4567ea
23 files changed
+791 -37

No files matched your search

@@ -25,6 +25,7 @@ mod pdf_catalog;
mod pdf_color;
mod pdf_graphics;
mod pdf_image;
mod pdf_objects;
mod pdf_links;
#[cfg(all(target_os = "linux", target_env = "gnu"))]
pub(super) mod pdf_match;
@@ -2097,6 +2098,10 @@ impl Executor {
Meaning::Primitive(Primitive::Interactionmode) => Ok(self.interaction_mode_value()),
Meaning::Primitive(Primitive::Pdftexversion) => Ok(Self::PDFTEX_VERSION),
Meaning::Primitive(Primitive::Pdfshellescape) => Ok(Self::SHELL_ESCAPE),
Meaning::Primitive(Primitive::Pdflastobj) => {
self.reads.insert(Dependency::PdfObjects);
Ok(self.state.pdf_objects.as_deref().map_or(0, |objects| objects.last()))
}
Meaning::Primitive(
p @ (Primitive::Pdflastximage
| Primitive::Pdflastximagepages
@@ -2664,6 +2669,7 @@ impl Executor {
if immediate {
let next = self.required_expanded(files)?;
match self.primitive(&next.token) {
Some(Primitive::Pdfobj) => return self.scan_pdf_object(true, files),
Some(Primitive::Pdfximage) => return self.scan_pdf_image(&next.token, true, files),
Some(p @ (Primitive::Openout | Primitive::Closeout | Primitive::Write)) => {
primitive = p
@@ -2741,6 +2747,7 @@ impl Executor {
self.current = node.span;
self.tick()?;
match &node.operation {
OutputOperation::PdfObject(number) => return self.write_pdf_object(*number),
OutputOperation::PdfImage { image, .. } => {
return self.declare_pdf_image(image.id);
}
@@ -3708,6 +3715,8 @@ impl Executor {
Pdfstartlink | Pdfendlink | Pdfdest => {
self.scan_pdf_link(primitive, token.span, files)?;
}
Pdfobj => self.scan_pdf_object(false, files)?,
Pdfrefobj => self.scan_pdf_object_reference(token.span, files)?,
Pdfcatalog => self.scan_pdf_catalog(files)?,
Pdfoutline => self.scan_pdf_outline(files)?,
Pdfinfo => self.scan_pdf_info(files)?,