Bug 688152 - 'Undefined in get' and extra trailer keys with pdfwrite.ps and PDF1.5+
Summary: 'Undefined in get' and extra trailer keys with pdfwrite.ps and PDF1.5+
Status: NOTIFIED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Interpreter (show other bugs)
Version: master
Hardware: PC All
: P3 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-21 11:26 UTC by SaGS
Modified: 2008-12-19 08:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
Suggested patch. (2.04 KB, patch)
2005-06-21 11:33 UTC, SaGS
Details | Diff
Suggested patch. (1.99 KB, patch)
2005-08-24 13:58 UTC, SaGS
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description SaGS 2005-06-21 11:26:25 UTC
When processing a PDF file containing an xref-stream (PDF1.5+ stream 
object replacing the "classic" trailer dictionary and xref table) with a 
pdfwrite.ps-based tool, one gets an "Error: /undefined in --get--". The 
output file is truncated near the end. The xref and part of the trailer 
are present in the output PDF; the last token written is "/File".

Cause:

In this case the trailer is a PDF stream, but it is considered a 
PDF dictionary after being improperly manipulated. The error comes from 
an attemp to write a PostScript file object, operation for which there's 
no entry in pdfwrite.ps::/pdfwritetypes (and there's no need for one).

Sample command lines (Windows version):

    gswin32c -q -dNOPAUSE                                             \
        -c "/runlibfile {//runlibfile exec 3 .setlanguagelevel} def"  \
        -- toolbin\pdfinflt.ps PDFReference16.pdf out.pdf >out.txt
or
    gswin32c -q -dNODISPLAY -dSAFER -dDELAYSAFER                      \
        -c "/runlibfile {//runlibfile exec 3 .setlanguagelevel} def"  \
        -- lib\pdfopt.ps PDFReference16.pdf out.pdf

- "PDFReference16.pdf" is the published PDF Reference Manual, 5th edition.
- Although the symptom is similar to bug #688149 "Problems, including one 
  security-related, with handling dictionaries", it is completely 
  unrelated to that one.
- The "-c /runlibfile ..." is a workaroud for a separate bug which would 
  otherwise raise an error long before the current one; see bug #688151 
  "PDF interpreter needs languagelevel 3, not 2" for details.
- For the pdfinflt.ps test redirect the output to a file, because the 
  o-stack dump is huge (don't know why).
- pdfopt.ps does not write directly to the output PDF. To see what 
  happens, temporarily change pdfwrite.ps::/pdfwritetrailer to dump its 
  parameter before, and print a message after, the "pdfwritevalue" call.
Comment 1 SaGS 2005-06-21 11:33:45 UTC
Created attachment 1461 [details]
Suggested patch.
Comment 2 SaGS 2005-07-03 03:45:02 UTC
> - For the pdfinflt.ps test redirect the output to a file, because the 
>   o-stack dump is huge (don't know why).

See http://bugs.ghostscript.com/show_bug.cgi?id=687796#c14 .
Comment 3 Igor Melichev 2005-07-03 11:22:12 UTC
Changing the bug assignment since it is not my area. pdfopt and pdfinflt are 
handled by Ray or by Alex with Ray's management.
Comment 4 SaGS 2005-08-24 13:58:44 UTC
Created attachment 1652 [details]
Suggested patch.

The patch in comment #1 misspelled "/XRefStm" as "/XRefStrm" (with 
an extra "r").
Comment 5 Henry Stiles 2008-02-26 10:29:00 UTC
old wrongly assigned bug back to support for reassignment.
Comment 6 Alex Cherepanov 2008-04-22 17:35:09 UTC
This bug report has just come to my attention.
Thank you SaGS, the patch is committed as a rev. 8658.

Ghostscript utilities are not yet covered by regression testing.