Re: ps2pdf: Embedded files are removed
Ken Sharp <[email protected]>
| Newsgroups | gmane.comp.printing.ghostscript.devel |
|---|---|
| Message-ID | <[email protected]> |
At 23:07 17/03/2016 +0100, Andreas Nef wrote:
>sDEVICE=pdfwrite -sOutputFile=out.pdf PDFA_def.ps input.pdf The thing that
>I would expect is that depending on the -dPDFACompatibilityPolicy switch I
>would receive different results. However, the resulting documents are
>currently always the same, regardless of this switch, and none of the
>output files contain the originally embedded office file anymore. How can
>I get the expected behaviour for -dPDFACompatibilityPolicy=2 (i.e. an
>error message) and -dPDFACompatibilityPolicy=0 (i.e. output is a regular
>pdf file still containing the embedded file)?
Bluntly, you can't.
This is, I'm afraid, a misapprehension about the way that pdfwrite works.
Many people are under the illusion that pdfwrite 'edits' or 'manipulate's
the original PDF file, it does not.
Ghostscript fully interprets the input (in what ever format, PostScript,
PDF, etc) into marking operations, or graphic primitives (eg fill, stroke,
image etc) which it sends to the selected device. In general devices call
upon the graphics library to render these operations to a bitmap and at the
end of the page write the bitmap to a file. The high level, or vector,
devices such as pdfwrite instead convert the primitive into an equivalent
operation in a different Page Description Language, such as PDF, and emit
that. Thus the output file bears no relation, internally, to the input file
even if they are of the same format. All that is expected is that the
appearance should be the same.
Your embedded files do not make any marks on the pages, so they are not
converted to graphics primitives, are not passed to the device and so are
not present in the output. This is not the same as 'removing' embedded
files, those embedded files are not there, ever.
Now, the PDF interpreter and pdfwrite devices do make some effort to
preserve certain non-marking aspects of the input, however embedded files
are not one of those and therefore there is currently no way to take an
input PDF file with embedded files and produce an output file from pdfwrite
which includes those same embedded files, no matter what command line you use.
Ken