Getting a 0 Byte PDF file

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
MMathieson
Posts: 3
Joined: Mon Nov 08 2004

Getting a 0 Byte PDF file

Post by MMathieson »

Hi,
I have a bit of a problem... Every time I load my application and try to create a PDF document where the default printer is set to the "Microsoft Office Document Image Writer", I get a 0 Byte PDF and a 0 Byte PDF.CAT file.

I can open the PDF Converters property page and see that the documents are being printed but I keep getting a 0 Byte file.

The weird thing is that when I load my application and the default printer is set to a different printer, I get a valid PDF. Note: I don't have any other virtual printer drivers so it may be that the default printer needs to be set to a hardware printer.

Has anyone seen this before? Does anyone know how to fix this?
Cheers,
Matt.

PS.
I'm using the PDF Converter v2.10d
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Setting the default printer to a hardware printer seems to be a kind of workaround not a solution. If it is working for you however you can adopt it.

It wasn't clear if you are using the PDF Converter printer from inside your own application or from a third party application.

Also it wasn't clear if you are getting a 0 bytes .pdf file or a .cat file.

I would suggest that you try our latest version 2.10i-6.

Hope this helps.
MMathieson
Posts: 3
Joined: Mon Nov 08 2004

Post by MMathieson »

Joan,
Thanks for the reply. I actually managed to find a solution elsewhere in the forum. This had to do with enabling the driver right before printing. i.e.
LOOP
Enable Driver
Print
END LOOP
:oops:

I do still have one issue... Sometimes the exported document will print to a hardware printer and not to a pdf file even though I've set the PDF Driver as the default printer. I've seen other posts on this forum that describe the same situation but I can't find any solution.

I would be grateful for any help.
Cheers
Matt.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

Yes, the PDF Printer should be enabled right before printing. EnablePrinter should be the last call before the print command.

Concerning your other questions, applications in general would print either to the default printer or to a specific printer specified by the application.

In the cases where the exported document will print to a hardware printer please check if this document is designed to be printed to a specific printer (that is the hardware), if this is the case than this explains why the document is being printed to another printer than the PDF Printer.

What are the documents you are trying to print?
Last edited by Joan on Fri Nov 19 2004, edited 1 time in total.
MMathieson
Posts: 3
Joined: Mon Nov 08 2004

Post by MMathieson »

Joan,
Thanks again for your help.

I have a Delphi component that renders HTML. My application uses this component to render some HTML and then prints it to the PDF driver by using the components print method.

The pseudo code is something like this...

INITIALIZE PDF DRIVER
Enable driver
Set options / Orientation / paper size
Set as default printer
Set default filename
Enable driver

LOOP
Enable driver
print
END LOOP

FINALIZE PDF DRIVER
Restore default printer

Most of the time, the PDF document is created correctly but sometime it prints to a hardware printer. It's almost as if SetDefaultPrinter fails sometimes, thus causing it to print to the hardware printer.

Cheers,
Matt.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

I would suggest that you do the following changes to your pseudocode

INITIALIZE PDF DRIVER
Enable driver
Set as default printer
Set default filename
Set options / Orientation / paper size
SetDefaultConfig // Add this call
Enable driver // This is not really needed you can remove this call

LOOP
Enable driver
print
END LOOP

FINALIZE PDF DRIVER
Restore default printer

I guess this should help, but if you are still having problems, please check if it is the same HTML file that is being printed to a hardware printer each time.

Regards.
Post Reply