Bug 84811

Summary: Adobe Distiller cannot process PostScript file generated by pdftocairo
Product: cairo Reporter: Alex Korobkin <korobkin+lpad>
Component: postscript backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium CC: cloos
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: gezond.pdf
gezond.ps
gezond2.ps - with indents

Description Alex Korobkin 2014-10-08 19:20:56 UTC
This file, when converted by pdftocairo -ps -level3 into PostScript for printing cannot be printed on printers using Adobe engine, and cannot be opened with Distiller XI because the following error is produced. 

%%[ Error: undefined; OffendingCommand: .& ]%%
%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%


I see that GS and Evince can open the original PDF and resulting PS files just fine, so the PostScript must be OK. I also reported this to Adobe, and they will probably update their Distiller engine, but updating printers firmware is unlikely to happen. 

Do you know if it is possible to make the resulting PostScript more compatible with Distiller? If a conversion is made by pdftops or pdf2ps, there are no errors, it is just pdftocairo that causes it. 

Original PDF and resulting PS files are attached.
Comment 1 Alex Korobkin 2014-10-08 19:21:10 UTC
Created attachment 107577 [details]
gezond.pdf
Comment 2 Alex Korobkin 2014-10-08 19:21:23 UTC
Created attachment 107578 [details]
gezond.ps
Comment 3 James Cloos 2014-10-10 15:11:54 UTC
[Email replies are broken; re-submitting.]

> %%[ Error: undefined; OffendingCommand: .& ]%%
> %%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
> %%[ Warning: PostScript error. No PDF file produced. ] %%

The only place .& occurs in that postscript is at the end of the image.

Which implies that the image data may be longer than required, or that
adobe's current software expects the /ASCII85Decode data to have no
extra whitespace (the file leads each line in the ascii85 data with a
space).

For a test, try running:

  :; perl -pe 's/^ //' <gezond.ps >gezond2.ps

and then sending gezond2.ps to distiller or a printer.

If that works, then the indent is the imcompatibility.

If it does not work, then perhaps the pdf has extraneous data in the
image, and cairo copies all of it, rather than limiting the data to
the minimum necessary?  (Just speculating.)
Comment 4 Alex Korobkin 2014-10-10 15:49:28 UTC
Created attachment 107671 [details]
gezond2.ps - with indents

Thanks for the suggestion, here is the file that I've got. Unfortunately, it still produces exactly the same error.
Comment 5 Adrian Johnson 2016-07-15 07:07:39 UTC
This should fix this issue:

https://cgit.freedesktop.org/cairo/commit/?id=0e6f7deac1092666464b81866f5d5a13866befe4
Comment 6 Alex Korobkin 2016-07-15 14:31:25 UTC
It indeed fixes the issue! Thanks for looking into this, you're awesome.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.