PDA

View Full Version : Problem in converting a .ps in .pdf with multiple images of the same pixmap



vratojr
12th January 2006, 12:09
Hello,
this is the very simple program I wrote:


QPainter paint(PSPrinter);
QPixmap sigmaPixmap("Immagini/sigma.xpm");
for(int i=1;i<5;i++) paint.drawPixmap(QPointF(10*i,10),sigmaPixmap);

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:


QVector<QPixmap> pix(5,sigmaPixmap);
for(int i=1;i<5;i++) paint2.drawPixmap(QPointF(10*i,10),pix[i]);


but the result is the same.

What do you think?

thanks!

mcosta
12th January 2006, 14:07
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

vratojr
12th January 2006, 15:56
Here it is the generated ps image.

fullmetalcoder
17th January 2006, 15:46
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.

vratojr
18th January 2006, 16:23
I have to print in .ps because I qant to include the .ps file in a latex documet.
Any hint?

Thanks.

dimitri
19th January 2006, 00:42
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...

vratojr
19th January 2006, 11:32
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!

dimitri
21st January 2006, 10:15
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.

dimitri
21st January 2006, 10:19
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.

dimitri
21st January 2006, 10:23
This works for me:
convert fava.ps fava.pdfI guess convert or gs are broken on your system?

vratojr
1st February 2006, 11:08
This works for me:
convert fava.ps fava.pdfI 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!