Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Fri Aug 17, 2018 1:38 pm

Hello,
Can I print SpireDocument from Windows.Forms.PrintPreviewDialog? I can print SpireDoc using PrintDialog and show preview using PrintPreviewDialog. But when I click on print button on print preview, SpireDoc throw exception.

My code:
Code: Select all
spireDoc.PrintDialog = printDialog;

PrintPreviewDialog printPreviewDialog = new PrintPreviewDialog();
printPreviewDialog.Document = spireDoc.PrintDocument;
printPreviewDialog.ClientSize = new Size(600, 800);

printPreviewDialog.ShowDialog();

Exception I got:
Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object.
   in Spire.Doc.Document.OnBeginPrint(Object sender, PrintEventArgs e)
   in System.Drawing.Printing.PrintDocument.OnBeginPrint(PrintEventArgs e)
   in System.Drawing.Printing.PrintDocument._OnBeginPrint(PrintEventArgs e)
   in System.Drawing.Printing.PrintController.Print(PrintDocument document)
   in System.Drawing.Printing.PrintDocument.Print()
   in System.Windows.Forms.PrintPreviewDialog.OnprintToolStripButtonClick(Object sender, EventArgs e)
   .
   .
   .

Thank you in advance.

f00bar
 
Posts: 5
Joined: Mon Jul 16, 2018 8:34 am

Mon Aug 20, 2018 7:45 am

Dear Foo Bar,

Thanks for your inquiry and sorry for late reply as weekend.
I have reproduced the issue and logged it into our bug tracking system. If there is any progress, we will let you know at once. Sorry for the inconvenience caused.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Fri Sep 21, 2018 1:46 am

Hello,

Thanks for your patient waiting.
Your issue has been fixed, welcome to download the hotfix from the following link.
Spire.Doc Pack(hot fix) Version:6.8.16

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Wed Sep 26, 2018 7:51 am

Hi,

Greetings from E-iceblue.
Has your issue been fixed with the hotfix?
Thanks in advance for your valuable feedback.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.Doc