Write native pdfTeX Form XObjects
This commit is contained in:
1 parent
7ff988031f
commit
c2d3312e5a
23 files changed
+534
-88
No files matched your search
@@ -27,6 +27,7 @@ mod pdf_catalog;
|
||||
mod pdf_color;
|
||||
mod pdf_graphics;
|
||||
mod pdf_image;
|
||||
mod pdf_form;
|
||||
mod pdf_objects;
|
||||
mod pdf_links;
|
||||
#[cfg(all(target_os = "linux", target_env = "gnu"))]
|
||||
@@ -242,6 +243,7 @@ pub struct Executor {
|
||||
pdf_outline_payload: usize,
|
||||
pdf_info_tokens: Vec<Token>,
|
||||
pdf_images: Vec<pdf_image::RegisteredImage>,
|
||||
pdf_forms: BTreeMap<u32, pdf_form::RegisteredForm>,
|
||||
restored_pdf_image_count: usize,
|
||||
format_image_warnings: Vec<String>,
|
||||
pdf_force_pagebox_warned: bool,
|
||||
@@ -421,6 +423,7 @@ impl Executor {
|
||||
pdf_outline_payload: 0,
|
||||
pdf_info_tokens: Vec::new(),
|
||||
pdf_images: Vec::new(),
|
||||
pdf_forms: BTreeMap::new(),
|
||||
restored_pdf_image_count: 0,
|
||||
format_image_warnings: Vec::new(),
|
||||
pdf_force_pagebox_warned: false,
|
||||
@@ -2384,6 +2387,10 @@ impl Executor {
|
||||
.as_deref()
|
||||
.map_or(0, |objects| objects.last_link()))
|
||||
}
|
||||
Meaning::Primitive(Primitive::Pdflastxform) => {
|
||||
self.reads.insert(Dependency::PdfObjects);
|
||||
Ok(self.pdf_forms.last_key_value().map_or(0, |(&number, _)| number as i32))
|
||||
}
|
||||
Meaning::Primitive(Primitive::Pdflastobj) => {
|
||||
self.reads.insert(Dependency::PdfObjects);
|
||||
Ok(self.state.pdf_objects.as_deref().map_or(0, |objects| objects.last()))
|
||||
@@ -3003,6 +3010,7 @@ impl Executor {
|
||||
let next = self.required_expanded(files)?;
|
||||
match self.primitive(&next.token) {
|
||||
Some(Primitive::Pdfobj) => return self.scan_pdf_object(true, files),
|
||||
Some(Primitive::Pdfxform) => return self.scan_pdf_form(true, files),
|
||||
Some(Primitive::Pdfximage) => return self.scan_pdf_image(&next.token, true, files),
|
||||
Some(p @ (Primitive::Openout | Primitive::Closeout | Primitive::Write)) => {
|
||||
primitive = p
|
||||
@@ -3083,6 +3091,9 @@ impl Executor {
|
||||
OutputOperation::PdfObject(_) => {
|
||||
return self.fail("PDF object reference requires a native PDF shipout");
|
||||
}
|
||||
OutputOperation::PdfForm { .. } => {
|
||||
return self.fail("PDF Form reference requires a positioned shipout");
|
||||
}
|
||||
OutputOperation::PdfImage { image, .. } => {
|
||||
return self.declare_pdf_image(image.id, files);
|
||||
}
|
||||
@@ -4041,6 +4052,9 @@ impl Executor {
|
||||
.fail("dump requires closed groups and conditionals");
|
||||
}
|
||||
self.ensure_format_pdf_images()?;
|
||||
if !self.pdf_forms.is_empty() {
|
||||
return self.fail("cannot dump a format with registered PDF Forms");
|
||||
}
|
||||
self.reads.insert(Dependency::FontResources);
|
||||
if self.state.fonts.fonts().iter().any(|font| font.opentype().is_some()) {
|
||||
return self.fail("cannot dump a format with native OpenType fonts");
|
||||
|
||||
Reference in new issue
Block a user