Bug 141572 - Printing to PDF (even via intermediate PS file) produces garbled PDF
Summary: Printing to PDF (even via intermediate PS file) produces garbled PDF
Status: RESOLVED WORKSFORME
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-12 02:42 UTC by Andreas Koch
Modified: 2007-02-12 19:40 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
www.ibm.com printed to PS file by Konqueror (432.22 KB, application/octet-stream)
2007-02-12 02:45 UTC, Andreas Koch
Details
PDF created by ps2pdf from konqueror-generated PS (126.77 KB, application/octet-stream)
2007-02-12 02:46 UTC, Andreas Koch
Details
www.ibm.com, PS created by Firefox 2.0.0.1 (332.67 KB, application/octet-stream)
2007-02-12 02:47 UTC, Andreas Koch
Details
PDF created by ps2pdf from Firefox-generated PS file (126.77 KB, application/octet-stream)
2007-02-12 02:48 UTC, Andreas Koch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Koch 2007-02-12 02:42:08 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc 4.1.1 
OS:                Linux

When printing a web page to PDF, the resulting PDF is garbled in that text is corrupted (missing). This occurs even when printing to a PS file and then converting that to PDF via ps2pdf. Note that the PS file itself renders correctly in ghostview etc., it just doesn't survive the conversion to PDF.

Note: The same web site (for example, www.ibm.com) converts correctly to PDF when the intermediate PS has been created by Firefox by printing to a file.
Comment 1 Andreas Koch 2007-02-12 02:45:41 UTC
Created attachment 19633 [details]
www.ibm.com printed to PS file by Konqueror
Comment 2 Andreas Koch 2007-02-12 02:46:42 UTC
Created attachment 19634 [details]
PDF created by ps2pdf from konqueror-generated PS
Comment 3 Andreas Koch 2007-02-12 02:47:49 UTC
Created attachment 19635 [details]
www.ibm.com, PS created by Firefox 2.0.0.1
Comment 4 Andreas Koch 2007-02-12 02:48:37 UTC
Created attachment 19636 [details]
PDF created by ps2pdf from Firefox-generated PS file
Comment 5 Andreas Koch 2007-02-12 02:50:40 UTC
The same behavior occurs when choosing `Print to file (PDF)' in the Konqueror print dialog.
Comment 6 Kurt Pfeifle 2007-02-12 14:45:44 UTC
First off, you made a little mistake when uploading your files: attachment 19634 [details] (dubbed as "PDF created by ps2pdf from konqueror-generated PS") is *not* created from a Konqueror-generated PostScript, but is the same as 19636.


Second, try this procedure to create PDFs with KDEPrint's "Print to File (PDF)" printer:

(a) Prepare:
    --------
    * run "kaddprinterwizard --kdeconfig"
    * open the "Fonts" tab
    * make sure that "Embed fonts in PostScript..." is *DIS*abled
    * confirm this setting with "OK"

(b) Make the PDF:
    -------------
    * load the page in Konqueror
    * click "Print", select the PDF printer
    * in the print dialog, click "System Options"
    * in the system options dialog, check if font embedding is still *DIS*abled
    * click on "Properties" for PDF printer
    * select "Driver Settings" tab
    * scroll down and make sure that "Embed all Fonts" is *EN*abled
    * set the "Embed subsets" as you want (if you want *complete* embedding of
      most fonts, set the "Maximum font subset" percentage to "1".



Explanation:
------------

 - If KDEPrint's "System Options" are set to "Embed fonts", this will cause Qt3
   to convert all TT fonts into crappy "Type 3" fonts and embed these into the
   PostScript that comes from the application (Konqueror or otherwise). The next
   stage, ps2pdf, can not do much about it any more, and you'll get a crappy 
   result.

 - If KDEPrint's "System Options" are set to *not* "Embed fonts", this will
   cause Qt to not embed a converted "Type 3" font, and just reference the used
   TrueType font by its name. In the next stage, when ps2pdf does its work, you
   told it to embed all fonts, and that's what it now does: it received a PS 
   file with no embedded (but only referenced) fonts, and if your Ghostscript
   is set up correctly to search all available font paths, it will do so.


For a very quick check about the setup, and testing if it works, make "kpdf" your printjob previewing program:

  * run "kaddprinterwizard --kdeconfig"
  * open the "Preview" tab
  * enble "Use external program"
  * insert "kpdf" into the line edit
  * confirm with "OK".

You'll now see that for each printjob preview still PostScript is produced (of course), but kpdf as the previewer will silently run "ps2pdf" in the background to convert the file into a temporary PDF to be displayed. It may take a little bit longer, but you can immediately check if the fonts are correct, if the file is still "searchable", and if KTTS can still read the text to you.

Let me know.

Cheers,
Kurt
Comment 7 Andreas Koch 2007-02-12 17:03:40 UTC
Apologies for the file mixup, it was getting rather late ;-)

Your proposed solution works perfectly, many thanks! However, since I'm probably not the only user affected by this behavior, it might be a good idea to turn off Font Embedding in the KDEPrint settings by default.

Many thanks again for the quick reply,
  Andreas
Comment 8 Kurt Pfeifle 2007-02-12 19:40:24 UTC
Closing this bug (reporter now basically says "WORKSFORME").