summaryrefslogtreecommitdiff
path: root/gs/base/gdevpdf.c
diff options
context:
space:
mode:
authorKen Sharp <ken.sharp@artifex.com>2010-10-21 11:17:31 +0000
committerKen Sharp <ken.sharp@artifex.com>2010-10-21 11:17:31 +0000
commit41c46464aa9f71928a0fdef5016f44cde36417b9 (patch)
treebccc4596305d6dd679c89c85e5a0181150ab4dfa /gs/base/gdevpdf.c
parentd1c80c3a57a6b59a328a440798207cc53d1b9f97 (diff)
When producing DSC compliant PostScript from ps2write, do not emit the following;
Pages tree, outlines, articles, named destinations, PageLabels array, document metadata, document Catalog, threads, encrypt dictionary, xref, trailer. These objects are not required by PostScript, and cannot be easily placed in a DSC-conforming file. This does mean that, unlike the general output from ps2write, the output file is *not* a valid PDF file and cannot be opened as such by a PDF consumer. No differences expected. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11835 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gdevpdf.c')
-rw-r--r--gs/base/gdevpdf.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/gs/base/gdevpdf.c b/gs/base/gdevpdf.c
index 0f92490b8..00fc178c0 100644
--- a/gs/base/gdevpdf.c
+++ b/gs/base/gdevpdf.c
@@ -1196,21 +1196,21 @@ pdf_close(gx_device * dev)
code = code1;
/* Create the Pages tree. */
+ if (!(pdev->ForOPDFRead && pdev->ProduceDSC)) {
+ pdf_open_obj(pdev, Pages_id);
+ s = pdev->strm;
+ stream_puts(s, "<< /Type /Pages /Kids [\n");
+ /* Omit the last page if it was incomplete. */
+ if (partial_page)
+ --(pdev->next_page);
+ {
+ int i;
- pdf_open_obj(pdev, Pages_id);
- s = pdev->strm;
- stream_puts(s, "<< /Type /Pages /Kids [\n");
- /* Omit the last page if it was incomplete. */
- if (partial_page)
- --(pdev->next_page);
- {
- int i;
-
- for (i = 0; i < pdev->next_page; ++i)
- pprintld1(s, "%ld 0 R\n", pdev->pages[i].Page->id);
- }
- pprintd1(s, "] /Count %d\n", pdev->next_page);
-
+ for (i = 0; i < pdev->next_page; ++i)
+ pprintld1(s, "%ld 0 R\n", pdev->pages[i].Page->id);
+ }
+ pprintd1(s, "] /Count %d\n", pdev->next_page);
+
/* If the last file was PostScript, its possible that DSC comments might be lying around
* and pdf_print_orientation will use that if its present. So make sure we get rid of those
* before considering the dominant page direction for the Pages tree.
@@ -1325,7 +1325,7 @@ pdf_close(gx_device * dev)
if (pdev->pages[i].Page)
pdev->pages[i].Page->id = 0;
}
-
+}
/*
* Write the definitions of the named objects.
* Note that this includes Form XObjects created by BP/EP, named PS
@@ -1350,6 +1350,7 @@ pdf_close(gx_device * dev)
pdf_copy_data(s, rfile, res_end, NULL);
}
+ if (!(pdev->ForOPDFRead && pdev->ProduceDSC)) {
/* Write Encrypt. */
if (pdev->OwnerPassword.size > 0) {
Encrypt_id = pdf_obj_ref(pdev);
@@ -1408,6 +1409,7 @@ pdf_close(gx_device * dev)
}
stream_puts(s, ">>\n");
pprintld1(s, "startxref\n%ld\n%%%%EOF\n", xref);
+ }
/* Release the resource records. */