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.

Fri May 11, 2018 8:48 pm

Hello,
I am trying to print a pdf document with the sample code

PdfDocument doc = new PdfDocument();

//Load file
doc.LoadFromFile("PrintWithoutPrintDialog.pdf");

//Set the print controller without printing process dialog
doc.PrintSettings.PrintController = new StandardPrintController();

//Print all pages with default printer
doc.Print();

but when it hits the doc.Print(); I get a Exception

System.Runtime.InteropServices.ExternalException occurred
HResult=0x80004005
Message=A generic error occurred in GDI+.
Source=System.Drawing
StackTrace:
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.FillPath(Brush brush, GraphicsPath path)
at sprᷦ.ᜀ(sprᲵ A_0, spr⃌ A_1, Graphics A_2, PointF A_3)
at spr⃌.ᜁ(Graphics A_0, sprᲵ A_1, Boolean A_2)
at sprᲵ.ᜀ(String A_0, sprᷦ A_1, String A_2, Boolean A_3)
at sprᷦ.ᜀ(spr⁏ A_0, String A_1, String A_2)
at sprᲵ.ᜀ(String[] A_0, String A_1)
at sprᲵ.ᜀ(sprỐ A_0)
at sprᲵ.ᜇ(Boolean A_0)
at sprᲵ.ᜥ()
at sprួ.ᜀ(PrintPageEventArgs A_0, PdfPageBase A_1, RectangleF A_2)
at sprួ.ᜂ(PrintPageEventArgs A_0)
at sprួ.ᜀ(Object A_0, PrintPageEventArgs A_1)
at System.Drawing.Printing.PrintDocument.OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintDocument._OnPrintPage(PrintPageEventArgs e)
at System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at sprួ.ᜅ()
at Spire.Pdf.PdfDocument.Print()
at Print_PDF.Program.Main(String[] args) in C:\Users\Public\Customers\XXXXXX\Docs\PDF_Printing\Source\Print_PDF\Print_PDF\Program.cs:line 28

any help would be appreciated.

Thanks

Mike K

mikek
 
Posts: 4
Joined: Fri Dec 01, 2017 7:41 pm

Mon May 14, 2018 3:06 am

Dear Mike Keers,

Thanks for your post.
please provide the following information to help us do further investigation.
1.The input file.
2.The system configuration. Eg, Win 7, 64 bit.
3.The region information. Eg, China/Chinese.
4.Did you publish your project in Azure?
Thanks in advance.

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Mon May 14, 2018 12:49 pm

Hi Wade,

Thank for the response.

1.The input file.
The Input file is the same used in the provided example.
2.The system configuration. Eg, Win 7, 64 bit.
We are trying to run it on a windows 10 machine but the final system is windows 2016 server (both are 64bit).
3.The region information. Eg, China/Chinese
The region is the US.
4.Did you publish your project in Azure?
this was a stand alone console program.

if you need any more info please ask.

Thanks

Mike Keers

mikek
 
Posts: 4
Joined: Fri Dec 01, 2017 7:41 pm

Tue May 15, 2018 9:26 am

Dear Mike Keers,

Thanks for your details.
I have tested the file(PrintWithoutPrintDialog.pdf) on a windows 10 machine and windows 2016 server with the latest version(Spire.PDF Pack(Hot Fix) Version:4.4.11), but didn't encounter any issue. If you were using an old version, please update to the latest version and try again.
In addition, the issue could be caused by the drive of the printer. I suggest that you could try other printer. Eg,“Microsoft XPS Document Writer”. and tell us result.

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Tue May 15, 2018 10:03 pm

Wade,
Thank You that solved the problem. I was able to print the PDF file with no problem.

Thanks

Mike Keers

mikek
 
Posts: 4
Joined: Fri Dec 01, 2017 7:41 pm

Wed May 16, 2018 1:11 am

Dear Mike Keers,

Thanks for your feedback.
Please feel free to contact us if you need any assistance.

Sincerely,
Wade
E-iceblue support team
User avatar

Wade.shao
 
Posts: 32
Joined: Thu Mar 22, 2018 8:23 am

Return to Spire.PDF

cron