0
votes

Is it possible to tell ghostscript to remove white backgrounds when using the pdfwrite-device?

The reason for this is that the generated PDF should be overlaid in further processing over some letterhead also given as PDF.

If the source postscript has the background already set to white then the resulting PDF would also have an explicited white background (achieved by a rect at the beginning of each page set to the complete page size set and filled with non-stroking color 'white'). Thus the generated PDF cannot be overlayed over a second letterhead-PDF. The white background would override the letterhead completely and the letterhead won't appear in the final PDF.

The application generating the postscript output with white background (e.g. some business software) is fix and cannot be changed. So the changes have to be done when processing the postscript output of this software.

1
Could the changes be made to the generated postscript output before sending to the pdfwrite? The changes could be as simple as editing the 'fill' at the beginning of each page to 'newpath' for example or even "clear (letterhead.ps) run". I can think of a limited number of changes that could be made when running the pdfwrite as you requested. Some would be easy and some difficult. The suggestion by KenS also might easily work solving your problem. If not, could you edit your post to include the code for the "rectangle at the beginning of each page"? - beginner6789
Thanks Ken and beginner6789. Good to know that such a param does not exist. II have definately no postscript experience but have some knowledge on PDF's. So I've done the same by editing the generated PDF-contentstreams before overlaying it on the letterhead. Putting the letterhead over the pdf might result in same problems. - tombo_189
But interesting: With GS 9.23 and before the output of that special business app is renedered without a white full page background, with GS 9.27 the behaviour has changed and the full page background is inserted. Now, we have GS 9.52 and I was obliged to update to new newest version due to other new important features. Perhaps Ken knows what feature changed the behaviour from 9.23 to 9.27 (or somewhere in between). - tombo_189
For the underlying postscript output generated by the business software please contact me via the email-address provided on the webpage in my stackoverflow's profile. I'd appreciate it to already change the postscript before translating it into a pdf. - tombo_189
I'm unaware of anything which has changed and would include a full page white rectangle. I'd need to see an example to be able to say more. I'm contactable as ken.sharp at artifex.com - KenS

1 Answers

1
votes

No, you cannot remove that with Ghostscript and the pdfwrite device.

If the problem is always produced by the same input the possibly you could write something in PostScript to solve the problem but without seeing an example I can't say for sure.

Note that PostScript doesn't have a 'non-stroking' colour, there's only one colour in PostScript.

Another solution it seems to me would be to change the Z order; put the letterhead on top of the content, rather than putting the content on top of the letter heading.