Corrupted PDF when using PrintToFile on PDFCreator printer

Using a vb.Net program we look for the PDFCreator printer in the system and we instruct it to print directly to filename (we need to be able to control the filename it prints to), using the PrinterSettings Class:

``` Dim myPrintSettings As New System.Drawing.Printing.PrinterSettings [...] myPrinterSettings.PrintToFile=true
myPrinterSettings.PrintFileName = "C:\\Temp\\SomeFile.PDF"
```

When printing this way, PDFCreator creates a PDF but when opening it in Adobe Reader it complaints about a corrupt file.

When opening the file in Notepad, it seems to be a good PDF.

Printing without the PrintToFile=true and PrintFileName it all works as expected.

Using the same process with the XPS printer works ok.

Any ideas?

Thanks for your help.

Joel

After all, what happens is that PDFCreator is not saving the file as PDF:

%!PS-Adobe-3.0
%%Title: Fatura 10/01/00008 Original

Why? What can I do to make it behave properly?

 

Thansk for your help.

Joel