Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Jun 27, 2018 8:24 am

Hello,

I'm using the following code for usage with pdfcreator 2.5 (paid version)


PdfDocument pdf = new PdfDocument();

pdf.LoadFromFile(@"C:\test.Pdf");
pdf.PrintSettings.PrinterName = "PDFCreator";
pdf.PrintSettings.PrintToFile(@"C:\test_output.Pdf");
pdf.Print();

somehow the generated file is not a pdf. But a raw file. please help.

I do not know how to change the settings so it will print to a new pdf file which I need

Mike101
 
Posts: 1
Joined: Wed Jun 27, 2018 7:04 am

Wed Jun 27, 2018 9:42 am

Dear Mike101,

Thanks for your inquiry.
After testing your case, I found the generated file was not a pdf file, and when opening it via Adobe, there will be a hint "... it is not a supported file type...". I have posted the issue to our Dev team and will let you know once there is any update. Moreover, could you please provide your input PDF and result file so that we could investigate the issue accurately ?

Besides, I found if you comment out the code "pdf.PrintSettings.PrintToFile(@"C:\test_output.Pdf");", the generated PDF file is correct. Please try to use the solution firstly. If there is any question, please feel free to let us know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Oct 29, 2018 3:44 am

Hi,

Hope you are doing well.
As for the function "Print To File", after further investigation, we find it is impossible to print to PDF file with the function using pdfcreator, since the function "Print To File" of the printer pdfcreator would generate a .PS file and our Spire.PDF follows this standard. So when using the PrintToFile function for the printer pdfcreator, you need to change the code
Code: Select all
pdf.PrintSettings.PrintToFile(@"C:\test_output.Pdf");

To the code:
Code: Select all
pdf.PrintSettings.PrintToFile(@"C:\test_output.ps");

Any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Oct 30, 2018 6:06 am

Hi,

Greetings from E-iceblue.
Has your issue been resolved? Your feedback would be greatly appreciated.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF