Bug 705476 - Some Russian letters disappear in PDF
Summary: Some Russian letters disappear in PDF
Status: RESOLVED FIXED
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: PDF Writer (show other bugs)
Version: 9.53.3
Hardware: PC Linux
: P4 normal
Assignee: Ken Sharp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-09 12:20 UTC by Eduard
Modified: 2023-02-24 11:58 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
archive files (d00184-001_cups.ps, d00184-001_cups.pdf, test.pdf) (290.00 KB, application/x-tar)
2022-06-09 12:20 UTC, Eduard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eduard 2022-06-09 12:20:48 UTC
Created attachment 22700 [details]
archive files (d00184-001_cups.ps, d00184-001_cups.pdf, test.pdf)

1c send document to printer. А d00184-001 file appears in /var/spool/cups (ps formar). This file is then converted to pdf by the printer driver and printed. There are some letters of the Russian text missing on the paper, and only not in bold font. If you run the ps2pdf command yourself -dEmbedAllFonts=true d00184-001_cups.ps that the pdf file is also obtained with such errors. And if you run the following command gs -sDEVICE=pdfwrite -sOutputFile=out.pdf -batch -dNOPAUSE d00184-001_cups.p s, then the errors are the same. Please tell me what to do. OS debian 11
Comment 1 Ken Sharp 2022-06-21 14:42:06 UTC
The problem here is the way that the PostScript file has been created, indeed the fact that it has been created at all.

It seems the original was a PDF file, and that has been converted to PostScript using Cairo; and Cairo has embedded multiple fonts with the same name, referenced by unique PostScript names.

That works for PostScript printing, but is a problem when it comes to creating a PDF file, as the pdfwrite device doesn't know which of the two Verdana fonts (for example) a given piece of text is using. Acrobat produces a PDF file where half the fonts aren't embedded and are replaced on viewing by the system Verdana (on Windows).

I can't prove it, not having the original PDF file, but I strongly suspect that if the PDF->PostScript conversion had been done by Ghostscript instead of Cairo the resulting PostScript program would have worked to convert back to PDF.

Fundamentally the conversion PDF->PostScript->PDF is what is causing the problem, and is (obviously) a superfluous conversion, so this really feels like a CUPS problem. It shouldn't be doing that double conversion because it is not guaranteed to be lossless.

It may be possible for you to configure CUPS to use Ghostscript for the PDF->PostScript conversion, I don't know enough about CUPS to tell, and that may work for you. Certainly altering the font names in the PostScript program so they differ results in a correct PDF file. It may also be possible for you  to configure CUPS so that it doesn't do the conversion to PostScript as an intermediate step. Again I don't know enough about CUPS to be able to tell if that is possible.

I'll look into whether we can do anything about this, but it will be a low priority.
Comment 2 Ken Sharp 2023-02-24 11:58:49 UTC
Fixed in commit ad3f17ad44d94268e20d8fea23e563557850fc56