mirror of
https://github.com/johnwhitington/cpdf-source.git
synced 2025-06-05 22:09:39 +02:00
PDF/UA preservation for more operations
This commit is contained in:
3
Changes
3
Changes
@@ -10,6 +10,9 @@ can follow a chain from each found dictionary entry
|
||||
* More of the PDF/UA Matterhorn verification suite implemented
|
||||
* Font lister now returns the font itself
|
||||
o Allow %objnum in output name for -extract-images
|
||||
* -show-boxes, -trim-marks, -table-of-contents, -add-text
|
||||
-add-rectangle, -impose, -twoup, -twoup-stack now preserve
|
||||
PDF/UA compatibility
|
||||
|
||||
Fixes:
|
||||
|
||||
|
@@ -63,7 +63,8 @@ let ops font fontpack fontpackpdfobjs fontname longest_w x y rotate hoffset voff
|
||||
| Some font -> [Pdfops.Op_Tf (unique_fontname, fontsize); Pdfops.Op_Tj (charcodes_of_utf8 font text)]
|
||||
| None -> [Pdfops.Op_Tf (unique_fontname, fontsize); Pdfops.Op_Tj text]
|
||||
in
|
||||
[Pdfops.Op_q;
|
||||
[Pdfops.begin_artifact;
|
||||
Pdfops.Op_q;
|
||||
Pdfops.Op_BMC "/CPDFSTAMP";
|
||||
Pdfops.Op_cm
|
||||
(Pdftransform.matrix_of_transform
|
||||
@@ -74,7 +75,7 @@ let ops font fontpack fontpackpdfobjs fontname longest_w x y rotate hoffset voff
|
||||
@ [colour_op colour; colour_op_stroke colour]
|
||||
@ (match unique_extgstatename with None -> [] | Some n -> [Pdfops.Op_gs n])
|
||||
@ textops
|
||||
@ [Pdfops.Op_ET; Pdfops.Op_EMC; Pdfops.Op_Q]
|
||||
@ [Pdfops.Op_ET; Pdfops.Op_EMC; Pdfops.Op_Q; Pdfops.end_artifact]
|
||||
|
||||
type justification = LeftJustify | CentreJustify | RightJustify
|
||||
|
||||
@@ -616,6 +617,7 @@ let addrectangle
|
||||
| _ -> (x, y)
|
||||
in
|
||||
let ops =
|
||||
Pdfops.begin_artifact::
|
||||
[
|
||||
Pdfops.Op_q;
|
||||
Pdfops.Op_BMC "/CPDFSTAMP";
|
||||
@@ -633,6 +635,7 @@ let addrectangle
|
||||
Pdfops.Op_EMC;
|
||||
Pdfops.Op_Q
|
||||
]
|
||||
@ [Pdfops.end_artifact]
|
||||
in
|
||||
let page = {page with Pdfpage.resources = resources'} in
|
||||
if underneath
|
||||
|
@@ -963,11 +963,13 @@ let show_boxes_page fast pdf _ page =
|
||||
| None -> []
|
||||
in
|
||||
let ops =
|
||||
make_ops (255., 0., 0.) 0. 0. "/MediaBox"
|
||||
[Pdfops.begin_artifact]
|
||||
@ make_ops (255., 0., 0.) 0. 0. "/MediaBox"
|
||||
@ make_ops (0., 255., 0.) 7. 7. "/CropBox"
|
||||
@ make_ops (0., 0., 255.) 5. 5. "/ArtBox"
|
||||
@ make_ops (255.,150.,0.) 3. 3. "/TrimBox"
|
||||
@ make_ops (255.,9.,147.) 2. 2. "/BleedBox"
|
||||
@ [Pdfops.end_artifact]
|
||||
in
|
||||
Pdfpage.postpend_operators pdf ops ~fast page
|
||||
|
||||
@@ -988,6 +990,7 @@ let trim_marks_page fast pdf n page =
|
||||
[Pdfops.Op_q;
|
||||
Pdfops.Op_K (1., 1., 1., 1.);
|
||||
Pdfops.Op_w 1.]
|
||||
@ [Pdfops.begin_artifact]
|
||||
@ line (minx, tmaxy, tminy -. allowance, tmaxy) (* top left *)
|
||||
@ line (tminx, tmaxy +. allowance, tminx, maxy)
|
||||
@ line (tmaxx +. allowance, tmaxy, maxx, tmaxy) (* top right *)
|
||||
@@ -996,6 +999,7 @@ let trim_marks_page fast pdf n page =
|
||||
@ line (tmaxx, tminy -. allowance, tmaxx, miny)
|
||||
@ line (tminx -. allowance, tminy, minx, tminy) (* bottom left *)
|
||||
@ line (tminx, tminy -. allowance, tminx, miny)
|
||||
@ [Pdfops.end_artifact]
|
||||
@ [Pdfops.Op_Q]
|
||||
in
|
||||
Pdfpage.postpend_operators pdf ops ~fast page
|
||||
|
Reference in New Issue
Block a user