diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 203d9df2..59c791a5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,7 @@ name: Continuous integration on: [push, pull_request] + env: KRILLA_THRESHOLD: "200" VISREG: "" @@ -40,20 +41,20 @@ jobs: uses: actions/cache@v4 with: path: mutool - key: mupdf-binary-v1 + key: mupdf-binary-v2 - name: Download MuPDF if: steps.cache-mupdf.outputs.cache-hit != 'true' run: | - curl -LO https://mupdf.com/downloads/archive/mupdf-1.24.8-source.tar.gz - tar -xvzf ./mupdf-1.24.8-source.tar.gz + curl -LO https://mupdf.com/downloads/archive/mupdf-1.25.1-source.tar.gz + tar -xvzf ./mupdf-1.25.1-source.tar.gz - name: Build MuPDF if: steps.cache-mupdf.outputs.cache-hit != 'true' run: | - cd mupdf-1.24.8-source + cd mupdf-1.25.1-source make HAVE_X11=no HAVE_GLUT=no - name: Finish if: steps.cache-mupdf.outputs.cache-hit != 'true' - run: mv mupdf-1.24.8-source/build/release/mutool mutool + run: mv mupdf-1.25.1-source/build/release/mutool mutool gs: name: gs @@ -114,7 +115,7 @@ jobs: - uses: actions/cache@v4 with: path: mutool - key: mupdf-binary-v1 + key: mupdf-binary-v2 - uses: actions/cache@v4 with: diff --git a/crates/krilla/src/content.rs b/crates/krilla/src/content.rs index 06aca42f..ff185273 100644 --- a/crates/krilla/src/content.rs +++ b/crates/krilla/src/content.rs @@ -1,9 +1,6 @@ //! A low-level abstraction over a single content stream. -use crate::color::{ - Color, ColorSpace, ICCBasedColorSpace, LinearRgbColorSpace, DEVICE_CMYK, DEVICE_GRAY, - DEVICE_RGB, -}; +use crate::color::Color; use crate::font::{Font, Glyph, GlyphUnits}; use crate::graphics_state::GraphicsStates; #[cfg(feature = "raster-images")] @@ -19,7 +16,8 @@ use crate::object::tiling_pattern::TilingPattern; use crate::object::xobject::XObject; use crate::paint::{InnerPaint, Paint}; use crate::path::{Fill, FillRule, LineCap, LineJoin, Stroke}; -use crate::resource::ResourceDictionaryBuilder; +use crate::resource; +use crate::resource::{Resource, ResourceDictionaryBuilder}; use crate::serialize::SerializerContext; use crate::stream::Stream; use crate::tagging::ContentTag; @@ -362,7 +360,7 @@ impl ContentBuilder { ) { let font_name = self .rd_builder - .register_resource(font_identifier.clone(), sc); + .register_resource(sc.add_font_identifier(font_identifier)); self.content.set_font(font_name.to_pdf_name(), size); self.content.set_text_matrix( Transform::from_row(1.0, 0.0, 0.0, -1.0, *cur_x, cur_y).to_pdf_transform(), @@ -532,7 +530,7 @@ impl ContentBuilder { sb.expand_bbox(bbox); }, move |sb, sc| { - let x_object_name = sb.rd_builder.register_resource(x_object, sc); + let x_object_name = sb.rd_builder.register_resource(sc.add_resource(x_object)); sb.content.x_object(x_object_name.to_pdf_name()); }, sc, @@ -575,7 +573,9 @@ impl ContentBuilder { sb.expand_bbox(Rect::from_xywh(0.0, 0.0, 1.0, 1.0).unwrap()); }, move |sb, sc| { - let image_name = sb.rd_builder.register_resource(image, sc); + let image_name = sb + .rd_builder + .register_resource(resource::XObject::new(sc.add_image(image))); sb.content.x_object(image_name.to_pdf_name()); }, @@ -587,7 +587,9 @@ impl ContentBuilder { self.apply_isolated_op( |_, _| {}, move |sb, sc| { - let sh = sb.rd_builder.register_resource(shading.clone(), sc); + let sh = sb + .rd_builder + .register_resource(sc.add_resource(shading.clone())); sb.content.shading(sh.to_pdf_name()); }, sc, @@ -628,7 +630,9 @@ impl ContentBuilder { let state = self.graphics_states.cur().ext_g_state().clone(); if !state.empty() { - let ext = self.rd_builder.register_resource(state, sc); + let ext = self + .rd_builder + .register_resource::(sc.add_resource(state)); self.content.set_parameters(ext.to_pdf_name()); } @@ -651,27 +655,6 @@ impl ContentBuilder { transform.post_concat(self.cur_transform_with_root_transform()) }; - let color_to_string = - |color: Color, content_builder: &mut ContentBuilder, sc: &mut SerializerContext| { - match color.color_space(sc) { - ColorSpace::LinearRgb => content_builder - .rd_builder - .register_resource(LinearRgbColorSpace, sc), - ColorSpace::Srgb => content_builder.rd_builder.register_resource( - ICCBasedColorSpace(sc.serialize_settings().pdf_version.rgb_icc()), - sc, - ), - ColorSpace::Luma => content_builder.rd_builder.register_resource( - ICCBasedColorSpace(sc.serialize_settings().pdf_version.grey_icc()), - sc, - ), - ColorSpace::Cmyk(p) => content_builder.rd_builder.register_resource(p, sc), - ColorSpace::DeviceRgb => DEVICE_RGB.to_string(), - ColorSpace::DeviceGray => DEVICE_GRAY.to_string(), - ColorSpace::DeviceCmyk => DEVICE_CMYK.to_string(), - } - }; - let mut write_gradient = |gradient_props: GradientProperties, sc: &mut SerializerContext, @@ -680,8 +663,11 @@ impl ContentBuilder { if let Some((color, opacity)) = gradient_props.single_stop_color() { // Write gradients with one stop as a solid color fill. content_builder.set_fill_opacity(opacity); - let color_space = color_to_string(color, content_builder, sc); - set_solid_fn(&mut content_builder.content, color_space, color); + let color_space = color.color_space(sc); + let color_space_resource = content_builder + .rd_builder + .register_resource(sc.add_cs(color_space)); + set_solid_fn(&mut content_builder.content, color_space_resource, color); } else { let shading_mask = Mask::new_from_shading(gradient_props.clone(), transform, bounds, sc); @@ -694,12 +680,14 @@ impl ContentBuilder { ); let color_space = content_builder .rd_builder - .register_resource(shading_pattern, sc); + .register_resource::(sc.add_resource(shading_pattern)); if let Some(shading_mask) = shading_mask { let state = ExtGState::new().mask(shading_mask, sc); - let ext = content_builder.rd_builder.register_resource(state, sc); + let ext = content_builder + .rd_builder + .register_resource::(sc.add_resource(state)); content_builder.content.set_parameters(ext.to_pdf_name()); } @@ -709,8 +697,9 @@ impl ContentBuilder { match &paint.0 { InnerPaint::Color(c) => { - let color_space = color_to_string(*c, self, sc); - set_solid_fn(&mut self.content, color_space, *c); + let cs = c.color_space(sc); + let color_space_resource = self.rd_builder.register_resource(sc.add_cs(cs)); + set_solid_fn(&mut self.content, color_space_resource, *c); } InnerPaint::LinearGradient(lg) => { let (gradient_props, transform) = lg.clone().gradient_properties(bounds); @@ -737,7 +726,9 @@ impl ContentBuilder { sc, ); - let color_space = self.rd_builder.register_resource(tiling_pattern, sc); + let color_space = self + .rd_builder + .register_resource::(sc.add_resource(tiling_pattern)); set_pattern_fn(&mut self.content, color_space); } } diff --git a/crates/krilla/src/object/color.rs b/crates/krilla/src/object/color.rs index dd925946..3b791580 100644 --- a/crates/krilla/src/object/color.rs +++ b/crates/krilla/src/object/color.rs @@ -38,13 +38,13 @@ //! was provided to the serialize settings, this will be used for CMYK colors. Otherwise, //! it will fall back to device CMYK. -use crate::object::{ChunkContainerFn, Object}; -use crate::resource::{RegisterableResource, Resource}; +use crate::object::{ChunkContainerFn, Object, Resourceable}; +use crate::resource; use crate::serialize::SerializerContext; use crate::stream::FilterStream; use crate::util::Prehashed; use crate::validation::ValidationError; -use pdf_writer::{Buf, Chunk, Finish, Name, Ref}; +use pdf_writer::{Chunk, Finish, Name, Ref}; use std::fmt::{Debug, Formatter}; use std::hash::{Hash, Hasher}; use std::ops::{Deref, DerefMut}; @@ -389,6 +389,10 @@ impl Object for ICCBasedColorSpace { } } +impl Resourceable for ICCBasedColorSpace { + type Resource = resource::ColorSpace; +} + #[derive(Clone, Hash, Debug, Eq, PartialEq)] pub(crate) enum ICCColorSpace { Xyz, @@ -480,41 +484,6 @@ impl ICCMetadata { } } -impl RegisterableResource for ICCBasedColorSpace<4> {} -impl RegisterableResource for ICCBasedColorSpace<3> {} -impl RegisterableResource for ICCBasedColorSpace<1> {} - -#[derive(Copy, Clone, Hash)] -pub(crate) struct LinearRgbColorSpace; - -impl Object for LinearRgbColorSpace { - fn chunk_container(&self) -> ChunkContainerFn { - Box::new(|cc| &mut cc.color_spaces) - } - - fn serialize(self, _: &mut SerializerContext, root_ref: Ref) -> Chunk { - let mut chunk = Chunk::new(); - chunk.color_space(root_ref).cal_rgb( - [0.9505, 1.0, 1.0888], - None, - Some([1.0, 1.0, 1.0]), - Some([ - 0.4124, 0.2126, 0.0193, 0.3576, 0.715, 0.1192, 0.1805, 0.0722, 0.9505, - ]), - ); - - chunk - } -} - -impl From for Resource { - fn from(_: LinearRgbColorSpace) -> Self { - Resource::LinearRgb - } -} - -impl RegisterableResource for LinearRgbColorSpace {} - #[cfg(test)] mod tests { @@ -522,19 +491,18 @@ mod tests { use crate::page::Page; use crate::path::Fill; - use crate::resource::Resource; use crate::surface::Surface; use crate::tests::{cmyk_fill, rect_to_path, red_fill}; use krilla_macros::{snapshot, visreg}; #[snapshot] fn color_space_sgray(sc: &mut SerializerContext) { - sc.add_resource(Resource::Luma); + sc.add_luma(); } #[snapshot] fn color_space_srgb(sc: &mut SerializerContext) { - sc.add_resource(Resource::Srgb); + sc.add_srgb(); } #[snapshot(single_page, settings_18)] @@ -563,20 +531,3 @@ mod tests { surface.fill_path(&path, cmyk_fill(1.0)); } } - -/// Stores either the name of one of the default color spaces (i.e. DeviceRGB), or -/// a reference to a color space in the PDF. -#[derive(Copy, Clone)] -pub(crate) enum CSWrapper { - Ref(Ref), - Name(Name<'static>), -} - -impl pdf_writer::Primitive for CSWrapper { - fn write(self, buf: &mut Buf) { - match self { - CSWrapper::Ref(r) => r.write(buf), - CSWrapper::Name(n) => n.write(buf), - } - } -} diff --git a/crates/krilla/src/object/ext_g_state.rs b/crates/krilla/src/object/ext_g_state.rs index bf826462..330c928c 100644 --- a/crates/krilla/src/object/ext_g_state.rs +++ b/crates/krilla/src/object/ext_g_state.rs @@ -1,6 +1,6 @@ use crate::object::mask::Mask; -use crate::object::{ChunkContainerFn, Object}; -use crate::resource::RegisterableResource; +use crate::object::{ChunkContainerFn, Object, Resourceable}; +use crate::resource; use crate::serialize::SerializerContext; use crate::validation::ValidationError; use pdf_writer::types::BlendMode; @@ -99,8 +99,6 @@ impl ExtGState { } } -impl RegisterableResource for ExtGState {} - impl Object for ExtGState { fn chunk_container(&self) -> ChunkContainerFn { Box::new(|cc| &mut cc.ext_g_states) @@ -146,6 +144,10 @@ impl Object for ExtGState { } } +impl Resourceable for ExtGState { + type Resource = resource::ExtGState; +} + #[cfg(test)] mod tests { use crate::object::ext_g_state::ExtGState; diff --git a/crates/krilla/src/object/font/mod.rs b/crates/krilla/src/object/font/mod.rs index c2cf5a03..f8a277d8 100644 --- a/crates/krilla/src/object/font/mod.rs +++ b/crates/krilla/src/object/font/mod.rs @@ -3,7 +3,6 @@ use crate::font::Font; use crate::object::font::cid_font::CIDFont; use crate::object::font::type3_font::{CoveredGlyph, Type3FontMapper, Type3ID}; use crate::path::{Fill, Stroke}; -use crate::resource::RegisterableResource; pub(crate) mod cid_font; pub(crate) mod type3_font; @@ -43,8 +42,6 @@ pub(crate) enum FontIdentifier { Type3(Type3Identifier), } -impl RegisterableResource for FontIdentifier {} - /// The owned version of `PaintMode`. #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub(crate) enum OwnedPaintMode { diff --git a/crates/krilla/src/object/font/type3_font.rs b/crates/krilla/src/object/font/type3_font.rs index b4e35b59..1c183881 100644 --- a/crates/krilla/src/object/font/type3_font.rs +++ b/crates/krilla/src/object/font/type3_font.rs @@ -215,7 +215,7 @@ impl Type3Font { let x_object = XObject::new(stream, false, false, None); if !x_object.is_empty() { font_bbox.expand(&x_object.bbox()); - let x_name = rd_builder.register_resource(x_object, sc); + let x_name = rd_builder.register_resource(sc.add_resource(x_object)); content.x_object(x_name.to_pdf_name()); } diff --git a/crates/krilla/src/object/image.rs b/crates/krilla/src/object/image.rs index a506a6fd..d64e095f 100644 --- a/crates/krilla/src/object/image.rs +++ b/crates/krilla/src/object/image.rs @@ -12,7 +12,6 @@ use crate::color::{ICCBasedColorSpace, ICCProfile, ICCProfileWrapper, DEVICE_CMYK, DEVICE_RGB}; use crate::error::{KrillaError, KrillaResult}; use crate::object::color::DEVICE_GRAY; -use crate::resource::RegisterableResource; use crate::serialize::SerializerContext; use crate::stream::FilterStream; use crate::util::{Deferred, NameExt, SipHashable}; @@ -516,8 +515,6 @@ fn decode_webp(data: &[u8]) -> Option { })) } -impl RegisterableResource for Image {} - fn handle_u8_image(data: Vec, cs: ColorSpace) -> (Vec, Option>, BitsPerComponent) { let mut alphas = if cs.has_alpha() { Vec::with_capacity(data.len() / cs.num_components()) diff --git a/crates/krilla/src/object/mask.rs b/crates/krilla/src/object/mask.rs index 551314a4..a6f691de 100644 --- a/crates/krilla/src/object/mask.rs +++ b/crates/krilla/src/object/mask.rs @@ -2,7 +2,8 @@ use crate::object::shading_function::{GradientProperties, ShadingFunction}; use crate::object::xobject::XObject; -use crate::object::{ChunkContainerFn, Object}; +use crate::object::{ChunkContainerFn, Object, Resourceable}; +use crate::resource; use crate::serialize::SerializerContext; use crate::stream::Stream; use crate::stream::StreamBuilder; @@ -102,7 +103,7 @@ impl Object for Mask { fn serialize(self, sc: &mut SerializerContext, root_ref: Ref) -> Chunk { let mut chunk = Chunk::new(); - let x_ref = sc.add_object(XObject::new( + let x_object = sc.add_object(XObject::new( self.stream, false, true, @@ -112,7 +113,7 @@ impl Object for Mask { let mut dict = chunk.indirect(root_ref).dict(); dict.pair(Name(b"Type"), Name(b"Mask")); dict.pair(Name(b"S"), self.mask_type.to_name()); - dict.pair(Name(b"G"), x_ref); + dict.pair(Name(b"G"), x_object); dict.finish(); @@ -120,6 +121,10 @@ impl Object for Mask { } } +impl Resourceable for Mask { + type Resource = resource::XObject; +} + #[cfg(test)] mod tests { diff --git a/crates/krilla/src/object/mod.rs b/crates/krilla/src/object/mod.rs index 9664f074..9d1bca1f 100644 --- a/crates/krilla/src/object/mod.rs +++ b/crates/krilla/src/object/mod.rs @@ -1,4 +1,5 @@ use crate::chunk_container::ChunkContainer; +use crate::resource::Resource; use crate::serialize::SerializerContext; use crate::util::SipHashable; use pdf_writer::{Chunk, Ref}; @@ -25,3 +26,7 @@ pub(crate) trait Object: SipHashable { fn chunk_container(&self) -> ChunkContainerFn; fn serialize(self, sc: &mut SerializerContext, root_ref: Ref) -> Chunk; } + +pub(crate) trait Resourceable: Object { + type Resource: Resource; +} diff --git a/crates/krilla/src/object/shading_function.rs b/crates/krilla/src/object/shading_function.rs index 79223cd0..50998b2e 100644 --- a/crates/krilla/src/object/shading_function.rs +++ b/crates/krilla/src/object/shading_function.rs @@ -1,9 +1,10 @@ use crate::color::luma; use crate::object::color::Color; -use crate::object::{ChunkContainerFn, Object}; +use crate::object::{ChunkContainerFn, Object, Resourceable}; use crate::paint::SpreadMethod; use crate::paint::{LinearGradient, RadialGradient, SweepGradient}; -use crate::resource::RegisterableResource; +use crate::resource; +use crate::resource::Resource; use crate::serialize::SerializerContext; use crate::util::{RectExt, RectWrapper}; use crate::validation::ValidationError; @@ -219,8 +220,6 @@ impl ShadingFunction { } } -impl RegisterableResource for ShadingFunction {} - impl Object for ShadingFunction { fn chunk_container(&self) -> ChunkContainerFn { Box::new(|cc| &mut cc.shading_functions) @@ -243,6 +242,10 @@ impl Object for ShadingFunction { } } +impl Resourceable for ShadingFunction { + type Resource = resource::Shading; +} + fn serialize_postscript_shading( sc: &mut SerializerContext, chunk: &mut Chunk, @@ -267,7 +270,9 @@ fn serialize_postscript_shading( let mut shading = chunk.function_shading(root_ref); shading.shading_type(FunctionShadingType::Function); - shading.insert(Name(b"ColorSpace")).primitive(sc.add_cs(cs)); + shading + .insert(Name(b"ColorSpace")) + .primitive(sc.add_cs(cs).get_ref()); // Write the identity matrix, because ghostscript has a bug where // it thinks the entry is mandatory. shading.matrix([1.0, 0.0, 0.0, 1.0, 0.0, 0.0]); @@ -302,7 +307,9 @@ fn serialize_axial_radial_shading( } else { shading.shading_type(FunctionShadingType::Axial); } - shading.insert(Name(b"ColorSpace")).primitive(sc.add_cs(cs)); + shading + .insert(Name(b"ColorSpace")) + .primitive(sc.add_cs(cs).get_ref()); shading.anti_alias(radial_axial_gradient.anti_alias); shading.function(function_ref); diff --git a/crates/krilla/src/object/shading_pattern.rs b/crates/krilla/src/object/shading_pattern.rs index dafd45f6..e05917cc 100644 --- a/crates/krilla/src/object/shading_pattern.rs +++ b/crates/krilla/src/object/shading_pattern.rs @@ -1,6 +1,6 @@ use crate::object::shading_function::{GradientProperties, ShadingFunction}; -use crate::object::{ChunkContainerFn, Object}; -use crate::resource::RegisterableResource; +use crate::object::{ChunkContainerFn, Object, Resourceable}; +use crate::resource; use crate::serialize::SerializerContext; use crate::util::{HashExt, TransformExt}; use pdf_writer::{Chunk, Finish, Name, Ref}; @@ -36,8 +36,6 @@ impl ShadingPattern { } } -impl RegisterableResource for ShadingPattern {} - impl Object for ShadingPattern { fn chunk_container(&self) -> ChunkContainerFn { Box::new(|cc| &mut cc.patterns) @@ -57,6 +55,10 @@ impl Object for ShadingPattern { } } +impl Resourceable for ShadingPattern { + type Resource = resource::Pattern; +} + #[cfg(test)] mod tests { use crate::object::shading_function::GradientPropertiesExt; diff --git a/crates/krilla/src/object/tiling_pattern.rs b/crates/krilla/src/object/tiling_pattern.rs index 582fcbde..9c5dddb5 100644 --- a/crates/krilla/src/object/tiling_pattern.rs +++ b/crates/krilla/src/object/tiling_pattern.rs @@ -1,5 +1,5 @@ -use crate::object::{ChunkContainerFn, Object}; -use crate::resource::RegisterableResource; +use crate::object::{ChunkContainerFn, Object, Resourceable}; +use crate::resource; use crate::serialize::SerializerContext; use crate::stream::StreamBuilder; use crate::stream::{FilterStream, Stream}; @@ -67,8 +67,6 @@ impl TilingPattern { } } -impl RegisterableResource for TilingPattern {} - impl Object for TilingPattern { fn chunk_container(&self) -> ChunkContainerFn { Box::new(|cc| &mut cc.patterns) @@ -106,6 +104,10 @@ impl Object for TilingPattern { } } +impl Resourceable for TilingPattern { + type Resource = resource::Pattern; +} + #[cfg(test)] mod tests { diff --git a/crates/krilla/src/object/xobject.rs b/crates/krilla/src/object/xobject.rs index 5cd03d4c..6f54d78f 100644 --- a/crates/krilla/src/object/xobject.rs +++ b/crates/krilla/src/object/xobject.rs @@ -1,6 +1,7 @@ use crate::color::rgb; -use crate::object::{ChunkContainerFn, Object}; -use crate::resource::RegisterableResource; +use crate::object::{ChunkContainerFn, Object, Resourceable}; +use crate::resource; +use crate::resource::Resource; use crate::serialize::SerializerContext; use crate::stream::{FilterStream, Stream}; use crate::util::{RectExt, RectWrapper}; @@ -41,8 +42,6 @@ impl XObject { } } -impl RegisterableResource for XObject {} - impl Object for XObject { fn chunk_container(&self) -> ChunkContainerFn { Box::new(|cc| &mut cc.x_objects) @@ -82,7 +81,7 @@ impl Object for XObject { if self.transparency_group_color_space { let cs = rgb::Color::rgb_color_space(sc.serialize_settings().no_device_cs); - transparency.pair(Name(b"CS"), sc.add_cs(cs)); + transparency.pair(Name(b"CS"), sc.add_cs(cs).get_ref()); } transparency.finish(); @@ -95,6 +94,10 @@ impl Object for XObject { } } +impl Resourceable for XObject { + type Resource = resource::XObject; +} + #[cfg(test)] mod tests { diff --git a/crates/krilla/src/resource.rs b/crates/krilla/src/resource.rs index 0357512a..c844e549 100644 --- a/crates/krilla/src/resource.rs +++ b/crates/krilla/src/resource.rs @@ -1,16 +1,10 @@ //! Dealing with PDF resources. -use crate::color::{ICCBasedColorSpace, ICCProfile}; -use crate::object::font::FontIdentifier; -#[cfg(feature = "raster-images")] -use crate::object::image::Image; -use crate::object::shading_pattern::ShadingPattern; -use crate::object::tiling_pattern::TilingPattern; -use crate::serialize::SerializerContext; +use crate::color::ICCProfile; use crate::util::NameExt; use once_cell::sync::Lazy; use pdf_writer::types::ProcSet; -use pdf_writer::writers::{FormXObject, Page, Pages, Resources, Type3Font}; +use pdf_writer::writers; use pdf_writer::{Dict, Finish, Ref}; use std::collections::HashMap; use std::fmt::Debug; @@ -18,23 +12,27 @@ use std::hash::Hash; use std::marker::PhantomData; use std::sync::Arc; -pub(crate) trait RegisterableResource: Into -where - T: ResourceTrait, -{ -} - -pub(crate) trait ResourceTrait { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a>; +pub(crate) trait Resource { + fn new(ref_: Ref) -> Self; + fn get_ref(&self) -> Ref; + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a>; fn get_prefix() -> &'static str; fn get_mapper(b: &mut ResourceDictionaryBuilder) -> &mut ResourceMapper; } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] -pub(crate) struct ExtGState; +#[derive(Debug, Eq, PartialEq, Hash, Clone)] +pub(crate) struct ExtGState(Ref); + +impl Resource for ExtGState { + fn new(ref_: Ref) -> Self { + Self(ref_) + } + + fn get_ref(&self) -> Ref { + self.0 + } -impl ResourceTrait for ExtGState { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a> { + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a> { resources.ext_g_states() } @@ -47,11 +45,19 @@ impl ResourceTrait for ExtGState { } } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] -pub(crate) struct ColorSpace; +#[derive(Debug, Eq, PartialEq, Hash, Clone)] +pub(crate) struct ColorSpace(Ref); + +impl Resource for ColorSpace { + fn new(ref_: Ref) -> Self { + Self(ref_) + } -impl ResourceTrait for ColorSpace { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a> { + fn get_ref(&self) -> Ref { + self.0 + } + + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a> { resources.color_spaces() } @@ -64,11 +70,19 @@ impl ResourceTrait for ColorSpace { } } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] -pub(crate) struct ShadingFunction; +#[derive(Debug, Eq, PartialEq, Hash, Clone)] +pub(crate) struct Shading(Ref); -impl ResourceTrait for ShadingFunction { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a> { +impl Resource for Shading { + fn new(ref_: Ref) -> Self { + Self(ref_) + } + + fn get_ref(&self) -> Ref { + self.0 + } + + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a> { resources.shadings() } @@ -76,16 +90,24 @@ impl ResourceTrait for ShadingFunction { "s" } - fn get_mapper(b: &mut ResourceDictionaryBuilder) -> &mut ResourceMapper { + fn get_mapper(b: &mut ResourceDictionaryBuilder) -> &mut ResourceMapper { &mut b.shadings } } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] -pub(crate) struct XObject; +#[derive(Debug, Eq, PartialEq, Hash, Clone)] +pub(crate) struct XObject(Ref); + +impl Resource for XObject { + fn new(ref_: Ref) -> Self { + Self(ref_) + } + + fn get_ref(&self) -> Ref { + self.0 + } -impl ResourceTrait for XObject { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a> { + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a> { resources.x_objects() } @@ -98,11 +120,19 @@ impl ResourceTrait for XObject { } } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] -pub(crate) struct Pattern; +#[derive(Debug, Eq, PartialEq, Hash, Clone)] +pub(crate) struct Pattern(Ref); + +impl Resource for Pattern { + fn new(ref_: Ref) -> Self { + Self(ref_) + } + + fn get_ref(&self) -> Ref { + self.0 + } -impl ResourceTrait for Pattern { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a> { + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a> { resources.patterns() } @@ -115,11 +145,19 @@ impl ResourceTrait for Pattern { } } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] -pub(crate) struct Font; +#[derive(Debug, Eq, PartialEq, Hash, Clone)] +pub(crate) struct Font(Ref); -impl ResourceTrait for Font { - fn get_dict<'a>(resources: &'a mut Resources) -> Dict<'a> { +impl Resource for Font { + fn new(ref_: Ref) -> Self { + Self(ref_) + } + + fn get_ref(&self) -> Ref { + self.0 + } + + fn get_dict<'a>(resources: &'a mut writers::Resources) -> Dict<'a> { resources.fonts() } @@ -132,90 +170,13 @@ impl ResourceTrait for Font { } } -#[derive(Hash, Eq, PartialEq)] -pub(crate) enum Resource { - XObject(crate::object::xobject::XObject), - #[cfg(feature = "raster-images")] - Image(Image), - ShadingPattern(ShadingPattern), - TilingPattern(TilingPattern), - ExtGState(crate::object::ext_g_state::ExtGState), - LinearRgb, - Srgb, - Luma, - Cmyk(ICCBasedColorSpace<4>), - ShadingFunction(crate::object::shading_function::ShadingFunction), - FontIdentifier(FontIdentifier), -} - -impl From for Resource { - fn from(value: crate::object::xobject::XObject) -> Self { - Self::XObject(value) - } -} - -#[cfg(feature = "raster-images")] -impl From for Resource { - fn from(value: Image) -> Self { - Self::Image(value) - } -} - -impl From> for Resource { - fn from(_: ICCBasedColorSpace<3>) -> Self { - Self::Srgb - } -} - -impl From> for Resource { - fn from(_: ICCBasedColorSpace<1>) -> Self { - Self::Luma - } -} - -impl From> for Resource { - fn from(cs: ICCBasedColorSpace<4>) -> Self { - Self::Cmyk(cs) - } -} - -impl From for Resource { - fn from(value: ShadingPattern) -> Self { - Self::ShadingPattern(value) - } -} - -impl From for Resource { - fn from(value: TilingPattern) -> Self { - Self::TilingPattern(value) - } -} - -impl From for Resource { - fn from(value: crate::object::shading_function::ShadingFunction) -> Self { - Self::ShadingFunction(value) - } -} - -impl From for Resource { - fn from(value: crate::object::ext_g_state::ExtGState) -> Self { - Self::ExtGState(value) - } -} - -impl From for Resource { - fn from(value: FontIdentifier) -> Self { - Self::FontIdentifier(value) - } -} - #[derive(Debug)] pub(crate) struct ResourceDictionaryBuilder { pub color_spaces: ResourceMapper, pub ext_g_states: ResourceMapper, pub patterns: ResourceMapper, pub x_objects: ResourceMapper, - pub shadings: ResourceMapper, + pub shadings: ResourceMapper, pub fonts: ResourceMapper, } @@ -231,18 +192,12 @@ impl ResourceDictionaryBuilder { } } - pub(crate) fn register_resource( - &mut self, - resource: T, - sc: &mut SerializerContext, - ) -> String + // TODO: Make type safe instead of taking Ref? + pub(crate) fn register_resource(&mut self, obj: T) -> String where - T: RegisterableResource, - V: ResourceTrait, + T: Resource, { - let ref_ = sc.add_resource(resource); - - V::get_mapper(self).remap_with_name(ref_) + T::get_mapper(self).remap_with_name(obj.get_ref()) } pub fn finish(self) -> ResourceDictionary { @@ -257,16 +212,31 @@ impl ResourceDictionaryBuilder { } } -#[derive(Debug, Eq, PartialEq, Hash, Default, Clone)] +#[derive(Debug, Eq, PartialEq, Hash, Clone)] pub(crate) struct ResourceDictionary { pub color_spaces: ResourceList, pub ext_g_states: ResourceList, pub patterns: ResourceList, pub x_objects: ResourceList, - pub shadings: ResourceList, + pub shadings: ResourceList, pub fonts: ResourceList, } +impl Default for ResourceDictionary { + fn default() -> Self { + Self { + color_spaces: ResourceList::empty(), + ext_g_states: ResourceList::empty(), + patterns: ResourceList::empty(), + x_objects: ResourceList::empty(), + shadings: ResourceList::empty(), + fonts: ResourceList::empty(), + } + } +} + +pub type ResourceNumber = u32; + impl ResourceDictionary { pub fn to_pdf_resources(&self, parent: &mut T) where @@ -283,14 +253,14 @@ impl ResourceDictionary { write_resource_type::(resources, &self.ext_g_states); write_resource_type::(resources, &self.patterns); write_resource_type::(resources, &self.x_objects); - write_resource_type::(resources, &self.shadings); + write_resource_type::(resources, &self.shadings); write_resource_type::(resources, &self.fonts); } } -fn write_resource_type(resources: &mut Resources, resource_list: &ResourceList) +fn write_resource_type(resources: &mut writers::Resources, resource_list: &ResourceList) where - T: ResourceTrait, + T: Resource, { if resource_list.len() > 0 { let mut dict = T::get_dict(resources); @@ -311,8 +281,15 @@ pub(crate) struct ResourceList { impl ResourceList where - T: ResourceTrait, + T: Resource, { + pub fn empty() -> ResourceList { + Self { + entries: vec![], + phantom: Default::default(), + } + } + pub fn len(&self) -> u32 { self.entries.len() as u32 } @@ -338,7 +315,7 @@ pub(crate) struct ResourceMapper { impl ResourceMapper where - T: ResourceTrait, + T: Resource, { pub fn new() -> Self { Self { @@ -375,8 +352,7 @@ where } } -pub type ResourceNumber = u32; - +// TODO: Move /// The ICC v4 profile for the SRGB color space. pub(crate) static SRGB_V4_ICC: Lazy> = Lazy::new(|| ICCProfile::new(Arc::new(include_bytes!("icc/sRGB-v4.icc"))).unwrap()); @@ -390,38 +366,36 @@ pub(crate) static GREY_V4_ICC: Lazy> = pub(crate) static GREY_V2_ICC: Lazy> = Lazy::new(|| ICCProfile::new(Arc::new(include_bytes!("icc/sGrey-v2-magic.icc"))).unwrap()); -/// A trait for getting the resource dictionary of an object. pub trait ResourcesExt { - /// Return the resources dictionary of the object. - fn resources(&mut self) -> Resources<'_>; + fn resources(&mut self) -> writers::Resources<'_>; } -impl ResourcesExt for FormXObject<'_> { - fn resources(&mut self) -> Resources<'_> { +impl ResourcesExt for writers::FormXObject<'_> { + fn resources(&mut self) -> writers::Resources<'_> { self.resources() } } -impl ResourcesExt for pdf_writer::writers::TilingPattern<'_> { - fn resources(&mut self) -> Resources<'_> { +impl ResourcesExt for writers::TilingPattern<'_> { + fn resources(&mut self) -> writers::Resources<'_> { self.resources() } } -impl ResourcesExt for Type3Font<'_> { - fn resources(&mut self) -> Resources<'_> { +impl ResourcesExt for writers::Type3Font<'_> { + fn resources(&mut self) -> writers::Resources<'_> { self.resources() } } -impl ResourcesExt for Pages<'_> { - fn resources(&mut self) -> Resources<'_> { +impl ResourcesExt for writers::Pages<'_> { + fn resources(&mut self) -> writers::Resources<'_> { self.resources() } } -impl ResourcesExt for Page<'_> { - fn resources(&mut self) -> Resources<'_> { +impl ResourcesExt for writers::Page<'_> { + fn resources(&mut self) -> writers::Resources<'_> { self.resources() } } diff --git a/crates/krilla/src/serialize.rs b/crates/krilla/src/serialize.rs index edfe07d8..6599393f 100644 --- a/crates/krilla/src/serialize.rs +++ b/crates/krilla/src/serialize.rs @@ -1,22 +1,23 @@ use crate::chunk_container::ChunkContainer; -use crate::color::{ColorSpace, ICCBasedColorSpace, ICCProfile, LinearRgbColorSpace, DEVICE_CMYK}; +use crate::color::{ColorSpace, ICCBasedColorSpace, ICCProfile, DEVICE_CMYK}; use crate::destination::{NamedDestination, XyzDestination}; use crate::error::{KrillaError, KrillaResult}; use crate::font::{Font, FontInfo}; #[cfg(feature = "raster-images")] use crate::image::Image; use crate::metadata::Metadata; -use crate::object::color::{CSWrapper, DEVICE_GRAY, DEVICE_RGB}; +use crate::object::color::{DEVICE_GRAY, DEVICE_RGB}; use crate::object::font::cid_font::CIDFont; use crate::object::font::type3_font::Type3FontMapper; -use crate::object::font::FontContainer; +use crate::object::font::{FontContainer, FontIdentifier}; use crate::object::outline::Outline; use crate::object::page::{InternalPage, PageLabelContainer}; -use crate::object::Object; +use crate::object::{ChunkContainerFn, Object, Resourceable}; use crate::page::PageLabel; +use crate::resource; use crate::resource::Resource; use crate::tagging::{AnnotationIdentifier, IdentifierType, PageTagIdentifier, TagTree}; -use crate::util::{NameExt, SipHashable}; +use crate::util::SipHashable; use crate::validation::{ValidationError, Validator}; use crate::version::PdfVersion; #[cfg(feature = "fontdb")] @@ -54,7 +55,8 @@ impl Default for SvgSettings { /// Settings that should be applied when creating a PDF document. #[derive(Clone, Debug)] pub struct SerializeSettings { - /// Whether content streams should be compressed. + /// Whether content streams should be compressed. Leads to significantly smaller file sizes, + /// but also longer running times. It is highly recommended that you set this to true. pub compress_content_streams: bool, /// Whether device-independent colors should be used instead of /// device-dependent ones. @@ -351,15 +353,44 @@ impl SerializerContext { self.cur_ref.bump() } - pub fn add_cs(&mut self, cs: ColorSpace) -> CSWrapper { + pub fn add_cs(&mut self, cs: ColorSpace) -> resource::ColorSpace { + macro_rules! cs { + ($name:ident, $color_name:expr) => { + #[derive(Copy, Clone, Hash)] + struct $name; + + impl Object for $name { + fn chunk_container(&self) -> ChunkContainerFn { + Box::new(|cc| &mut cc.color_spaces) + } + + fn serialize(self, _: &mut SerializerContext, root_ref: Ref) -> Chunk { + let mut chunk = Chunk::new(); + chunk + .indirect(root_ref) + .primitive(Name($color_name.as_bytes())); + chunk + } + } + + impl Resourceable for $name { + type Resource = resource::ColorSpace; + } + }; + } + + cs!(DeviceRgb, DEVICE_RGB); + cs!(DeviceGray, DEVICE_GRAY); + cs!(DeviceCmyk, DEVICE_CMYK); + match cs { - ColorSpace::Srgb => CSWrapper::Ref(self.add_resource(Resource::Srgb)), - ColorSpace::LinearRgb => CSWrapper::Ref(self.add_resource(Resource::LinearRgb)), - ColorSpace::Luma => CSWrapper::Ref(self.add_resource(Resource::Luma)), - ColorSpace::Cmyk(cs) => CSWrapper::Ref(self.add_resource(Resource::Cmyk(cs))), - ColorSpace::DeviceGray => CSWrapper::Name(DEVICE_GRAY.to_pdf_name()), - ColorSpace::DeviceRgb => CSWrapper::Name(DEVICE_RGB.to_pdf_name()), - ColorSpace::DeviceCmyk => CSWrapper::Name(DEVICE_CMYK.to_pdf_name()), + ColorSpace::Srgb => self.add_srgb(), + ColorSpace::LinearRgb => self.add_linearrgb(), + ColorSpace::Luma => self.add_luma(), + ColorSpace::Cmyk(cs) => self.add_resource(cs), + ColorSpace::DeviceGray => self.add_resource(DeviceGray), + ColorSpace::DeviceRgb => self.add_resource(DeviceRgb), + ColorSpace::DeviceCmyk => self.add_resource(DeviceCmyk), } } @@ -380,6 +411,13 @@ impl SerializerContext { } } + pub fn add_resource(&mut self, object: T) -> T::Resource + where + T: Resourceable, + { + Resource::new(self.add_object(object)) + } + #[cfg(feature = "raster-images")] pub fn add_image(&mut self, image: Image) -> Ref { // TODO: Deduplicate @@ -448,34 +486,58 @@ impl SerializerContext { .clone() } - pub(crate) fn add_resource(&mut self, resource: impl Into) -> Ref { - match resource.into() { - Resource::XObject(x) => self.add_object(x), - #[cfg(feature = "raster-images")] - Resource::Image(i) => self.add_image(i), - Resource::ShadingPattern(sp) => self.add_object(sp), - Resource::TilingPattern(tp) => self.add_object(tp), - Resource::ExtGState(e) => self.add_object(e), - Resource::Srgb => self.add_object(ICCBasedColorSpace( - self.serialize_settings.pdf_version.rgb_icc(), - )), - Resource::LinearRgb => self.add_object(LinearRgbColorSpace), - Resource::Luma => self.add_object(ICCBasedColorSpace( - self.serialize_settings.pdf_version.grey_icc(), - )), - Resource::Cmyk(cs) => self.add_object(cs), - Resource::ShadingFunction(s) => self.add_object(s), - Resource::FontIdentifier(f) => { - let hash = f.sip_hash(); - if let Some(_ref) = self.cached_mappings.get(&hash) { - *_ref - } else { - let root_ref = self.new_ref(); - self.cached_mappings.insert(hash, root_ref); - root_ref - } + pub(crate) fn add_srgb(&mut self) -> resource::ColorSpace { + self.add_resource(ICCBasedColorSpace( + self.serialize_settings.pdf_version.rgb_icc(), + )) + } + + pub(crate) fn add_luma(&mut self) -> resource::ColorSpace { + self.add_resource(ICCBasedColorSpace( + self.serialize_settings.pdf_version.grey_icc(), + )) + } + + pub(crate) fn add_font_identifier(&mut self, f: FontIdentifier) -> resource::Font { + let hash = f.sip_hash(); + if let Some(_ref) = self.cached_mappings.get(&hash) { + resource::Font::new(*_ref) + } else { + let root_ref = self.new_ref(); + self.cached_mappings.insert(hash, root_ref); + resource::Font::new(root_ref) + } + } + + pub(crate) fn add_linearrgb(&mut self) -> resource::ColorSpace { + #[derive(Copy, Clone, Hash)] + struct LinearRgbColorSpace; + + impl Object for LinearRgbColorSpace { + fn chunk_container(&self) -> ChunkContainerFn { + Box::new(|cc| &mut cc.color_spaces) + } + + fn serialize(self, _: &mut SerializerContext, root_ref: Ref) -> Chunk { + let mut chunk = Chunk::new(); + chunk.color_space(root_ref).cal_rgb( + [0.9505, 1.0, 1.0888], + None, + Some([1.0, 1.0, 1.0]), + Some([ + 0.4124, 0.2126, 0.0193, 0.3576, 0.715, 0.1192, 0.1805, 0.0722, 0.9505, + ]), + ); + + chunk } } + + impl Resourceable for LinearRgbColorSpace { + type Resource = resource::ColorSpace; + } + + self.add_resource(LinearRgbColorSpace) } #[cfg(feature = "fontdb")] @@ -574,14 +636,14 @@ impl SerializerContext { match &*font_container.borrow() { FontContainer::Type3(font_mapper) => { for t3_font in font_mapper.fonts() { - let ref_ = self.add_resource(t3_font.identifier()); - let chunk = t3_font.serialize(&mut self, ref_); + let f = self.add_font_identifier(t3_font.identifier()); + let chunk = t3_font.serialize(&mut self, f.get_ref()); self.chunk_container.fonts.push(chunk); } } FontContainer::CIDFont(cid_font) => { - let ref_ = self.add_resource(cid_font.identifier()); - let chunk = cid_font.serialize(&mut self, ref_)?; + let f = self.add_font_identifier(cid_font.identifier()); + let chunk = cid_font.serialize(&mut self, f.get_ref())?; self.chunk_container.fonts.push(chunk); } } diff --git a/crates/krilla/src/tests/mod.rs b/crates/krilla/src/tests/mod.rs index 853e1482..e43284fe 100644 --- a/crates/krilla/src/tests/mod.rs +++ b/crates/krilla/src/tests/mod.rs @@ -34,6 +34,10 @@ use tiny_skia_path::{NormalizedF32, Path, PathBuilder, Point, Rect, Transform}; #[rustfmt::skip] mod svg; +// TODO: The reason we store all tests here instead of creating a root `tests` folder is that +// we want to avoid duplicating all of the asset paths for both, crate-internal unit tests and +// external integration tests. Would be nice to figure out a better solution to this. + const REPLACE: Option<&str> = option_env!("REPLACE"); const STORE: Option<&str> = option_env!("STORE"); diff --git a/refs/snapshots/annotation_to_destination.txt b/refs/snapshots/annotation_to_destination.txt index ef66594a..4eb8654b 100644 --- a/refs/snapshots/annotation_to_destination.txt +++ b/refs/snapshots/annotation_to_destination.txt @@ -5,50 +5,57 @@ << /Type /Pages /Count 2 - /Kids [5 0 R 8 0 R] + /Kids [6 0 R 9 0 R] >> endobj 2 0 obj -[8 0 R /XYZ 100 100 0] +/DeviceRGB endobj 3 0 obj -[5 0 R /XYZ 0 200 0] +[9 0 R /XYZ 100 100 0] endobj 4 0 obj +[6 0 R /XYZ 0 200 0] +endobj + +5 0 obj << /Type /Annot /Subtype /Link /Rect [50 100 150 200] /Border [0 0 0] - /Dest 2 0 R + /Dest 3 0 R /F 4 >> endobj -5 0 obj +6 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 2 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 6 0 R - /Annots [4 0 R] + /Contents 7 0 R + /Annots [5 0 R] >> endobj -6 0 obj +7 0 obj << - /Length 83 + /Length 76 >> stream q 1 0 0 -1 0 200 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 50 0 m 150 0 l @@ -60,38 +67,41 @@ Q endstream endobj -7 0 obj +8 0 obj << /Type /Annot /Subtype /Link /Rect [50 0 150 100] /Border [0 0 0] - /Dest 3 0 R + /Dest 4 0 R /F 4 >> endobj -8 0 obj +9 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 2 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 9 0 R - /Annots [7 0 R] + /Contents 10 0 R + /Annots [8 0 R] >> endobj -9 0 obj +10 0 obj << - /Length 87 + /Length 80 >> stream q 1 0 0 -1 0 200 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 50 100 m 150 100 l @@ -103,7 +113,7 @@ Q endstream endobj -10 0 obj +11 0 obj << /Type /Catalog /Pages 1 0 R @@ -111,24 +121,25 @@ endobj endobj xref -0 11 +0 12 0000000000 65535 f 0000000016 00000 n 0000000086 00000 n -0000000125 00000 n -0000000162 00000 n -0000000280 00000 n -0000000457 00000 n -0000000593 00000 n -0000000709 00000 n -0000000886 00000 n -0000001026 00000 n +0000000113 00000 n +0000000152 00000 n +0000000189 00000 n +0000000307 00000 n +0000000526 00000 n +0000000655 00000 n +0000000771 00000 n +0000000991 00000 n +0000001125 00000 n trailer << - /Size 11 - /Root 10 0 R - /ID [(GxfFszxVq8CIM/alIdffdw==) (GxfFszxVq8CIM/alIdffdw==)] + /Size 12 + /Root 11 0 R + /ID [(XSvihdva3/v+uC7BBmroCQ==) (XSvihdva3/v+uC7BBmroCQ==)] >> startxref -1081 +1180 %%EOF \ No newline at end of file diff --git a/refs/snapshots/ext_g_state_all_set.txt b/refs/snapshots/ext_g_state_all_set.txt index db6f2c0b..a5814959 100644 --- a/refs/snapshots/ext_g_state_all_set.txt +++ b/refs/snapshots/ext_g_state_all_set.txt @@ -2,24 +2,28 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /Type /ExtGState /ca 0.4 /CA 0.6 /BM /Difference - /SMask 2 0 R + /SMask 3 0 R >> endobj -2 0 obj +3 0 obj << /Type /Mask /S /Luminosity - /G 3 0 R + /G 4 0 R >> endobj -3 0 obj +4 0 obj << /Length 0 /Type /XObject @@ -31,7 +35,7 @@ endobj /Group << /Type /Group /S /Transparency - /CS /DeviceRGB + /CS 1 0 R >> >> stream diff --git a/refs/snapshots/gradient_single_stop.txt b/refs/snapshots/gradient_single_stop.txt index c6316751..38d4df0d 100644 --- a/refs/snapshots/gradient_single_stop.txt +++ b/refs/snapshots/gradient_single_stop.txt @@ -5,30 +5,37 @@ << /Type /Pages /Count 1 - /Kids [2 0 R] + /Kids [3 0 R] >> endobj 2 0 obj +/DeviceRGB +endobj + +3 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 2 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 3 0 R + /Contents 4 0 R >> endobj -3 0 obj +4 0 obj << - /Length 85 + /Length 78 >> stream q 1 0 0 -1 0 200 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 20 20 m 180 20 l @@ -40,7 +47,7 @@ Q endstream endobj -4 0 obj +5 0 obj << /Type /Catalog /Pages 1 0 R @@ -48,18 +55,19 @@ endobj endobj xref -0 5 +0 6 0000000000 65535 f 0000000016 00000 n 0000000080 00000 n -0000000239 00000 n -0000000377 00000 n +0000000107 00000 n +0000000308 00000 n +0000000439 00000 n trailer << - /Size 5 - /Root 4 0 R - /ID [(VrVJETkpzd0UnUWqLtUAFQ==) (VrVJETkpzd0UnUWqLtUAFQ==)] + /Size 6 + /Root 5 0 R + /ID [(B9bZVJ0fiw3zYbF2BjhjqQ==) (B9bZVJ0fiw3zYbF2BjhjqQ==)] >> startxref -431 +493 %%EOF \ No newline at end of file diff --git a/refs/snapshots/linear_gradient_pad.txt b/refs/snapshots/linear_gradient_pad.txt index d26c17c2..acc40a44 100644 --- a/refs/snapshots/linear_gradient_pad.txt +++ b/refs/snapshots/linear_gradient_pad.txt @@ -2,6 +2,10 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /FunctionType 2 /Range [0 1 0 1 0 1] @@ -12,7 +16,7 @@ >> endobj -2 0 obj +3 0 obj << /FunctionType 2 /Range [0 1 0 1 0 1] @@ -23,7 +27,7 @@ endobj >> endobj -3 0 obj +4 0 obj << /FunctionType 2 /Range [0 1 0 1 0 1] @@ -34,33 +38,33 @@ endobj >> endobj -4 0 obj +5 0 obj << /FunctionType 3 /Domain [0 1] /Range [0 1 0 1 0 1] - /Functions [1 0 R 2 0 R 3 0 R] + /Functions [2 0 R 3 0 R 4 0 R] /Bounds [0.2 0.8] /Encode [0 1 0 1 0 1] >> endobj -5 0 obj +6 0 obj << /ShadingType 2 - /ColorSpace /DeviceRGB + /ColorSpace 1 0 R /AntiAlias false - /Function 4 0 R + /Function 5 0 R /Coords [50 0 150 0] /Extend [true true] >> endobj -6 0 obj +7 0 obj << /Type /Pattern /PatternType 2 - /Shading 5 0 R + /Shading 6 0 R /Matrix [1 0 0 1 0 0] >> endobj diff --git a/refs/snapshots/linear_gradient_repeat.txt b/refs/snapshots/linear_gradient_repeat.txt index 9d3c775b..038a2203 100644 --- a/refs/snapshots/linear_gradient_repeat.txt +++ b/refs/snapshots/linear_gradient_repeat.txt @@ -2,6 +2,10 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /Length 693 /FunctionType 4 @@ -13,22 +17,22 @@ stream endstream endobj -2 0 obj +3 0 obj << /ShadingType 1 - /ColorSpace /DeviceRGB + /ColorSpace 1 0 R /Matrix [1 0 0 1 0 0] /AntiAlias false - /Function 1 0 R + /Function 2 0 R /Domain [50 150 50 150] >> endobj -3 0 obj +4 0 obj << /Type /Pattern /PatternType 2 - /Shading 2 0 R + /Shading 3 0 R /Matrix [1 0 0 1 0 0] >> endobj diff --git a/refs/snapshots/mask_luminosity.txt b/refs/snapshots/mask_luminosity.txt index d411ff2c..c998abb5 100644 --- a/refs/snapshots/mask_luminosity.txt +++ b/refs/snapshots/mask_luminosity.txt @@ -2,42 +2,49 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /Type /ExtGState /ca 0.5 >> endobj -2 0 obj +3 0 obj << /Type /Mask /S /Luminosity - /G 3 0 R + /G 4 0 R >> endobj -3 0 obj +4 0 obj << - /Length 74 + /Length 67 /Type /XObject /Subtype /Form /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 1 0 R + >> /ExtGState << - /g0 1 0 R + /g0 2 0 R >> >> /BBox [20 20 180 180] /Group << /Type /Group /S /Transparency - /CS /DeviceRGB + /CS 1 0 R >> >> stream q /g0 gs -/DeviceRGB cs +/c0 cs 1 0 0 scn 20 20 m 180 20 l diff --git a/refs/snapshots/named_destination_basic.txt b/refs/snapshots/named_destination_basic.txt index 0c6446c3..68b071a4 100644 --- a/refs/snapshots/named_destination_basic.txt +++ b/refs/snapshots/named_destination_basic.txt @@ -5,19 +5,23 @@ << /Type /Pages /Count 2 - /Kids [6 0 R 9 0 R] + /Kids [7 0 R 10 0 R] >> endobj 2 0 obj -[6 0 R /XYZ 100 742 0] +/DeviceRGB endobj 3 0 obj -[9 0 R /XYZ 0 842 0] +[7 0 R /XYZ 100 742 0] endobj 4 0 obj +[10 0 R /XYZ 0 842 0] +endobj + +5 0 obj << /Type /Annot /Subtype /Link @@ -28,7 +32,7 @@ endobj >> endobj -5 0 obj +6 0 obj << /Type /Annot /Subtype /Link @@ -39,27 +43,30 @@ endobj >> endobj -6 0 obj +7 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 2 0 R + >> >> /MediaBox [0 0 595 842] /Parent 1 0 R - /Contents 7 0 R - /Annots [4 0 R 5 0 R] + /Contents 8 0 R + /Annots [5 0 R 6 0 R] >> endobj -7 0 obj +8 0 obj << - /Length 171 + /Length 157 >> stream q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 0 0 m 100 0 l @@ -70,7 +77,7 @@ f Q q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 100 100 m 200 100 l @@ -82,7 +89,7 @@ Q endstream endobj -8 0 obj +9 0 obj << /Type /Annot /Subtype /Link @@ -93,27 +100,30 @@ endobj >> endobj -9 0 obj +10 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 2 0 R + >> >> /MediaBox [0 0 595 842] /Parent 1 0 R - /Contents 10 0 R - /Annots [8 0 R] + /Contents 11 0 R + /Annots [9 0 R] >> endobj -10 0 obj +11 0 obj << - /Length 81 + /Length 74 >> stream q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 0 0 1 scn 0 0 m 100 0 l @@ -125,38 +135,39 @@ Q endstream endobj -11 0 obj +12 0 obj << /Type /Catalog /Pages 1 0 R /Names << /Dests << - /Names [(by) 3 0 R (hi) 2 0 R] + /Names [(by) 4 0 R (hi) 3 0 R] >> >> >> endobj xref -0 12 +0 13 0000000000 65535 f 0000000016 00000 n -0000000086 00000 n -0000000125 00000 n -0000000162 00000 n -0000000278 00000 n -0000000396 00000 n -0000000579 00000 n -0000000804 00000 n -0000000920 00000 n -0000001098 00000 n -0000001233 00000 n +0000000087 00000 n +0000000114 00000 n +0000000153 00000 n +0000000191 00000 n +0000000307 00000 n +0000000425 00000 n +0000000650 00000 n +0000000861 00000 n +0000000977 00000 n +0000001198 00000 n +0000001326 00000 n trailer << - /Size 12 - /Root 11 0 R - /ID [(XMwYmv4g1uU3vzLi5tqy1w==) (XMwYmv4g1uU3vzLi5tqy1w==)] + /Size 13 + /Root 12 0 R + /ID [(wp9HkGWEL00c6aZrjkpxHw==) (wp9HkGWEL00c6aZrjkpxHw==)] >> startxref -1363 +1456 %%EOF \ No newline at end of file diff --git a/refs/snapshots/outline_simple.txt b/refs/snapshots/outline_simple.txt index f4039ada..09bed2fd 100644 --- a/refs/snapshots/outline_simple.txt +++ b/refs/snapshots/outline_simple.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 3 - /Kids [9 0 R 11 0 R 13 0 R] + /Kids [10 0 R 12 0 R 14 0 R] >> endobj @@ -26,7 +26,7 @@ endobj /Last 4 0 R /Count -1 /Title (Heading 1) - /Dest 7 0 R + /Dest 8 0 R >> endobj @@ -34,7 +34,7 @@ endobj << /Parent 3 0 R /Title (Heading 1.1) - /Dest 6 0 R + /Dest 7 0 R >> endobj @@ -43,42 +43,49 @@ endobj /Parent 2 0 R /Prev 3 0 R /Title (Heading 2) - /Dest 8 0 R + /Dest 9 0 R >> endobj 6 0 obj -[11 0 R /XYZ 50 150 0] +/DeviceRGB endobj 7 0 obj -[9 0 R /XYZ 0 200 0] +[12 0 R /XYZ 50 150 0] endobj 8 0 obj -[13 0 R /XYZ 100 100 0] +[10 0 R /XYZ 0 200 0] endobj 9 0 obj +[14 0 R /XYZ 100 100 0] +endobj + +10 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 6 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 10 0 R + /Contents 11 0 R >> endobj -10 0 obj +11 0 obj << - /Length 81 + /Length 74 >> stream q 1 0 0 -1 0 200 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 0 0 m 100 0 l @@ -90,26 +97,29 @@ Q endstream endobj -11 0 obj +12 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 6 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 12 0 R + /Contents 13 0 R >> endobj -12 0 obj +13 0 obj << - /Length 85 + /Length 78 >> stream q 1 0 0 -1 0 200 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 50 50 m 150 50 l @@ -121,26 +131,29 @@ Q endstream endobj -13 0 obj +14 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 6 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 14 0 R + /Contents 15 0 R >> endobj -14 0 obj +15 0 obj << - /Length 89 + /Length 82 >> stream q 1 0 0 -1 0 200 cm -/DeviceRGB cs +/c0 cs 0 0 1 scn 100 100 m 200 100 l @@ -152,7 +165,7 @@ Q endstream endobj -15 0 obj +16 0 obj << /Type /Catalog /Pages 1 0 R @@ -161,29 +174,30 @@ endobj endobj xref -0 16 +0 17 0000000000 65535 f 0000000016 00000 n -0000000094 00000 n -0000000174 00000 n -0000000302 00000 n -0000000377 00000 n -0000000464 00000 n -0000000503 00000 n -0000000540 00000 n -0000000580 00000 n -0000000740 00000 n -0000000875 00000 n -0000001036 00000 n -0000001175 00000 n -0000001336 00000 n -0000001479 00000 n +0000000095 00000 n +0000000175 00000 n +0000000303 00000 n +0000000378 00000 n +0000000465 00000 n +0000000492 00000 n +0000000531 00000 n +0000000569 00000 n +0000000609 00000 n +0000000812 00000 n +0000000940 00000 n +0000001143 00000 n +0000001275 00000 n +0000001478 00000 n +0000001614 00000 n trailer << - /Size 16 - /Root 15 0 R - /ID [(E0IlH4wjSw4HnfonM1kCgg==) (E0IlH4wjSw4HnfonM1kCgg==)] + /Size 17 + /Root 16 0 R + /ID [(KYMU9+U41SFOdRv+A26tgQ==) (KYMU9+U41SFOdRv+A26tgQ==)] >> startxref -1552 +1687 %%EOF \ No newline at end of file diff --git a/refs/snapshots/page_simple.txt b/refs/snapshots/page_simple.txt index 36f6c939..09bd0c44 100644 --- a/refs/snapshots/page_simple.txt +++ b/refs/snapshots/page_simple.txt @@ -5,29 +5,36 @@ << /Type /Pages /Count 1 - /Kids [2 0 R] + /Kids [3 0 R] >> endobj 2 0 obj +/DeviceGray +endobj + +3 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 2 0 R + >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 3 0 R + /Contents 4 0 R >> endobj -3 0 obj +4 0 obj << - /Length 64 + /Length 56 >> stream q -/DeviceGray cs +/c0 cs 0 scn 20 20 m 180 20 l @@ -39,7 +46,7 @@ Q endstream endobj -4 0 obj +5 0 obj << /Type /Catalog /Pages 1 0 R diff --git a/refs/snapshots/pdf_version_14_tagged.txt b/refs/snapshots/pdf_version_14_tagged.txt index c8c6ec10..31730a7c 100644 --- a/refs/snapshots/pdf_version_14_tagged.txt +++ b/refs/snapshots/pdf_version_14_tagged.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [11 0 R] + /Kids [13 0 R] >> endobj @@ -35,7 +35,7 @@ endobj /S /Document /P 2 0 R /K [0] - /Pg 11 0 R + /Pg 13 0 R >> endobj @@ -185,10 +185,22 @@ endstream endobj 11 0 obj +/DeviceGray +endobj + +12 0 obj +/DeviceRGB +endobj + +13 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 11 0 R + /c1 12 0 R + >> /Font << /f0 5 0 R >> @@ -196,13 +208,13 @@ endobj /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 12 0 R + /Contents 14 0 R >> endobj -12 0 obj +14 0 obj << - /Length 411 + /Length 396 >> stream /Span << @@ -212,7 +224,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -227,7 +239,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c1 cs 1 0 0 scn 30 30 m 70 30 l @@ -240,22 +252,22 @@ EMC endstream endobj -13 0 obj +15 0 obj << /Length 791 /Type /Metadata /Subtype /XML >> stream -en1application/pdfV1BT+W5qkxg3OA6MBhgveA==V1BT+W5qkxg3OA6MBhgveA==proof1.4 +en1application/pdfzS+dWmqi8EQ5+4eLdTNBVg==zS+dWmqi8EQ5+4eLdTNBVg==proof1.4 endstream endobj -14 0 obj +16 0 obj << /Type /Catalog /Pages 1 0 R - /Metadata 13 0 R + /Metadata 15 0 R /Lang (en) /StructTreeRoot 2 0 R /MarkInfo << @@ -265,7 +277,7 @@ endobj endobj xref -0 15 +0 17 0000000000 65535 f 0000000016 00000 n 0000000081 00000 n @@ -278,15 +290,17 @@ xref 0000001965 00000 n 0000002047 00000 n 0000004381 00000 n -0000004597 00000 n -0000005063 00000 n -0000005943 00000 n +0000004410 00000 n +0000004438 00000 n +0000004714 00000 n +0000005165 00000 n +0000006045 00000 n trailer << - /Size 15 - /Root 14 0 R - /ID [(V1BT+W5qkxg3OA6MBhgveA==) (V1BT+W5qkxg3OA6MBhgveA==)] + /Size 17 + /Root 16 0 R + /ID [(zS+dWmqi8EQ5+4eLdTNBVg==) (zS+dWmqi8EQ5+4eLdTNBVg==)] >> startxref -6091 +6193 %%EOF \ No newline at end of file diff --git a/refs/snapshots/radial_gradient_pad.txt b/refs/snapshots/radial_gradient_pad.txt index 9b919525..e66d3891 100644 --- a/refs/snapshots/radial_gradient_pad.txt +++ b/refs/snapshots/radial_gradient_pad.txt @@ -2,6 +2,10 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /FunctionType 2 /Range [0 1 0 1 0 1] @@ -12,7 +16,7 @@ >> endobj -2 0 obj +3 0 obj << /FunctionType 2 /Range [0 1 0 1 0 1] @@ -23,7 +27,7 @@ endobj >> endobj -3 0 obj +4 0 obj << /FunctionType 2 /Range [0 1 0 1 0 1] @@ -34,33 +38,33 @@ endobj >> endobj -4 0 obj +5 0 obj << /FunctionType 3 /Domain [0 1] /Range [0 1 0 1 0 1] - /Functions [1 0 R 2 0 R 3 0 R] + /Functions [2 0 R 3 0 R 4 0 R] /Bounds [0.2 0.8] /Encode [0 1 0 1 0 1] >> endobj -5 0 obj +6 0 obj << /ShadingType 3 - /ColorSpace /DeviceRGB + /ColorSpace 1 0 R /AntiAlias false - /Function 4 0 R + /Function 5 0 R /Coords [120 120 50 100 100 50] /Extend [true true] >> endobj -6 0 obj +7 0 obj << /Type /Pattern /PatternType 2 - /Shading 5 0 R + /Shading 6 0 R /Matrix [1 0 0 1 0 0] >> endobj diff --git a/refs/snapshots/stream_complex_text.txt b/refs/snapshots/stream_complex_text.txt index 4cc28ee5..7334d77b 100644 --- a/refs/snapshots/stream_complex_text.txt +++ b/refs/snapshots/stream_complex_text.txt @@ -1,5 +1,5 @@ q -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr diff --git a/refs/snapshots/stream_complex_text_2.txt b/refs/snapshots/stream_complex_text_2.txt index 2aabc237..6df1dfd2 100644 --- a/refs/snapshots/stream_complex_text_2.txt +++ b/refs/snapshots/stream_complex_text_2.txt @@ -1,5 +1,5 @@ q -/DeviceGray cs +/c0 cs 0 scn BT /Span << diff --git a/refs/snapshots/stream_complex_text_3.txt b/refs/snapshots/stream_complex_text_3.txt index 4255c84e..69c38165 100644 --- a/refs/snapshots/stream_complex_text_3.txt +++ b/refs/snapshots/stream_complex_text_3.txt @@ -1,5 +1,5 @@ q -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr diff --git a/refs/snapshots/stream_complex_text_4.txt b/refs/snapshots/stream_complex_text_4.txt index 04c7ed9a..617d7db9 100644 --- a/refs/snapshots/stream_complex_text_4.txt +++ b/refs/snapshots/stream_complex_text_4.txt @@ -1,5 +1,5 @@ q -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr diff --git a/refs/snapshots/stream_fill_text.txt b/refs/snapshots/stream_fill_text.txt index 64d744c6..634d04d0 100644 --- a/refs/snapshots/stream_fill_text.txt +++ b/refs/snapshots/stream_fill_text.txt @@ -1,5 +1,5 @@ q -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr diff --git a/refs/snapshots/stream_nested_transforms.txt b/refs/snapshots/stream_nested_transforms.txt index 1d0ee5b9..786953b1 100644 --- a/refs/snapshots/stream_nested_transforms.txt +++ b/refs/snapshots/stream_nested_transforms.txt @@ -1,6 +1,6 @@ q 1 0 0 1 50 50 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 0 0 m 100 0 l @@ -11,7 +11,7 @@ f Q q 1 0 0 1 150 150 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 0 0 m 100 0 l diff --git a/refs/snapshots/stream_path_single_with_cmyk.txt b/refs/snapshots/stream_path_single_with_cmyk.txt index 0c7937e3..2206fdd7 100644 --- a/refs/snapshots/stream_path_single_with_cmyk.txt +++ b/refs/snapshots/stream_path_single_with_cmyk.txt @@ -1,5 +1,5 @@ q -/DeviceCMYK cs +/c0 cs 0 0.03137255 0.9882353 0.019607844 scn 20 20 m 180 20 l diff --git a/refs/snapshots/stream_path_single_with_luma.txt b/refs/snapshots/stream_path_single_with_luma.txt index a93221fa..20210aff 100644 --- a/refs/snapshots/stream_path_single_with_luma.txt +++ b/refs/snapshots/stream_path_single_with_luma.txt @@ -1,5 +1,5 @@ q -/DeviceGray cs +/c0 cs 0.49803922 scn 20 20 m 180 20 l diff --git a/refs/snapshots/stream_path_single_with_rgb.txt b/refs/snapshots/stream_path_single_with_rgb.txt index 27a4eb4d..8c495803 100644 --- a/refs/snapshots/stream_path_single_with_rgb.txt +++ b/refs/snapshots/stream_path_single_with_rgb.txt @@ -1,5 +1,5 @@ q -/DeviceRGB cs +/c0 cs 1 0 0 scn 20 20 m 180 20 l diff --git a/refs/snapshots/stream_path_single_with_rgb_and_opacity.txt b/refs/snapshots/stream_path_single_with_rgb_and_opacity.txt index 47969bfd..8554a73e 100644 --- a/refs/snapshots/stream_path_single_with_rgb_and_opacity.txt +++ b/refs/snapshots/stream_path_single_with_rgb_and_opacity.txt @@ -1,6 +1,6 @@ q /g0 gs -/DeviceRGB cs +/c0 cs 1 0 0 scn 20 20 m 180 20 l diff --git a/refs/snapshots/stream_reused_graphics_state.txt b/refs/snapshots/stream_reused_graphics_state.txt index 2f6edf40..d76e3bfe 100644 --- a/refs/snapshots/stream_reused_graphics_state.txt +++ b/refs/snapshots/stream_reused_graphics_state.txt @@ -1,6 +1,6 @@ q /g0 gs -/DeviceRGB cs +/c0 cs 0 1 0 scn 0 0 m 100 0 l @@ -11,7 +11,7 @@ f Q q /g1 gs -/DeviceRGB cs +/c0 cs 0 1 0 scn 0 0 m 100 0 l @@ -22,7 +22,7 @@ f Q q /g0 gs -/DeviceRGB cs +/c0 cs 0 1 0 scn 0 0 m 100 0 l diff --git a/refs/snapshots/stream_stroke_text.txt b/refs/snapshots/stream_stroke_text.txt index d4ac0de2..45bc06b8 100644 --- a/refs/snapshots/stream_stroke_text.txt +++ b/refs/snapshots/stream_stroke_text.txt @@ -1,7 +1,7 @@ q -/DeviceGray CS +/c0 CS 0 SCN -/DeviceGray cs +/c0 cs 0 scn BT 1 Tr diff --git a/refs/snapshots/sweep_gradient_pad.txt b/refs/snapshots/sweep_gradient_pad.txt index e8d8d189..db226b44 100644 --- a/refs/snapshots/sweep_gradient_pad.txt +++ b/refs/snapshots/sweep_gradient_pad.txt @@ -2,6 +2,10 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /Length 616 /FunctionType 4 @@ -13,22 +17,22 @@ stream endstream endobj -2 0 obj +3 0 obj << /ShadingType 1 - /ColorSpace /DeviceRGB + /ColorSpace 1 0 R /Matrix [1 0 0 1 0 0] /AntiAlias false - /Function 1 0 R + /Function 2 0 R /Domain [-50 150 -50 150] >> endobj -3 0 obj +4 0 obj << /Type /Pattern /PatternType 2 - /Shading 2 0 R + /Shading 3 0 R /Matrix [1 0 0 1 100 100] >> endobj diff --git a/refs/snapshots/sweep_gradient_repeat.txt b/refs/snapshots/sweep_gradient_repeat.txt index 2db058c8..aaae04eb 100644 --- a/refs/snapshots/sweep_gradient_repeat.txt +++ b/refs/snapshots/sweep_gradient_repeat.txt @@ -2,6 +2,10 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << /Length 745 /FunctionType 4 @@ -13,22 +17,22 @@ stream endstream endobj -2 0 obj +3 0 obj << /ShadingType 1 - /ColorSpace /DeviceRGB + /ColorSpace 1 0 R /Matrix [1 0 0 1 0 0] /AntiAlias false - /Function 1 0 R + /Function 2 0 R /Domain [-50 150 -50 150] >> endobj -3 0 obj +4 0 obj << /Type /Pattern /PatternType 2 - /Shading 2 0 R + /Shading 3 0 R /Matrix [1 0 0 1 100 100] >> endobj diff --git a/refs/snapshots/tagging_disabled.txt b/refs/snapshots/tagging_disabled.txt index c33790cb..eea27abe 100644 --- a/refs/snapshots/tagging_disabled.txt +++ b/refs/snapshots/tagging_disabled.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [8 0 R] + /Kids [9 0 R] >> endobj @@ -146,28 +146,35 @@ endstream endobj 8 0 obj +/DeviceGray +endobj + +9 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 8 0 R + >> /Font << /f0 2 0 R >> >> /MediaBox [0 0 595 842] /Parent 1 0 R - /Contents 9 0 R + /Contents 10 0 R >> endobj -9 0 obj +10 0 obj << - /Length 188 + /Length 180 >> stream q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -179,7 +186,7 @@ Q endstream endobj -10 0 obj +11 0 obj << /Type /Catalog /Pages 1 0 R @@ -187,7 +194,7 @@ endobj endobj xref -0 11 +0 12 0000000000 65535 f 0000000016 00000 n 0000000080 00000 n @@ -197,14 +204,15 @@ xref 0000001563 00000 n 0000001643 00000 n 0000003609 00000 n -0000003804 00000 n -0000004046 00000 n +0000003637 00000 n +0000003875 00000 n +0000004110 00000 n trailer << - /Size 11 - /Root 10 0 R - /ID [(HCug9sya/jo8WREWCtw+1A==) (HCug9sya/jo8WREWCtw+1A==)] + /Size 12 + /Root 11 0 R + /ID [(0qvvIfLwnDoXP87oQIH80A==) (0qvvIfLwnDoXP87oQIH80A==)] >> startxref -4101 +4165 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_disabled_2.txt b/refs/snapshots/tagging_disabled_2.txt index 77a2d7b8..82352074 100644 --- a/refs/snapshots/tagging_disabled_2.txt +++ b/refs/snapshots/tagging_disabled_2.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [9 0 R] + /Kids [10 0 R] >> endobj @@ -146,6 +146,10 @@ endstream endobj 8 0 obj +/DeviceGray +endobj + +9 0 obj << /Type /Annot /Subtype /Link @@ -160,30 +164,33 @@ endobj >> endobj -9 0 obj +10 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 8 0 R + >> /Font << /f0 2 0 R >> >> /MediaBox [0 0 595 842] /Parent 1 0 R - /Contents 10 0 R - /Annots [8 0 R] + /Contents 11 0 R + /Annots [9 0 R] >> endobj -10 0 obj +11 0 obj << - /Length 188 + /Length 180 >> stream q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -195,7 +202,7 @@ Q endstream endobj -11 0 obj +12 0 obj << /Type /Catalog /Pages 1 0 R @@ -203,25 +210,26 @@ endobj endobj xref -0 12 +0 13 0000000000 65535 f 0000000016 00000 n -0000000080 00000 n -0000000241 00000 n -0000000549 00000 n -0000000795 00000 n -0000001563 00000 n -0000001643 00000 n -0000003609 00000 n -0000003782 00000 n -0000003996 00000 n -0000004239 00000 n +0000000081 00000 n +0000000242 00000 n +0000000550 00000 n +0000000796 00000 n +0000001564 00000 n +0000001644 00000 n +0000003610 00000 n +0000003638 00000 n +0000003811 00000 n +0000004068 00000 n +0000004303 00000 n trailer << - /Size 12 - /Root 11 0 R - /ID [(11HXr/uDgnXmBxPUteF2qQ==) (11HXr/uDgnXmBxPUteF2qQ==)] + /Size 13 + /Root 12 0 R + /ID [(X+t12d3FynExonc/XMyrmQ==) (X+t12d3FynExonc/XMyrmQ==)] >> startxref -4294 +4358 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_image_with_alt.txt b/refs/snapshots/tagging_image_with_alt.txt index 8571b536..e2198c92 100644 --- a/refs/snapshots/tagging_image_with_alt.txt +++ b/refs/snapshots/tagging_image_with_alt.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [6 0 R] + /Kids [8 0 R] >> endobj @@ -45,26 +45,38 @@ endobj /P 4 0 R /Alt (This is the alternate text.) /K [0] - /Pg 6 0 R + /Pg 8 0 R >> endobj 6 0 obj +/DeviceRGB +endobj + +7 0 obj +/DeviceGray +endobj + +8 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 6 0 R + /c1 7 0 R + >> >> /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 7 0 R + /Contents 9 0 R >> endobj -7 0 obj +9 0 obj << - /Length 333 + /Length 311 >> stream /P << @@ -80,7 +92,7 @@ W n q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 20 20 m 20 180 l @@ -90,7 +102,7 @@ f Q q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 0 0.5019608 0 scn 20 20 m 180 20 l @@ -101,7 +113,7 @@ f Q q 1 0 0 -1 0 842 cm -/DeviceGray CS +/c1 CS 0 SCN 4 M 1 1 m @@ -116,7 +128,7 @@ EMC endstream endobj -8 0 obj +10 0 obj << /Type /Catalog /Pages 1 0 R @@ -129,7 +141,7 @@ endobj endobj xref -0 9 +0 11 0000000000 65535 f 0000000016 00000 n 0000000080 00000 n @@ -137,14 +149,16 @@ xref 0000000299 00000 n 0000000380 00000 n 0000000504 00000 n -0000000682 00000 n -0000001069 00000 n +0000000531 00000 n +0000000559 00000 n +0000000795 00000 n +0000001160 00000 n trailer << - /Size 9 - /Root 8 0 R - /ID [(FyAfrdfQqaaYkVZfuW1pCA==) (FyAfrdfQqaaYkVZfuW1pCA==)] + /Size 11 + /Root 10 0 R + /ID [(lMn994n26ytorHsKHYfEyQ==) (lMn994n26ytorHsKHYfEyQ==)] >> startxref -1204 +1296 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_multiple_content_tags.txt b/refs/snapshots/tagging_multiple_content_tags.txt index 055eb64c..d63d8a1d 100644 --- a/refs/snapshots/tagging_multiple_content_tags.txt +++ b/refs/snapshots/tagging_multiple_content_tags.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [11 0 R] + /Kids [13 0 R] >> endobj @@ -35,7 +35,7 @@ endobj /S /Document /P 2 0 R /K [0 1 2 3] - /Pg 11 0 R + /Pg 13 0 R >> endobj @@ -203,12 +203,24 @@ endstream endobj 11 0 obj +/DeviceGray +endobj + +12 0 obj +/DeviceRGB +endobj + +13 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 11 0 R + /c1 12 0 R + >> /XObject << - /x0 13 0 R + /x0 15 0 R >> /Font << /f0 5 0 R @@ -217,13 +229,13 @@ endobj /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 12 0 R + /Contents 14 0 R >> endobj -12 0 obj +14 0 obj << - /Length 1294 + /Length 1240 >> stream /Span << @@ -232,7 +244,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -249,7 +261,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -264,7 +276,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn 50 50 m 100 50 l @@ -287,7 +299,7 @@ W n q 1 0 0 -1 100 742 cm -/DeviceRGB cs +/c1 cs 1 0 0 scn 20 20 m 20 180 l @@ -297,7 +309,7 @@ f Q q 1 0 0 -1 100 742 cm -/DeviceRGB cs +/c1 cs 0 0.5019608 0 scn 20 20 m 180 20 l @@ -308,7 +320,7 @@ f Q q 1 0 0 -1 100 742 cm -/DeviceGray CS +/c0 CS 0 SCN 4 M 1 1 m @@ -331,7 +343,7 @@ EMC /Artifact BMC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -344,7 +356,7 @@ EMC endstream endobj -13 0 obj +15 0 obj << /Length 1988 /Type /XObject @@ -388,7 +400,7 @@ E28A2BAEB8E28AAB47C3952449922449922449922449922449922449F7ABBBAEAAAB14 endstream endobj -14 0 obj +16 0 obj << /Type /Catalog /Pages 1 0 R @@ -401,7 +413,7 @@ endobj endobj xref -0 15 +0 17 0000000000 65535 f 0000000016 00000 n 0000000081 00000 n @@ -414,15 +426,17 @@ xref 0000002129 00000 n 0000002213 00000 n 0000005423 00000 n -0000005679 00000 n -0000007029 00000 n -0000009223 00000 n +0000005452 00000 n +0000005480 00000 n +0000005796 00000 n +0000007092 00000 n +0000009286 00000 n trailer << - /Size 15 - /Root 14 0 R - /ID [(4gOWYoLxzjwuGLck2cK1EQ==) (4gOWYoLxzjwuGLck2cK1EQ==)] + /Size 17 + /Root 16 0 R + /ID [(YW6shkLAtD7+JfdCQuOLfg==) (YW6shkLAtD7+JfdCQuOLfg==)] >> startxref -9359 +9422 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_multiple_pages.txt b/refs/snapshots/tagging_multiple_pages.txt index f89e1bf3..f59d3c0e 100644 --- a/refs/snapshots/tagging_multiple_pages.txt +++ b/refs/snapshots/tagging_multiple_pages.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 3 - /Kids [19 0 R 21 0 R 23 0 R] + /Kids [20 0 R 22 0 R 24 0 R] >> endobj @@ -61,7 +61,7 @@ endobj /S /P /P 6 0 R /K [1] - /Pg 23 0 R + /Pg 24 0 R >> endobj @@ -72,7 +72,7 @@ endobj /P 6 0 R /T (second heading) /K [0] - /Pg 23 0 R + /Pg 24 0 R >> endobj @@ -93,9 +93,9 @@ endobj /K [1 << /Type /MCR /MCID 0 - /Pg 21 0 R + /Pg 22 0 R >>] - /Pg 19 0 R + /Pg 20 0 R >> endobj @@ -106,7 +106,7 @@ endobj /P 6 0 R /T (first heading) /K [0] - /Pg 19 0 R + /Pg 20 0 R >> endobj @@ -271,10 +271,17 @@ endstream endobj 19 0 obj +/DeviceGray +endobj + +20 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 19 0 R + >> /Font << /f0 13 0 R >> @@ -282,13 +289,13 @@ endobj /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 20 0 R + /Contents 21 0 R >> endobj -20 0 obj +21 0 obj << - /Length 419 + /Length 403 >> stream /Span << @@ -297,7 +304,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -313,7 +320,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -326,11 +333,14 @@ EMC endstream endobj -21 0 obj +22 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 19 0 R + >> /Font << /f0 13 0 R >> @@ -338,13 +348,13 @@ endobj /MediaBox [0 0 595 842] /StructParents 1 /Parent 1 0 R - /Contents 22 0 R + /Contents 23 0 R >> endobj -22 0 obj +23 0 obj << - /Length 277 + /Length 269 >> stream /Span << @@ -353,7 +363,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -366,11 +376,14 @@ EMC endstream endobj -23 0 obj +24 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 19 0 R + >> /Font << /f0 13 0 R >> @@ -378,13 +391,13 @@ endobj /MediaBox [0 0 595 842] /StructParents 2 /Parent 1 0 R - /Contents 24 0 R + /Contents 25 0 R >> endobj -24 0 obj +25 0 obj << - /Length 513 + /Length 497 >> stream /Span << @@ -393,7 +406,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -409,7 +422,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -422,7 +435,7 @@ EMC endstream endobj -25 0 obj +26 0 obj << /Type /Catalog /Pages 1 0 R @@ -435,7 +448,7 @@ endobj endobj xref -0 26 +0 27 0000000000 65535 f 0000000016 00000 n 0000000095 00000 n @@ -456,18 +469,19 @@ xref 0000002750 00000 n 0000002833 00000 n 0000005922 00000 n -0000006139 00000 n -0000006613 00000 n -0000006830 00000 n -0000007162 00000 n -0000007379 00000 n -0000007947 00000 n +0000005951 00000 n +0000006211 00000 n +0000006669 00000 n +0000006929 00000 n +0000007253 00000 n +0000007513 00000 n +0000008065 00000 n trailer << - /Size 26 - /Root 25 0 R - /ID [(WII2XNL4cHv5NNRmgo3Jqg==) (WII2XNL4cHv5NNRmgo3Jqg==)] + /Size 27 + /Root 26 0 R + /ID [(El7Hi0JyEIR2EpYfDe7Q+A==) (El7Hi0JyEIR2EpYfDe7Q+A==)] >> startxref -8083 +8201 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_simple.txt b/refs/snapshots/tagging_simple.txt index 9ce28ccc..df315593 100644 --- a/refs/snapshots/tagging_simple.txt +++ b/refs/snapshots/tagging_simple.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [12 0 R] + /Kids [13 0 R] >> endobj @@ -44,7 +44,7 @@ endobj /S /P /P 4 0 R /K [0] - /Pg 12 0 R + /Pg 13 0 R >> endobj @@ -185,10 +185,17 @@ endstream endobj 12 0 obj +/DeviceGray +endobj + +13 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 12 0 R + >> /Font << /f0 6 0 R >> @@ -196,13 +203,13 @@ endobj /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 13 0 R + /Contents 14 0 R >> endobj -13 0 obj +14 0 obj << - /Length 296 + /Length 288 >> stream /Span << @@ -214,7 +221,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -227,7 +234,7 @@ EMC endstream endobj -14 0 obj +15 0 obj << /Type /Catalog /Pages 1 0 R @@ -240,7 +247,7 @@ endobj endobj xref -0 15 +0 16 0000000000 65535 f 0000000016 00000 n 0000000081 00000 n @@ -254,14 +261,15 @@ xref 0000001949 00000 n 0000002030 00000 n 0000003997 00000 n -0000004213 00000 n -0000004564 00000 n +0000004026 00000 n +0000004285 00000 n +0000004628 00000 n trailer << - /Size 15 - /Root 14 0 R - /ID [(vELN1WiNQmLN9nRgBcbx3A==) (vELN1WiNQmLN9nRgBcbx3A==)] + /Size 16 + /Root 15 0 R + /ID [(MG+3Sd4HXCh+ATFUoKChZw==) (MG+3Sd4HXCh+ATFUoKChZw==)] >> startxref -4700 +4764 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_simple_with_link.txt b/refs/snapshots/tagging_simple_with_link.txt index 0385d192..ade49f6d 100644 --- a/refs/snapshots/tagging_simple_with_link.txt +++ b/refs/snapshots/tagging_simple_with_link.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [14 0 R] + /Kids [15 0 R] >> endobj @@ -19,7 +19,7 @@ endobj >> /K [4 0 R] /ParentTree << - /Nums [0 13 0 R 0 3 0 R] + /Nums [0 14 0 R 0 3 0 R] >> /ParentTreeNextKey 2 >> @@ -54,10 +54,10 @@ endobj /P 4 0 R /K [<< /Type /OBJR - /Pg 14 0 R - /Obj 13 0 R + /Pg 15 0 R + /Obj 14 0 R >> 0] - /Pg 14 0 R + /Pg 15 0 R >> endobj @@ -198,6 +198,10 @@ endstream endobj 13 0 obj +/DeviceGray +endobj + +14 0 obj << /Type /Annot /Subtype /Link @@ -213,11 +217,14 @@ endobj >> endobj -14 0 obj +15 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 13 0 R + >> /Font << /f0 7 0 R >> @@ -226,14 +233,14 @@ endobj /StructParents 1 /Tabs /S /Parent 1 0 R - /Contents 15 0 R - /Annots [13 0 R] + /Contents 16 0 R + /Annots [14 0 R] >> endobj -15 0 obj +16 0 obj << - /Length 229 + /Length 221 >> stream /Span << @@ -242,7 +249,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -255,7 +262,7 @@ EMC endstream endobj -16 0 obj +17 0 obj << /Type /Catalog /Pages 1 0 R @@ -268,7 +275,7 @@ endobj endobj xref -0 17 +0 18 0000000000 65535 f 0000000016 00000 n 0000000081 00000 n @@ -283,15 +290,16 @@ xref 0000002092 00000 n 0000002173 00000 n 0000004140 00000 n -0000004332 00000 n -0000004578 00000 n -0000004862 00000 n +0000004169 00000 n +0000004361 00000 n +0000004650 00000 n +0000004926 00000 n trailer << - /Size 17 - /Root 16 0 R - /ID [(u3Pk7zhTy7gIyoyI7M2edA==) (u3Pk7zhTy7gIyoyI7M2edA==)] + /Size 18 + /Root 17 0 R + /ID [(DHRdG3SxYtxW+cLSvt2PiQ==) (DHRdG3SxYtxW+cLSvt2PiQ==)] >> startxref -4998 +5062 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tagging_two_footnotes.txt b/refs/snapshots/tagging_two_footnotes.txt index 1a7eb39b..fa0586ed 100644 --- a/refs/snapshots/tagging_two_footnotes.txt +++ b/refs/snapshots/tagging_two_footnotes.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [7 0 R] + /Kids [8 0 R] >> endobj @@ -48,7 +48,7 @@ endobj /P 4 0 R /ID (Note 2) /K [1] - /Pg 7 0 R + /Pg 8 0 R >> endobj @@ -59,26 +59,33 @@ endobj /P 4 0 R /ID (Note 1) /K [0] - /Pg 7 0 R + /Pg 8 0 R >> endobj 7 0 obj +/DeviceRGB +endobj + +8 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 7 0 R + >> >> /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 8 0 R + /Contents 9 0 R >> endobj -8 0 obj +9 0 obj << - /Length 229 + /Length 215 >> stream /P << @@ -86,7 +93,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 50 50 m 100 50 l @@ -101,7 +108,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 100 100 m 150 100 l @@ -114,7 +121,7 @@ EMC endstream endobj -9 0 obj +10 0 obj << /Type /Catalog /Pages 1 0 R @@ -127,7 +134,7 @@ endobj endobj xref -0 10 +0 11 0000000000 65535 f 0000000016 00000 n 0000000080 00000 n @@ -136,14 +143,15 @@ xref 0000000453 00000 n 0000000553 00000 n 0000000653 00000 n -0000000831 00000 n -0000001114 00000 n +0000000680 00000 n +0000000900 00000 n +0000001169 00000 n trailer << - /Size 10 - /Root 9 0 R - /ID [(c3ryVfoEpR5xUIu0yZJ34A==) (c3ryVfoEpR5xUIu0yZJ34A==)] + /Size 11 + /Root 10 0 R + /ID [(a4bQqYcKxGVSttOv/jxsTw==) (a4bQqYcKxGVSttOv/jxsTw==)] >> startxref -1249 +1305 %%EOF \ No newline at end of file diff --git a/refs/snapshots/tiling_pattern_basic.txt b/refs/snapshots/tiling_pattern_basic.txt index c7d0193e..95417285 100644 --- a/refs/snapshots/tiling_pattern_basic.txt +++ b/refs/snapshots/tiling_pattern_basic.txt @@ -2,12 +2,19 @@ %AAAA 1 0 obj +/DeviceRGB +endobj + +2 0 obj << - /Length 136 + /Length 122 /Type /Pattern /PatternType 1 /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 1 0 R + >> >> /TilingType 1 /PaintType 1 @@ -18,7 +25,7 @@ >> stream q -/DeviceRGB cs +/c0 cs 1 0 0 scn 0 0 m 10 0 l @@ -29,7 +36,7 @@ f Q q 1 0 0 1 10 10 cm -/DeviceRGB cs +/c0 cs 0 1 0 scn 0 0 m 10 0 l diff --git a/refs/snapshots/type3_color_glyphs.txt b/refs/snapshots/type3_color_glyphs.txt index da9bc5fb..81e34f54 100644 --- a/refs/snapshots/type3_color_glyphs.txt +++ b/refs/snapshots/type3_color_glyphs.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [9 0 R] + /Kids [11 0 R] >> endobj @@ -51,8 +51,8 @@ endobj /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] /XObject << - /x0 7 0 R - /x1 8 0 R + /x0 9 0 R + /x1 10 0 R >> >> /Name /TwitterColorEmojiSVGinOT @@ -117,19 +117,31 @@ endstream endobj 7 0 obj +/DeviceGray +endobj + +8 0 obj +/DeviceRGB +endobj + +9 0 obj << - /Length 1163 + /Length 1127 /Type /XObject /Subtype /Form /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 8 0 R + /c1 7 0 R + >> >> /BBox [-0.00000000000020210994 -402.84998 2048 1645.15] >> stream q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 1 0.8 0.3019608 scn 36 18 m 36 27.941126 27.941126 36 18 36 c @@ -141,7 +153,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 18 21 m 14.377 21 11.973 20.578 9 20 c @@ -155,7 +167,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceGray cs +/c1 cs 1 scn 9 22 m 9 22 12 23 18 23 c @@ -167,7 +179,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 14.5 13.5 m 14.5 15.432997 13.380712 17 12 17 c @@ -179,7 +191,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 26.5 13.5 m 26.5 15.432997 25.380713 17 24 17 c @@ -192,20 +204,24 @@ Q endstream endobj -8 0 obj +10 0 obj << - /Length 1033 + /Length 997 /Type /XObject /Subtype /Form /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 8 0 R + /c1 7 0 R + >> >> /BBox [0 -402.84998 2048 1645.15] >> stream q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 1 0.8 0.3019608 scn 36 18 m 36 27.941 27.941 36 18 36 c @@ -216,7 +232,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 14 12.5 m 14 15.537566 12.880712 18 11.5 18 c @@ -228,7 +244,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 27 12.5 m 27 15.537566 25.880713 18 24.5 18 c @@ -240,7 +256,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 18 22 m 14.377 22 11.973 21.578 9 21 c @@ -254,7 +270,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceGray cs +/c1 cs 1 scn 9 23 m 9 23 12 24 18 24 c @@ -267,29 +283,32 @@ Q endstream endobj -9 0 obj +11 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 7 0 R + >> /Font << /f0 5 0 R >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 10 0 R + /Contents 12 0 R >> endobj -10 0 obj +12 0 obj << - /Length 96 + /Length 88 >> stream q 1 0 0 -1 0 200 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -301,7 +320,7 @@ Q endstream endobj -11 0 obj +13 0 obj << /Type /Catalog /Pages 1 0 R @@ -309,25 +328,27 @@ endobj endobj xref -0 12 +0 14 0000000000 65535 f 0000000016 00000 n -0000000080 00000 n -0000000149 00000 n -0000000218 00000 n -0000000519 00000 n -0000001051 00000 n -0000001763 00000 n -0000003136 00000 n -0000004357 00000 n -0000004553 00000 n -0000004703 00000 n +0000000081 00000 n +0000000150 00000 n +0000000219 00000 n +0000000520 00000 n +0000001053 00000 n +0000001765 00000 n +0000001793 00000 n +0000001820 00000 n +0000003215 00000 n +0000004458 00000 n +0000004697 00000 n +0000004839 00000 n trailer << - /Size 12 - /Root 11 0 R - /ID [(E2nN74WpU9qA6OyYt9LPUw==) (E2nN74WpU9qA6OyYt9LPUw==)] + /Size 14 + /Root 13 0 R + /ID [(lirDZpmkPUDItoZ/p/3TQw==) (lirDZpmkPUDItoZ/p/3TQw==)] >> startxref -4758 +4894 %%EOF \ No newline at end of file diff --git a/refs/snapshots/type3_pdf_14.txt b/refs/snapshots/type3_pdf_14.txt index 1d81b9a7..fffe7f57 100644 --- a/refs/snapshots/type3_pdf_14.txt +++ b/refs/snapshots/type3_pdf_14.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [6 0 R] + /Kids [8 0 R] >> endobj @@ -26,7 +26,7 @@ endobj /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] /XObject << - /x0 5 0 R + /x0 7 0 R >> >> /Name /TwitterColorEmojiSVGinOT @@ -88,19 +88,31 @@ endstream endobj 5 0 obj +/DeviceGray +endobj + +6 0 obj +/DeviceRGB +endobj + +7 0 obj << - /Length 1163 + /Length 1127 /Type /XObject /Subtype /Form /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 6 0 R + /c1 5 0 R + >> >> /BBox [-0.00000000000020210994 -402.84998 2048 1645.15] >> stream q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 1 0.8 0.3019608 scn 36 18 m 36 27.941126 27.941126 36 18 36 c @@ -112,7 +124,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 18 21 m 14.377 21 11.973 20.578 9 20 c @@ -126,7 +138,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceGray cs +/c1 cs 1 scn 9 22 m 9 22 12 23 18 23 c @@ -138,7 +150,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 14.5 13.5 m 14.5 15.432997 13.380712 17 12 17 c @@ -150,7 +162,7 @@ f Q q 56.88889 0 0 -56.88889 0 1645.15 cm -/DeviceRGB cs +/c0 cs 0.4 0.27058825 0 scn 26.5 13.5 m 26.5 15.432997 25.380713 17 24 17 c @@ -163,29 +175,32 @@ Q endstream endobj -6 0 obj +8 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 5 0 R + >> /Font << /f0 3 0 R >> >> /MediaBox [0 0 200 200] /Parent 1 0 R - /Contents 7 0 R + /Contents 9 0 R >> endobj -7 0 obj +9 0 obj << - /Length 92 + /Length 84 >> stream q 1 0 0 -1 0 200 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -197,7 +212,7 @@ Q endstream endobj -8 0 obj +10 0 obj << /Type /Catalog /Pages 1 0 R @@ -205,22 +220,24 @@ endobj endobj xref -0 9 +0 11 0000000000 65535 f 0000000016 00000 n 0000000080 00000 n 0000000149 00000 n 0000000618 00000 n 0000001314 00000 n -0000002687 00000 n -0000002882 00000 n -0000003027 00000 n +0000001342 00000 n +0000001369 00000 n +0000002764 00000 n +0000003001 00000 n +0000003138 00000 n trailer << - /Size 9 - /Root 8 0 R - /ID [(8qQm+RdyyDeLlhqJEz04RQ==) (8qQm+RdyyDeLlhqJEz04RQ==)] + /Size 11 + /Root 10 0 R + /ID [(jSY3WyMRyrB/sG2S2wLiNw==) (jSY3WyMRyrB/sG2S2wLiNw==)] >> startxref -3081 +3193 %%EOF \ No newline at end of file diff --git a/refs/snapshots/validation_pdfua1_attributes.txt b/refs/snapshots/validation_pdfua1_attributes.txt index fa4a750d..08032f55 100644 --- a/refs/snapshots/validation_pdfua1_attributes.txt +++ b/refs/snapshots/validation_pdfua1_attributes.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [8 0 R] + /Kids [9 0 R] >> endobj @@ -54,7 +54,7 @@ endobj /Scope /Row >>] /K [1] - /Pg 8 0 R + /Pg 9 0 R >> endobj @@ -68,26 +68,33 @@ endobj /ListNumbering /Circle >>] /K [0] - /Pg 8 0 R + /Pg 9 0 R >> endobj 8 0 obj +/DeviceRGB +endobj + +9 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 8 0 R + >> >> /MediaBox [0 0 595 842] /StructParents 0 /Parent 1 0 R - /Contents 9 0 R + /Contents 10 0 R >> endobj -9 0 obj +10 0 obj << - /Length 231 + /Length 217 >> stream /Span << @@ -96,7 +103,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 0 0 m 100 0 l @@ -111,7 +118,7 @@ EMC >> BDC q 1 0 0 -1 0 842 cm -/DeviceRGB cs +/c0 cs 1 0 0 scn 0 0 m 100 0 l @@ -124,28 +131,28 @@ EMC endstream endobj -10 0 obj +11 0 obj << /Title (a nice title) >> endobj -11 0 obj +12 0 obj << /Length 961 /Type /Metadata /Subtype /XML >> stream -a nice titleen11application/pdfegJ/RmRPk0N5JZsYS4oThw==egJ/RmRPk0N5JZsYS4oThw==proof1.7 +a nice titleen11application/pdfWgFNIX7nQEcqb57jCsRysw==WgFNIX7nQEcqb57jCsRysw==proof1.7 endstream endobj -12 0 obj +13 0 obj << /Type /Catalog /Pages 1 0 R - /Metadata 11 0 R + /Metadata 12 0 R /Lang (en) /StructTreeRoot 3 0 R /MarkInfo << @@ -160,7 +167,7 @@ endobj endobj xref -0 13 +0 14 0000000000 65535 f 0000000016 00000 n 0000000080 00000 n @@ -170,17 +177,18 @@ xref 0000000432 00000 n 0000000560 00000 n 0000000697 00000 n -0000000875 00000 n -0000001160 00000 n -0000001207 00000 n -0000002257 00000 n +0000000724 00000 n +0000000945 00000 n +0000001217 00000 n +0000001264 00000 n +0000002314 00000 n trailer << - /Size 13 - /Root 12 0 R - /Info 10 0 R - /ID [(egJ/RmRPk0N5JZsYS4oThw==) (egJ/RmRPk0N5JZsYS4oThw==)] + /Size 14 + /Root 13 0 R + /Info 11 0 R + /ID [(WgFNIX7nQEcqb57jCsRysw==) (WgFNIX7nQEcqb57jCsRysw==)] >> startxref -2498 +2555 %%EOF \ No newline at end of file diff --git a/refs/snapshots/validation_pdfua1_full_example.txt b/refs/snapshots/validation_pdfua1_full_example.txt index 59cf7f07..5a630cce 100644 --- a/refs/snapshots/validation_pdfua1_full_example.txt +++ b/refs/snapshots/validation_pdfua1_full_example.txt @@ -5,7 +5,7 @@ << /Type /Pages /Count 1 - /Kids [13 0 R] + /Kids [14 0 R] >> endobj @@ -25,7 +25,7 @@ endobj >> /K [5 0 R] /ParentTree << - /Nums [0 12 0 R 0 4 0 R] + /Nums [0 13 0 R 0 4 0 R] >> /ParentTreeNextKey 2 >> @@ -42,10 +42,10 @@ endobj /P 3 0 R /K [0 << /Type /OBJR - /Pg 13 0 R - /Obj 12 0 R + /Pg 14 0 R + /Obj 13 0 R >>] - /Pg 13 0 R + /Pg 14 0 R >> endobj @@ -195,6 +195,10 @@ endstream endobj 12 0 obj +/DeviceGray +endobj + +13 0 obj << /Type /Annot /Subtype /Link @@ -211,11 +215,14 @@ endobj >> endobj -13 0 obj +14 0 obj << /Type /Page /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 12 0 R + >> /Font << /f0 6 0 R >> @@ -224,14 +231,14 @@ endobj /StructParents 1 /Tabs /S /Parent 1 0 R - /Contents 14 0 R - /Annots [12 0 R] + /Contents 15 0 R + /Annots [13 0 R] >> endobj -14 0 obj +15 0 obj << - /Length 269 + /Length 261 >> stream /Span << @@ -240,7 +247,7 @@ stream >> BDC q 1 0 0 -1 0 842 cm -/DeviceGray cs +/c0 cs 0 scn BT 0 Tr @@ -253,28 +260,28 @@ EMC endstream endobj -15 0 obj +16 0 obj << /Title (a nice title) >> endobj -16 0 obj +17 0 obj << /Length 961 /Type /Metadata /Subtype /XML >> stream -a nice titleen11application/pdfe9NPegbsK8mi8UAFcFAcoA==e9NPegbsK8mi8UAFcFAcoA==proof1.7 +a nice titleen11application/pdfGF5NQVw9f7020LFzNb5IGQ==GF5NQVw9f7020LFzNb5IGQ==proof1.7 endstream endobj -17 0 obj +18 0 obj << /Type /Catalog /Pages 1 0 R - /Metadata 16 0 R + /Metadata 17 0 R /Lang (en) /StructTreeRoot 3 0 R /MarkInfo << @@ -289,7 +296,7 @@ endobj endobj xref -0 18 +0 19 0000000000 65535 f 0000000016 00000 n 0000000081 00000 n @@ -303,18 +310,19 @@ xref 0000002070 00000 n 0000002153 00000 n 0000004487 00000 n -0000004720 00000 n -0000004966 00000 n -0000005290 00000 n -0000005337 00000 n -0000006387 00000 n +0000004516 00000 n +0000004749 00000 n +0000005038 00000 n +0000005354 00000 n +0000005401 00000 n +0000006451 00000 n trailer << - /Size 18 - /Root 17 0 R - /Info 15 0 R - /ID [(e9NPegbsK8mi8UAFcFAcoA==) (e9NPegbsK8mi8UAFcFAcoA==)] + /Size 19 + /Root 18 0 R + /Info 16 0 R + /ID [(GF5NQVw9f7020LFzNb5IGQ==) (GF5NQVw9f7020LFzNb5IGQ==)] >> startxref -6628 +6692 %%EOF \ No newline at end of file diff --git a/refs/snapshots/x_object_with_transparency.txt b/refs/snapshots/x_object_with_transparency.txt index 735fc1c9..deefd0f9 100644 --- a/refs/snapshots/x_object_with_transparency.txt +++ b/refs/snapshots/x_object_with_transparency.txt @@ -2,24 +2,35 @@ %AAAA 1 0 obj +/DeviceGray +endobj + +2 0 obj +/DeviceRGB +endobj + +3 0 obj << - /Length 64 + /Length 56 /Type /XObject /Subtype /Form /Resources << /ProcSet [/PDF /Text /ImageC /ImageB] + /ColorSpace << + /c0 1 0 R + >> >> /BBox [20 20 180 180] /Group << /Type /Group /S /Transparency /I true - /CS /DeviceRGB + /CS 2 0 R >> >> stream q -/DeviceGray cs +/c0 cs 0 scn 20 20 m 180 20 l diff --git a/refs/visreg/image_rgb8_jpg_mupdf.png b/refs/visreg/image_rgb8_jpg_mupdf.png index 2c904262..bfa8305c 100644 Binary files a/refs/visreg/image_rgb8_jpg_mupdf.png and b/refs/visreg/image_rgb8_jpg_mupdf.png differ diff --git a/refs/visreg/mask_alpha_mupdf.png b/refs/visreg/mask_alpha_mupdf.png index c2d1bdf3..b5efc89f 100644 Binary files a/refs/visreg/mask_alpha_mupdf.png and b/refs/visreg/mask_alpha_mupdf.png differ diff --git a/refs/visreg/mask_luminosity_mupdf.png b/refs/visreg/mask_luminosity_mupdf.png index ef233851..3d5e0c85 100644 Binary files a/refs/visreg/mask_luminosity_mupdf.png and b/refs/visreg/mask_luminosity_mupdf.png differ diff --git a/refs/visreg/svg/resvg_masking_mask_simple_case_mupdf.png b/refs/visreg/svg/resvg_masking_mask_simple_case_mupdf.png index 956ee288..1ae5a3b5 100644 Binary files a/refs/visreg/svg/resvg_masking_mask_simple_case_mupdf.png and b/refs/visreg/svg/resvg_masking_mask_simple_case_mupdf.png differ diff --git a/refs/visreg/svg/resvg_paint_servers_pattern_pattern_on_child_mupdf.png b/refs/visreg/svg/resvg_paint_servers_pattern_pattern_on_child_mupdf.png index 471ff41e..574bf7fa 100644 Binary files a/refs/visreg/svg/resvg_paint_servers_pattern_pattern_on_child_mupdf.png and b/refs/visreg/svg/resvg_paint_servers_pattern_pattern_on_child_mupdf.png differ diff --git a/refs/visreg/svg/resvg_text_textPath_closed_path_mupdf.png b/refs/visreg/svg/resvg_text_textPath_closed_path_mupdf.png index 4c1598ed..20c3eec5 100644 Binary files a/refs/visreg/svg/resvg_text_textPath_closed_path_mupdf.png and b/refs/visreg/svg/resvg_text_textPath_closed_path_mupdf.png differ diff --git a/refs/visreg/twitter_color_emoji_mupdf.png b/refs/visreg/twitter_color_emoji_mupdf.png index 458d67e4..8812a1e5 100644 Binary files a/refs/visreg/twitter_color_emoji_mupdf.png and b/refs/visreg/twitter_color_emoji_mupdf.png differ