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
@@ -213,6 +213,7 @@ impl NativeShipout {
|
||||
width,
|
||||
height,
|
||||
},
|
||||
MathItem::PdfForm(form) => DisplayItem::PdfForm { x, y, form },
|
||||
MathItem::PdfImage(image) => DisplayItem::PdfImage {
|
||||
x,
|
||||
y: y - image.height,
|
||||
|
||||
@@ -642,6 +642,10 @@ impl Printer<'_> {
|
||||
self.command("pdfrefobj");
|
||||
self.literal(&format!(" {number}"));
|
||||
}
|
||||
OutputOperation::PdfForm { form, .. } => {
|
||||
self.command("pdfrefxform");
|
||||
self.literal(&format!(" {}", form.number));
|
||||
}
|
||||
OutputOperation::PdfImage { image, .. } => {
|
||||
if image.xdv.is_some() {
|
||||
self.command(if image.image.raster_frame().is_some() {
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -46,6 +46,8 @@ impl Executor {
|
||||
Pdfcatalog => self.scan_pdf_catalog(files)?,
|
||||
Pdfoutline => self.scan_pdf_outline(files)?,
|
||||
Pdfinfo => self.scan_pdf_info(files)?,
|
||||
Pdfxform => self.scan_pdf_form(false, files)?,
|
||||
Pdfrefxform => self.scan_pdf_form_reference(token, files)?,
|
||||
Pdfximage => self.scan_pdf_image(token, false, files)?,
|
||||
Pdfrefximage => self.reference_pdf_image(token, files)?,
|
||||
XeTeXpdffile | XeTeXpicfile => {
|
||||
|
||||
@@ -34,7 +34,7 @@ pub(super) struct PdfSpaceProbe {
|
||||
history: crate::pdf::native_text::FontHistory,
|
||||
virtuals: crate::native_font::VirtualPaintState,
|
||||
cache: Arc<crate::native_font::NativeFontCache>,
|
||||
observed_events: usize,
|
||||
pub(super) observed_events: usize,
|
||||
}
|
||||
|
||||
struct ShipoutFontUse {
|
||||
@@ -261,13 +261,33 @@ impl Executor {
|
||||
}
|
||||
pub(super) fn ship_box(
|
||||
&mut self,
|
||||
mut b: NativeBox,
|
||||
b: NativeBox,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
let (shipout, forms, probed_page) = self.ship_box_contents(b, None, files)?;
|
||||
self.native_page.as_mut().unwrap().dead_cycles = 0;
|
||||
let before = self.statistics_before_shipout(&shipout.box_node, files)?;
|
||||
self.shipped_pages += 1;
|
||||
self.events.push(Event::Shipout(Box::new(shipout)));
|
||||
if probed_page && let Some(probe) = self.pdf_space_probe.as_mut() {
|
||||
Arc::make_mut(probe).observed_events = self.events.len();
|
||||
}
|
||||
self.write_shipout_forms(forms, files)?;
|
||||
self.statistics_after_shipout(before, files)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn ship_box_contents(
|
||||
&mut self,
|
||||
mut b: NativeBox,
|
||||
form_resources: Option<Arc<[u8]>>,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(NativeShipout, Vec<(u32, Span)>, bool), Error> {
|
||||
let for_form = form_resources.is_some();
|
||||
self.native_page_mut()?;
|
||||
self.check_box_capacity(Some(&b))?;
|
||||
let h_offset = i64::from(self.read_parameter(Parameter::Hoffset).width());
|
||||
let v_offset = i64::from(self.read_parameter(Parameter::Voffset).width());
|
||||
let h_offset = if for_form { 0 } else { i64::from(self.read_parameter(Parameter::Hoffset).width()) };
|
||||
let v_offset = if for_form { 0 } else { i64::from(self.read_parameter(Parameter::Voffset).width()) };
|
||||
const MAX_DIMEN: i64 = 1_073_741_823;
|
||||
if b.height > MAX_DIMEN
|
||||
|| b.depth > MAX_DIMEN
|
||||
@@ -276,7 +296,8 @@ impl Executor {
|
||||
{
|
||||
return self.fail("huge native page cannot be shipped out");
|
||||
}
|
||||
let magnification = self.prepare_magnification()?;
|
||||
let job_magnification = self.prepare_magnification()?;
|
||||
let magnification = if for_form { 1000 } else { job_magnification };
|
||||
let pdf = self.pdf_page_data(files)?;
|
||||
let unicode_pages = self.state.input_profile() != InputProfile::TeX8Bit;
|
||||
// The XDV driver uses a physical sheet and origin, then applies
|
||||
@@ -288,13 +309,19 @@ impl Executor {
|
||||
value
|
||||
}
|
||||
};
|
||||
let horizontal_origin =
|
||||
origin(i64::from(self.read_parameter(Parameter::Pdfhorigin).width())) + h_offset;
|
||||
let vertical_origin =
|
||||
origin(i64::from(self.read_parameter(Parameter::Pdfvorigin).width())) + v_offset;
|
||||
let requested_page_width = i64::from(self.read_parameter(Parameter::Pdfpagewidth).width());
|
||||
let horizontal_origin = if for_form { 0 } else {
|
||||
origin(i64::from(self.read_parameter(Parameter::Pdfhorigin).width())) + h_offset
|
||||
};
|
||||
let vertical_origin = if for_form { 0 } else {
|
||||
origin(i64::from(self.read_parameter(Parameter::Pdfvorigin).width())) + v_offset
|
||||
};
|
||||
let requested_page_width = if for_form { b.width } else {
|
||||
i64::from(self.read_parameter(Parameter::Pdfpagewidth).width())
|
||||
};
|
||||
let mut page_width = requested_page_width;
|
||||
let requested_page_height = i64::from(self.read_parameter(Parameter::Pdfpageheight).width());
|
||||
let requested_page_height = if for_form { b.height + b.depth } else {
|
||||
i64::from(self.read_parameter(Parameter::Pdfpageheight).width())
|
||||
};
|
||||
let default_canvas = |bp: i64| origin(bp * 803 * 65536 / 800);
|
||||
if page_width == 0 {
|
||||
page_width = if unicode_pages { default_canvas(612) } else { b.width + 2 * horizontal_origin };
|
||||
@@ -324,7 +351,9 @@ impl Executor {
|
||||
self.steps += work;
|
||||
}
|
||||
let current = self.current;
|
||||
let (pdf_resource_entries, pdf_page_attributes) = if device.pdf.is_some() {
|
||||
let (pdf_resource_entries, pdf_page_attributes) = if let Some(resources) = form_resources {
|
||||
(resources, Default::default())
|
||||
} else if device.pdf.is_some() {
|
||||
(
|
||||
self.pdf_token_parameter_bytes(TokenParameter::Pdfpageresources)?.into(),
|
||||
self.pdf_token_parameter_bytes(TokenParameter::Pdfpageattr)?.into(),
|
||||
@@ -340,7 +369,7 @@ impl Executor {
|
||||
.into_iter()
|
||||
.map(crate::pdf_device::ShippedColor::Page)
|
||||
.collect()
|
||||
} else if device.pdf.is_some() {
|
||||
} else if device.pdf.is_some() && !for_form {
|
||||
self.pdf_colors.start_page()
|
||||
} else {
|
||||
Vec::new()
|
||||
@@ -413,6 +442,7 @@ impl Executor {
|
||||
let mut has_space_nodes = false;
|
||||
let mut has_explicit_space = false;
|
||||
let mut pdf_objects = Vec::new();
|
||||
let mut pdf_forms = Vec::new();
|
||||
let mut xdv_annotations = std::collections::BTreeMap::new();
|
||||
let mut reopened_images = false;
|
||||
let mut xdv_paper_specials = Vec::new();
|
||||
@@ -452,6 +482,10 @@ impl Executor {
|
||||
return self.fail("cannot ship a PDF object reference to DVI");
|
||||
}
|
||||
pdf_objects.push((number, output.span));
|
||||
} else if let OutputOperation::PdfForm { form, .. } = output.operation {
|
||||
self.current = output.span;
|
||||
self.tick()?;
|
||||
pdf_forms.push((form.number, output.span));
|
||||
} else if let OutputOperation::PdfColor { stack, action } = &output.operation {
|
||||
if device.pdf.is_none() {
|
||||
return self.fail("cannot ship a PDF color operation to DVI");
|
||||
@@ -646,6 +680,9 @@ impl Executor {
|
||||
self.write_pdf_object(number, files)?;
|
||||
}
|
||||
if has_link_material {
|
||||
if for_form {
|
||||
return self.fail("PDF page links and destinations require a page shipout");
|
||||
}
|
||||
let mut links = self.ship_pdf_link_material(
|
||||
b, device, &shipout.pdf_graphics_steps, files,
|
||||
)?;
|
||||
@@ -701,15 +738,7 @@ impl Executor {
|
||||
self.state.xdv_setup.apply_version(&mut pdf.file);
|
||||
}
|
||||
self.current = current;
|
||||
self.native_page.as_mut().unwrap().dead_cycles = 0;
|
||||
let before = self.statistics_before_shipout(&shipout.box_node, files)?;
|
||||
self.shipped_pages += 1;
|
||||
self.events.push(Event::Shipout(Box::new(shipout)));
|
||||
if probed_page && let Some(probe) = self.pdf_space_probe.as_mut() {
|
||||
Arc::make_mut(probe).observed_events = self.events.len();
|
||||
}
|
||||
self.statistics_after_shipout(before, files)?;
|
||||
Ok(())
|
||||
Ok((shipout, pdf_forms, probed_page))
|
||||
}
|
||||
|
||||
fn ship_xdv_paper(
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
//! pdfTeX Form registration and deferred output.
|
||||
use super::*;
|
||||
use crate::pdf_device::forms::{FormUse, ShippedForm};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(super) struct RegisteredForm {
|
||||
form: FormUse,
|
||||
body: Option<FormBody>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct FormBody {
|
||||
box_node: NativeBox,
|
||||
attributes: Vec<Token>,
|
||||
resources: Vec<Token>,
|
||||
}
|
||||
|
||||
impl Executor {
|
||||
fn check_pdf_form(&mut self) -> Result<(), Error> {
|
||||
if self.state.input_profile() != InputProfile::TeX8Bit
|
||||
|| self.native_page.is_none()
|
||||
|| self.read_parameter(Parameter::Pdfoutput).width() <= 0
|
||||
{
|
||||
return self.fail("PDF Form operation requires a native pdfTeX PDF job");
|
||||
}
|
||||
self.prepare_pdf_output_mode()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn scan_pdf_form(
|
||||
&mut self,
|
||||
immediate: bool,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
self.check_pdf_form()?;
|
||||
self.prepare_pdf_header(files)?;
|
||||
let attributes = if self.keyword("attr", files)? {
|
||||
self.with_scanner(ScannerStatus::Absorbing, |scanner| {
|
||||
scanner.scan_expanded_group_mode(files, false)
|
||||
})?
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let resources = if self.keyword("resources", files)? {
|
||||
self.with_scanner(ScannerStatus::Absorbing, |scanner| {
|
||||
scanner.scan_expanded_group_mode(files, false)
|
||||
})?
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let index = self.register_index(files)?;
|
||||
self.reads.insert(Dependency::BoxRegister(index));
|
||||
let box_node = self.state.take_box(index)
|
||||
.ok_or_else(|| self.error("\\pdfxform cannot be used with a void box", self.current))?;
|
||||
self.reads.insert(Dependency::PdfObjects);
|
||||
let limit = self.limits.tokens;
|
||||
let number = self.state.pdf_objects.get_or_insert_with(Default::default)
|
||||
.reserve_form(limit)
|
||||
.map_err(|message| self.error(message, self.current))?;
|
||||
let form = FormUse {
|
||||
number,
|
||||
width: box_node.width,
|
||||
height: box_node.height,
|
||||
depth: box_node.depth,
|
||||
};
|
||||
self.pdf_forms.insert(number, RegisteredForm {
|
||||
form,
|
||||
body: Some(FormBody { box_node, attributes, resources }),
|
||||
});
|
||||
if immediate {
|
||||
self.write_pdf_form(number, files)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn scan_pdf_form_reference(
|
||||
&mut self,
|
||||
token: &Token,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
self.check_pdf_form()?;
|
||||
let requested = self.integer(files)?;
|
||||
self.reads.insert(Dependency::PdfObjects);
|
||||
let form = u32::try_from(requested).ok()
|
||||
.and_then(|number| self.pdf_forms.get(&number))
|
||||
.map(|entry| entry.form)
|
||||
.ok_or_else(|| self.error("cannot find referenced PDF Form", token.span))?;
|
||||
self.defer_output(OutputNode {
|
||||
operation: OutputOperation::PdfForm { form, origin: token.into() },
|
||||
span: token.span,
|
||||
})
|
||||
}
|
||||
|
||||
pub(super) fn write_pdf_form(
|
||||
&mut self,
|
||||
number: u32,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
self.reads.insert(Dependency::PdfObjects);
|
||||
let entry = self.pdf_forms.get_mut(&number).expect("registered Form reference");
|
||||
let form = entry.form;
|
||||
let Some(body) = entry.body.take() else { return Ok(()) };
|
||||
let attributes = self.pdf_token_bytes(&body.attributes)?;
|
||||
let resources = self.pdf_token_bytes(&body.resources)?.into();
|
||||
let (canvas, children, probed) = self.ship_box_contents(body.box_node, Some(resources), files)?;
|
||||
self.events.push(Event::PdfForm(Box::new(ShippedForm { form, attributes, canvas })));
|
||||
if probed && let Some(probe) = self.pdf_space_probe.as_mut() {
|
||||
Arc::make_mut(probe).observed_events = self.events.len();
|
||||
}
|
||||
if !children.is_empty() {
|
||||
stacker::maybe_grow(64 * 1024, 2 * 1024 * 1024, || {
|
||||
self.write_shipout_forms(children, files)
|
||||
})?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub(super) fn write_shipout_forms(
|
||||
&mut self,
|
||||
forms: Vec<(u32, Span)>,
|
||||
files: &mut impl SourceProvider,
|
||||
) -> Result<(), Error> {
|
||||
let current = self.current;
|
||||
for (number, span) in forms {
|
||||
self.current = span;
|
||||
self.write_pdf_form(number, files)?;
|
||||
}
|
||||
self.current = current;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -220,6 +220,7 @@ impl Executor {
|
||||
| Primitive::Pdfrandomseed
|
||||
| Primitive::Pdflastobj
|
||||
| Primitive::Pdflastlink
|
||||
| Primitive::Pdflastxform
|
||||
| Primitive::Pdflastximage
|
||||
| Primitive::Pdflastximagepages
|
||||
| Primitive::Pdflastximagecolordepth
|
||||
|
||||
@@ -14,9 +14,9 @@ use std::{
|
||||
sync::{Arc, Mutex, OnceLock, Weak},
|
||||
};
|
||||
|
||||
const SCHEMA: u32 = 84;
|
||||
const COMPATIBLE_SCHEMAS: [u32; 51] = [
|
||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, SCHEMA,
|
||||
const SCHEMA: u32 = 85;
|
||||
const COMPATIBLE_SCHEMAS: [u32; 52] = [
|
||||
27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, SCHEMA,
|
||||
];
|
||||
const ENGINE: &str = concat!("texrra-native/", env!("CARGO_PKG_VERSION"));
|
||||
|
||||
|
||||
@@ -243,6 +243,10 @@ pub enum OutputOperation {
|
||||
PdfRestore,
|
||||
PdfTextSpace(crate::pdf_device::text_spaces::SpaceOperation),
|
||||
PdfLink(crate::pdf_device::links::LinkNode),
|
||||
PdfForm {
|
||||
form: crate::pdf_device::forms::FormUse,
|
||||
origin: super::TokenOrigin,
|
||||
},
|
||||
PdfImage {
|
||||
image: std::sync::Arc<crate::pdf_image::PdfImageUse>,
|
||||
origin: super::TokenOrigin,
|
||||
@@ -290,16 +294,19 @@ impl OutputNode {
|
||||
pub(super) fn dimensions(&self) -> Option<(i64, i64, i64)> {
|
||||
match &self.operation {
|
||||
OutputOperation::PdfImage { image, .. } => Some(image.dimensions()),
|
||||
OutputOperation::PdfForm { form, .. } => Some((form.width, form.height, form.depth)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn image_box(&self) -> Option<crate::HorizontalBox> {
|
||||
use crate::math_engine_tex::{MathGeometry, MathItem, PositionedItem};
|
||||
let OutputOperation::PdfImage { image, origin } = &self.operation else {
|
||||
return None;
|
||||
let (item, origin) = match &self.operation {
|
||||
OutputOperation::PdfImage { image, origin } => (MathItem::PdfImage(image.clone()), *origin),
|
||||
OutputOperation::PdfForm { form, origin } => (MathItem::PdfForm(*form), *origin),
|
||||
_ => return None,
|
||||
};
|
||||
let (width, height, depth) = image.dimensions();
|
||||
let (width, height, depth) = self.dimensions()?;
|
||||
Some(crate::HorizontalBox {
|
||||
width,
|
||||
height,
|
||||
@@ -313,8 +320,8 @@ impl OutputNode {
|
||||
items: vec![PositionedItem {
|
||||
x: 0,
|
||||
y: 0,
|
||||
item: MathItem::PdfImage(image.clone()),
|
||||
source: crate::provenance::PaintSource::token(*origin),
|
||||
item,
|
||||
source: crate::provenance::PaintSource::token(origin),
|
||||
}],
|
||||
})),
|
||||
..Default::default()
|
||||
|
||||
@@ -964,6 +964,7 @@ pub(crate) fn paint_geometry(
|
||||
width: bp(*width),
|
||||
height: bp(*height),
|
||||
},
|
||||
MathItem::PdfForm(form) => DisplayItem::PdfForm { x: ox + bp(x + p.x), y: oy + bp(y + p.y), form: *form },
|
||||
MathItem::PdfImage(image) => DisplayItem::PdfImage {
|
||||
x: ox + bp(x + p.x),
|
||||
y: oy + bp(y + p.y - image.height),
|
||||
|
||||
@@ -547,6 +547,7 @@ pub enum Event {
|
||||
BuiltDisplay(Box<NativeDisplay>),
|
||||
VerticalMaterial(Vec<NativeVerticalNode>),
|
||||
Shipout(Box<NativeShipout>),
|
||||
PdfForm(Box<crate::pdf_device::forms::ShippedForm>),
|
||||
Statistics(Box<StatisticsReport>),
|
||||
PageTrace(Box<PageTraceReport>),
|
||||
ParagraphTrace(Box<ParagraphTraceReport>),
|
||||
@@ -732,10 +733,18 @@ impl Execution {
|
||||
}
|
||||
let mut pages = Vec::new();
|
||||
let mut image_objects = Vec::new();
|
||||
let mut forms = Vec::new();
|
||||
for e in &self.events {
|
||||
if let Event::PdfImageObject(image) = e {
|
||||
image_objects.push(image.clone());
|
||||
}
|
||||
if let Event::PdfForm(form) = e {
|
||||
let mut list = form.canvas.display_list().map_err(|message| {
|
||||
Error::at(&self.sources, self.state.input_profile(), message, form.canvas.box_node.span)
|
||||
})?;
|
||||
list.pdf_resources.attributes = form.attributes.clone().into();
|
||||
forms.push(crate::pdf_device::forms::FormDisplay { form: form.form, list });
|
||||
}
|
||||
if let Event::Shipout(b) = e {
|
||||
pages.push(b.display_list().map_err(|message| {
|
||||
Error::at(
|
||||
@@ -748,7 +757,13 @@ impl Execution {
|
||||
}
|
||||
}
|
||||
self.resolve_page_graphics_resources(&mut pages)?;
|
||||
for form in &mut forms {
|
||||
let attributes = std::mem::take(&mut form.list.pdf_resources.attributes);
|
||||
self.resolve_page_graphics_resources(std::slice::from_mut(&mut form.list))?;
|
||||
form.list.pdf_resources.attributes = attributes;
|
||||
}
|
||||
if let Some(first) = pages.first_mut() {
|
||||
first.forms = forms;
|
||||
first.items.extend(
|
||||
image_objects
|
||||
.into_iter()
|
||||
|
||||
@@ -90,6 +90,9 @@ pub enum Primitive {
|
||||
Pdffilesize,
|
||||
Pdffilemoddate,
|
||||
Pdfmdfivesum,
|
||||
Pdfxform,
|
||||
Pdfrefxform,
|
||||
Pdflastxform,
|
||||
Pdfximage,
|
||||
Pdfrefximage,
|
||||
Pdflastximage,
|
||||
@@ -880,6 +883,9 @@ const PDFTEX_ONLY_PRIMITIVES: &[(&str, Primitive)] = {
|
||||
("pdffilesize", Pdffilesize),
|
||||
("pdffilemoddate", Pdffilemoddate),
|
||||
("pdfmdfivesum", Pdfmdfivesum),
|
||||
("pdfxform", Pdfxform),
|
||||
("pdfrefxform", Pdfrefxform),
|
||||
("pdflastxform", Pdflastxform),
|
||||
("pdfximage", Pdfximage),
|
||||
("pdfrefximage", Pdfrefximage),
|
||||
("pdflastximage", Pdflastximage),
|
||||
|
||||
Reference in new issue
Block a user