Results 1 to 4 of 4

Thread: Best way to print using a pdf template

  1. #1
    Join Date
    Feb 2008
    Location
    Honolulu, HI
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Best way to print using a pdf template

    Hi all,

    my application is basically a form to be filled out, including a couple of images. I am using poppler-qt4 to load a pdf template that contains the never changing stuff. However, now I am running into dpi problems, i.e. the graphics and the text are blurry, even with anti aliasing on.

    It seems as if the dpi settings between QPrinter and the Poppler:ocument are not the same. Before I get into this any more, what's the best way to go about this problem? QTextDocument seems to be pretty cumbersome to implement, isn't there a better way to just load a PDF that contains most of the stuff and just fill it in automatically with values entered?

    Thanks,
    Stephan

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Best way to print using a pdf template

    First of all antialiasing is what makes things blurry, not the dpi. Second of all it's probably the matter of scaling the pdf's image to the size of the paint device you are applying it on. As far as I remember Poppler should allow you to specify the size of the image you want to receive from the pdf page. You have to calculate the size based on the resolution of the printer and request a proper size from Poppler. Then make sure the image is not scaled.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Feb 2008
    Location
    Honolulu, HI
    Posts
    21
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Best way to print using a pdf template

    What makes it blurry is that the dpi's do not match, and it's trying to use anti-aliasing to compensate for the jaggedness of the bitmapped pdf. Instead of loading a pdf and being able to just add to it, I have to load it as image "background" on my painter associated with my printer.

    What I am doing now is a work around: I load the pdf at twice the dpi that I need it to, then rescale when painting in order to keep the filesize (and load) in check - if I just use QPrinter::HighResolution (1200 dpi), the resulting pdf is 3.1 MB large, and my program is greying out (ie. not reacting) for about 25 seconds.

    I am asking if there's another way.

    Stephan

  4. #4
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best way to print using a pdf template

    Have you tried to use an SVG file for the template ? You can design it in any size and scale it without loosing precision.

Similar Threads

  1. Replies: 4
    Last Post: 25th June 2010, 09:21
  2. Cancelling Long-running Print/Print Preview
    By ChrisW67 in forum Newbie
    Replies: 4
    Last Post: 16th June 2009, 23:05
  3. using the subdirs Template
    By bhs-ittech in forum Newbie
    Replies: 2
    Last Post: 23rd November 2007, 10:45
  4. Template class
    By steg90 in forum General Programming
    Replies: 15
    Last Post: 12th June 2007, 20:49
  5. using the lib template dll option on *nix
    By jamadagni in forum Qt Programming
    Replies: 3
    Last Post: 19th April 2007, 13:14

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.