summaryrefslogtreecommitdiff
path: root/devices
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2022-12-22 16:07:16 +0000
committerKen Sharp <ken.sharp@artifex.com>2022-12-22 16:07:16 +0000
commitaeabce88c19083d81ee1ced14577fbfd9cf4b9de (patch)
tree32f95c3122b7fd6aacbcfa436ec104447b62e452 /devices
parentb394aae7794383bf5a825615c3f75ddc6b1d3e09 (diff)
downloadghostpdl-aeabce88c19083d81ee1ced14577fbfd9cf4b9de.tar.gz
GhostPDF - control emission of Boxes from the pdfwrite device
Bug #706128 "Scaling, translating, and writing text does not work properly with the new PDF Interpreter" In fact all of these functions do work. The problem (or at least, the problem I see) is that the original PDF file has a /CropBox entry for the page, and this is automatically sent (via pdfmark) from the interpreter to the pdfwrite device. The result of this is that (when viewed using a consumer such as Adobe Acrobat) the CropBox is used as a clip, and so the modified content disappears outside the clip. So, we need to be able to not send the various Box parameters to pdfwrite. In fact, we already have a means to do that, and for exactly the same reason, the Nup device needs to preven the CropBox being sent for the pages too. This is done by a device parameter 'ModifiesPageSize, which, along with ModifiesPageOrder is always set for the Nup device to prevent Box values, Outlines and Dests being sent. This commit adds those parameters to the pdfwrite device; by default they are false so that all the various pdfmarks are sent. A user can either set them with -d on the command line or via setpagedevice in PostScript. When set ModifiesPageSize stops the interpreter passing along the Box values, and ModifiesPageorder stops it passing along Dests and Outlines. Also fixed a typo in a comment, noticed in passing.
Diffstat (limited to 'devices')
-rw-r--r--devices/vector/gdevpdfb.h4
-rw-r--r--devices/vector/gdevpdfp.c2
-rw-r--r--devices/vector/gdevpdfx.h4
3 files changed, 8 insertions, 2 deletions
diff --git a/devices/vector/gdevpdfb.h b/devices/vector/gdevpdfb.h
index b6439f538..75ade7707 100644
--- a/devices/vector/gdevpdfb.h
+++ b/devices/vector/gdevpdfb.h
@@ -240,7 +240,9 @@ const gx_device_pdf PDF_DEVICE_IDENT =
0, /* initial_pattern_state */
false, /* OmitInfoDate */
false, /* OmitXMP */
- false /* OmitID */
+ false, /* OmitID */
+ false, /* ModifiesPageSize */
+ false /* ModifiesPageOrder */
};
#else
diff --git a/devices/vector/gdevpdfp.c b/devices/vector/gdevpdfp.c
index 690a9e133..c08f7baef 100644
--- a/devices/vector/gdevpdfp.c
+++ b/devices/vector/gdevpdfp.c
@@ -132,6 +132,8 @@ static const gs_param_item_t pdf_param_items[] = {
pi("OmitInfoDate", gs_param_type_bool, OmitInfoDate),
pi("OmitID", gs_param_type_bool, OmitID),
pi("OmitXMP", gs_param_type_bool, OmitXMP),
+ pi("ModifiesPageSize", gs_param_type_bool, ModifiesPageSize),
+ pi("ModifiesPageOrder", gs_param_type_bool, ModifiesPageOrder),
#undef pi
gs_param_item_end
};
diff --git a/devices/vector/gdevpdfx.h b/devices/vector/gdevpdfx.h
index f494fb8de..b41c9648b 100644
--- a/devices/vector/gdevpdfx.h
+++ b/devices/vector/gdevpdfx.h
@@ -954,9 +954,11 @@ struct gx_device_pdf_s {
gs_glyph OCR_glyph; /* Passes the current glyph code from text processing to the image processing code when rendering glyph bitmaps for OCR */
ocr_glyph_t *ocr_glyphs; /* Records bitmaps and other data from text processing when doing OCR */
gs_gstate **initial_pattern_states;
- bool OmitInfoDate; /* If true, do not emit CreationDate and ModDate in the Infor dictionary and XMP Metadata (must not be true for PDF/X support) */
+ bool OmitInfoDate; /* If true, do not emit CreationDate and ModDate in the Info dictionary and XMP Metadata (must not be true for PDF/X support) */
bool OmitXMP; /* If true, do not emit an XMP /Metadata block and do not reference it from the Catalog (must not be true for PDF/A output) */
bool OmitID; /* If true, do not emit a /ID array in the trailer dicionary (must not be true for encrypted files or PDF 2.0) */
+ bool ModifiesPageSize; /* If true, the new PDF interpreter will not preserve *Box values (the media size has been modified, they will be incorrect) */
+ bool ModifiesPageOrder; /* If true, the new PDF interpreter will not preserve Outlines or Dests, because they will refer to the wrong page number */
};
#define is_in_page(pdev)\