Results 1 to 11 of 11

Thread: Problem in converting a .ps in .pdf with multiple images of the same pixmap

  1. #1
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Problem in converting a .ps in .pdf with multiple images of the same pixmap

    Hello,
    this is the very simple program I wrote:
    Qt Code:
    1. QPainter paint(PSPrinter);
    2. QPixmap sigmaPixmap("Immagini/sigma.xpm");
    3. for(int i=1;i<5;i++) paint.drawPixmap(QPointF(10*i,10),sigmaPixmap);
    To copy to clipboard, switch view to plain text mode 

    If I use this code to print on screen, I have no problem.
    if I use it to print on .ps,no problem.

    The problem arises when I try to convert the ps to pdf usint "gs",this is the error I get:
    convert: Delegate failed `"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -sDEVICE="pdfwrite" -sOutputFile="%o" -f"%i"'.

    Please,don't tell me to print directly in pdf! I need to print first on ps...

    I also tryed to create a Vector of pixmap like this:

    Qt Code:
    1. QVector<QPixmap> pix(5,sigmaPixmap);
    2. for(int i=1;i<5;i++) paint2.drawPixmap(QPointF(10*i,10),pix[i]);
    To copy to clipboard, switch view to plain text mode 

    but the result is the same.

    What do you think?

    thanks!
    Last edited by vratojr; 12th January 2006 at 11:17.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    Quote Originally Posted by vratojr
    The problem arises when I try to convert the ps to pdf usint "gs",this is the error I get:
    convert: Delegate failed `"gs" -q -dBATCH -dSAFER -dMaxBitmap=500000000 -dNOPAUSE -dAlignToPixels=0 -sDEVICE="pdfwrite" -sOutputFile="%o" -f"%i"'.
    The problem seems the string -sOutputFile="%o" -f"%i"'.
    Check the argument passed to QProcess.

    Bye
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    Here it is the generated ps image.
    Attached Files Attached Files

  4. #4
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    Why are you using QProcess???
    I thought QT 4 (I'm using 4.1.1 snapshot but this feature is present in QT 4.1.0) had the ability to convert document to .pdf format.
    Current Qt projects : QCodeEdit, RotiDeCode

  5. #5
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    I have to print in .ps because I qant to include the .ps file in a latex documet.
    Any hint?

    Thanks.

  6. #6
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    I don't undertsand how this is a Qt problem. The code you've shown us has nothing to do with converting PostScript to PDF.

    I guess the program you're using to convert PDF to PostScript is called with wrong parameters. But you don't show us how the program is called...

  7. #7
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    I think it has something to do with Qt, I suppose that the problem arises not from the converter but from the code I wrote, maybe there is a problem there.

    For the converter, I simpy use gv and call it the same way I call it to convert a .ps to .pdf that is: "convert img.ps img.pdf" and I don't thnk the problem lies here since as I told:
    If i draw a single pixmap in the ps file I can convert it without problems, I i draw multiple pixmap (the same pixmap) I cannot convert it.
    I'm not sure it's a Qt problem but I think so... I asked youbecause I wanted to know...

    Thanks!

  8. #8
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    As I said: you don't show us how the program is called...

    You're probably not calling convert from Qt the same way it is called from the command line.

  9. #9
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    Oh, I now understand the problem. Qt generates the PostScript image you had posted. Then convert fails to convert the PostScript to PDF, whether you call it from Qt or not. So you suspect the PostScript file generated by Qt is broken.

    OK, I will try to have a look at the PostScript file... but I'm no specialist of PostScript.

  10. #10
    Join Date
    Jan 2006
    Posts
    109
    Thanks
    2
    Thanked 5 Times in 5 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    This works for me:
    Qt Code:
    1. convert fava.ps fava.pdf
    To copy to clipboard, switch view to plain text mode 
    I guess convert or gs are broken on your system?

  11. #11
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem in converting a .ps in .pdf with multiple images of the same pixmap

    Quote Originally Posted by dimitri
    This works for me:
    Qt Code:
    1. convert fava.ps fava.pdf
    To copy to clipboard, switch view to plain text mode 
    I guess convert or gs are broken on your system?
    Arrrrrrrrrgh!
    Ok thank you! I'll try to see to fit it... It's quite strange since I get en error only with this kind of files.

    Thank you!

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.