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 Mar 30, 2016 8:41 am

We are using SpirePDF to print using a .NET service and when we try to print on "Sharp MX-2300" printer we get the following exception and printing fails giving the exception.

System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully
at System.Drawing.Printing.StandardPrintController.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnEndPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()

But the main issue is that after this it also fails to print to other printers as well giving the same exception and the following exception.

System.ComponentModel.Win32Exception (0x80004005): The handle is invalid
at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at PrintConnector.Library.PdfHelper.PrintPdfSpire(String fileName, PrintEvent printEvent)

I also found this post from the forum (can-spire-pdf-be-used-in-a-window-service-t5494.html) which says about MSDN warning on using System.Drawing.Printing namespace in a windows service. If that is the problem is there anyway to stop failing the other printers as well after it fails on that particular printer?

janitha000
 
Posts: 15
Joined: Fri Mar 11, 2016 10:07 am

Wed Mar 30, 2016 9:12 am

Hello,

Thanks for your feedback.
Please provide us your PDF document can replicate the issue to help us investigate it.
Thank you.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Wed Mar 30, 2016 10:19 am

I sent the pdf file via email.

janitha000
 
Posts: 15
Joined: Fri Mar 11, 2016 10:07 am

Thu Mar 31, 2016 2:24 am

Hello,

Thanks for your document.
I tested the document with the latest Spire.PDF version: 3.6.260, and it has printed successfully, please try the version. If the issue still exists after trying, please provide a simple application to help us reproduce the error, and then we will work out solutions to resolve it.
Thanks.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Thu Mar 31, 2016 7:27 am

Did you try on printer "Sharp MX-2300" ?? So far we are only getting this error on this printer. But the main issue is that it makes other printers to fail too. I will send a simple application via email as well.

janitha000
 
Posts: 15
Joined: Fri Mar 11, 2016 10:07 am

Fri Apr 01, 2016 1:55 am

Hello,

Sorry that we don't have "Sharp MX-2300” printer. So far I haven't received your mail with your sample project, please send it again. Thank you.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Tue Apr 05, 2016 8:47 am

Hello,

Did you still have the issue? If so, please provide us your sample project for investigation.
Thank you.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Thu Jun 02, 2016 9:51 am

I also occurred the same error

We are using SpirePDF to print using a .NET service get the following exception and printing fails giving the exception.

System.ComponentModel.Win32Exception (0x80004005): The operation completed successfully
場所 System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal(String printer)
場所 System.Drawing.Printing.PageSettings.get_ExtraBytes()
場所 System.Drawing.Printing.PageSettings.CopyToHdevmode(IntPtr hdevmode)
場所 System.Drawing.Printing.StandardPrintController.OnStartPage(PrintDocument document, PrintPageEventArgs e)
場所 System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPage(PrintDocument document, PrintPageEventArgs e)
場所 System.Drawing.Printing.PrintController.PrintLoop(PrintDocument document)
場所 System.Drawing.Printing.PrintController.Print(PrintDocument document)
場所 System.Drawing.Printing.PrintDocument.Print()


SpirePDF version - 3.7.0.5040
Windows 8

In this program
The error occurs in the 61 th page
//Sample Test Program
private void button3_Click_1(object sender, EventArgs e)
{
List<PrintSet2> PrinstSets = new List<PrintSet2>();
//Test
PrinstSets.Add(new PrintSet2("Tray1", 1, 30)); //Tray1 1~30 Page
PrinstSets.Add(new PrintSet2("Tray2", 31, 50)); //Tray2 31~50 Page
PrinstSets.Add(new PrintSet2("Tray1", 51, 80)); //Tray1 51~80 Page
PrinstSets.Add(new PrintSet2("Tray2", 81, 100)); //Tray2 81~100 Page

using (PdfDocument doc = new PdfDocument())
{
doc.LoadFromFile(PDFPath);

//Set Used Printer
doc.PrinterName = comboBox1.Text;//PrinterName

//Get PaperSource Dictionay
Dictionary<string, PaperSource> PaperList = new Dictionary<string, PaperSource>();
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = comboBox1.Text;
foreach (PaperSource paperSource in printDocument.PrinterSettings.PaperSources)
{
PaperList.Add(paperSource.SourceName, paperSource);
}
//TraysList
List<PdfPaperSourceTray> Trays = new List<PdfPaperSourceTray>();

//ChangePDF
for (int i = 0; i < PrinstSets.Count; i++)
{
PdfPaperSourceTray PPST = new PdfPaperSourceTray();
//PaperTrayChange
PPST.PrintPaperSource = PaperList[PrinstSets[i].TrayName];
PPST.StartPage = PrinstSets[i].StartID;
PPST.EndPage = PrinstSets[i].EndID;
Trays.Add(PPST);
}
//Set PdfPaperSourceTray
doc.PageSettings.ListPaperSourceTray = Trays;
//Print

doc.PrintDocument.Print(); //←Error

}
}

private class PrintSet2
{
public string TrayName = "";
public int StartID = -1;
public int EndID = -1;
public PrintSet2(string name, int start, int end)
{
TrayName = name;
StartID = start;
EndID = end;
}
}

shimizukt
 
Posts: 3
Joined: Tue May 17, 2016 10:10 am

Fri Jun 03, 2016 3:12 am

Hi,

Thank you for feedback and your information.
Could you please send your pdf file can replicate your issue to our e-mail (support@e-iceblue.com) for investigation? Thank you for the assistance.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Mon Jun 27, 2016 2:18 am

Hi,

Thanks for waiting.
The error has been fixed. Welcome to download and test Spire.PDF Pack(Hot Fix) Version:3.7.106.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Tue Jun 28, 2016 9:29 am

Hi,

Has your issue been resolved?
Thank you for your feedback in advance.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Wed Oct 04, 2017 12:06 pm

These are the common causes of error 0x80004005

Microsoft Outlook Error
Registry Key Error
Corrupt .dll file

nathengeek
 
Posts: 1
Joined: Wed Oct 04, 2017 12:04 pm

Thu Oct 05, 2017 12:25 am

Dear nathengeek,

Thanks for your inquiry.
Could you please share us the input document and the code you were using for testing ?

Sincerely,
Betsy
E-icbelue support team
User avatar

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

Return to Spire.PDF