Results 1 to 3 of 3

Thread: QPrinter's pdf engine shows wrong font, codec and margine

  1. #1
    Join Date
    Mar 2013
    Posts
    28
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Question QPrinter's pdf engine shows wrong font, codec and margine

    I am able to output document to PDF files with QPrinter, either with virtual PDF printer or the Qt's embedded PDF engine. Whole document is painted myself. It works fine with the virtual PDF printer, just as if it's a real printer. But when I set the output format of QPrinter to QPrinter::PdfFormat, the contents in the pdf file is moved right and down. The document contains Chinese charactors and some of them are wrong, seemingly caused by a wrong codec. Also I used some of the most common Chinese Fonts, all fonts are replaced by one of them.

    What's the difference between the two ways? Is there any chance I can configure the Qt's PDF engine? Because I need to do batch output of PDF files I don't want the user to type the file names for each one with the virtual PDF printer, which works with no problem.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QPrinter's pdf engine shows wrong font, codec and margine

    The Qt PDF "printer" device will have different default geometry to your actual printer or the PDF virtual printer. There are any number of ways for this to be broken.

    Post a small, compilable program that demonstrates the problem and perhaps a good and bad PDF.

  3. #3
    Join Date
    Mar 2013
    Posts
    28
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QPrinter's pdf engine shows wrong font, codec and margine

    Thanks, but geometry is not my most concerned problem. There are ways around it.
    The codec and font problem are more strange. Because they are all connected to Chinese it's not likely helpful to provide samples.
    Why when, and only when, using the Qt's own PDF engine, some of the charactors are replaced and all fonts are replaced with one of them? I don't see any way to change this.

Similar Threads

  1. Replies: 9
    Last Post: 21st December 2012, 20:59
  2. QPrinter, wrong paper size.
    By Sahab in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2012, 21:12
  3. Replies: 0
    Last Post: 8th September 2011, 07:53
  4. Replies: 5
    Last Post: 15th January 2009, 09:03
  5. Qt renders wrong font
    By durbrak in forum Qt Programming
    Replies: 8
    Last Post: 2nd November 2006, 14:36

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.