Summary: | Ghostscript loses curve elements when merging two pdfs | ||
---|---|---|---|
Product: | Ghostscript | Reporter: | IJ <iiro.jantunen> |
Component: | PDF Writer | Assignee: | Ken Sharp <ken.sharp> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | alex, iiro.jantunen |
Priority: | P4 | ||
Version: | 9.05 | ||
Hardware: | PC | ||
OS: | Windows 7 | ||
Customer: | Word Size: | --- | |
Attachments: | Sample files mentioned in the bug report. |
Its almost certainly something to do with the spurious transparency added to the PDF file. The test-svg.pdf file is astonishingly complicated involving multiple forms, patterns and images, in several layers of (irrelevant) transparency all nested inside each other. Typical of a Cairo PDF file, complicated bloated and inefficient. Most of the files are irrelevant, only the test-scg.pdf file is required. Thank you for using and testing Ghostscript. The bug is filed against v. 9.05 but attached file Result.pdf was generated by v. 8.64. Our tests confirm that vv. 8.64, 8.70, 8.71 do have this bug. Fortunately, the bug has been fixed in vv. 9.00 and higher, including the current release 9.05. Please make sure that you are running the latest version of Ghostscript. (In reply to comment #2) > Thank you for using and testing Ghostscript. > The bug is filed against v. 9.05 but attached file Result.pdf was generated by > v. 8.64. > > Our tests confirm that vv. 8.64, 8.70, 8.71 do have this bug. > > Fortunately, the bug has been fixed in vv. 9.00 and higher, including the > current release 9.05. > > Please make sure that you are running the latest version of Ghostscript. I believe this exhibits 2 bugs, one in pdfwrite and one in Acrobat. The initial PDF is constructed in a valid but insane fashion (it appears to use 4 nested forms and a pattern to draw a simple curve, all of these nestings involve transparency). For some reason pdfwrite is emitting the forms with valid but crazy bounding boxes (this is, at the very least, undesirable) It seems Acrobat cannot handle the extremely large positive and negative values for the BBox, while Ghostscript can, at least in current versions. This is an Acrobat bug. Reopening to see if I can find out why the BBox values are stupidly large, and fix it if possible. In fact the only bug here appears to be in Acrobat (and arguably the producing application). The *original* PDF file has two groups with ridiculously large BBox values of [32768 32769 -32768 -32768] and [-32768 -32768 32768 32768]. Because pdfwrite has internal 10x scaling, this results in nominal values of +/- 327680. That can't be represented exactly so we get some 'slop' in the numbers. There is nothing actually wrong with the values, they are legal and represent the same values (after taking the 10x scaling into account) as the original file. As a result I do not believe this to be a pdfwrite bug. The original values are senseless but are preserved, the fact that Acrobat is unable to display the PDF file is, I believe, a bug in Acrobat. (In reply to comment #4) > As a result I do not believe this to be a pdfwrite bug. The original values are > senseless but are preserved, the fact that Acrobat is unable to display the PDF > file is, I believe, a bug in Acrobat. I do not think so. Acrobat is unable to display the picture, but the picture is not printable, either, anymore. I guess the people here referring to the ridiculous bounding boxes may be right, but I have no idea how I can manually correct them as they are what Inkscape produces when saving this figure in pdf. This bug goes beyond me, however, as I can not be sure if the figure behaves correctly even if I can print a file. For example, my friend wrote his dissertation last year. The printed book (form pdf) was fine. The university library removed the dissertation articles (no publication rights for the Internet) to create a pdf version that could be downloaded freely from the university website. In that version ALL the figures were blown up. I noted that, before the author, this year and notified the library that this might be a Ghostscript problem, too. They have since repaired the pdf. It is quite a problem if I can not be sure that merging pdf documents (as whole pages in succession) does not harm the figures within. Another problem is that I can not be sure that what prints right, is shown on the display right, too. I do not see what I get. (In reply to comment #5) > It is quite a problem if I can not be sure that merging pdf documents The pdfwrite device is *NOT* intended as a tool for merging PDF files, it is intended as a means of *creating* PDF files from other inputs, such as PostScript. The fact that it happens also to accept PDF is a beneifical side effect. However if all you want to do is mergre PDF fiels there are tools which will do just that. Since they are intended for the purpose they will do a better job. > pages in succession) does not harm the figures within. Another problem is that > I can not be sure that what prints right, is shown on the display right, too. I > do not see what I get. Garbage In, Garbage Out. If you start with a crazy PDF file, you end up with a crazy PDF file. Ghostscript will render the PDF file created by pdfwrite quite well, so I do not believe this to be our bug. |
Created attachment 8475 [details] Sample files mentioned in the bug report. I am preparing a book with a figure containing curved arrows. Somehow these arcs get lost when running PDFLaTeX and seeing the result with TeXworks PDF viewer. Adobe Reader shows the arcs correctly. When I add the preamble pages to my book (in PDF) with Ghostscript (gswin32), the curves are gone. If I use Adobe Acrobat for combining the PDF documents together, the curves are preserved. How come? Probably this is an Ghostscript issue. See the pruned example files in the attached ZIP archive: Test-arcs.svg: Figure created with Inkscape. The curved arrows have the arcs. Test-arcs.pdf: Figure saved as PDF with Inkscape. Has arcs. Test-svg.tex: Document to contain the figure. Test-svg.pdf: Resulting PDF after PDFLaTeX. Has arcs if viewed with Acrobat Reader. Doc1.pdf: Empty page created with MS Word. Result.pdf: Resulting PDF after combining the two pages with gswin32. Arcs missing! The actual gswin32 command was gswin32 -dNOPAUSE -sDEVICE=pdfwrite -dBATCH -sOUTPUTFILE=Result.pdf Test-svg.pdf Doc1.pdf The problem occurs also with Ghostscript 8.71 on a Linux (Ubuntu 10.04.4 LTS) server: gs -dNOPAUSE -sDEVICE=pdfwrite -dBATCH -sOUTPUTFILE=Result.pdf Test-svg.pdf Doc1.pdf