Free Support Forum -

Parameter is not valid on AsposeWordsPrintDocument.Print() v20.8

We are running into an issue whereby creating a new AsposeWordsPrintDocument object, setting the PrinterSettings to standard values and then calling AsposeWordsPrintDocument.Print() is causing an error to be thrown. Error being thrown is “Parameter is not valid”, below is the stack trace:

System.Drawing.Graphics.CheckErrorStatus(Int32 status) at
System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format) at
System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, Single x, Single y) at .() at .() at .() at .() at .() at .() at .() at .() at . () at .() at .() at .() at .() at .() at .( , Graphics ) at .( , SizeF , Graphics , Single , Single , Single )
at Aspose.Words.Document.RenderToScale(Int32 pageIndex, Graphics graphics, Single x, Single y, Single scale) at
Aspose.Words.Rendering.AsposeWordsPrintDocument.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

Code is simply:

Public Sub PrintDocument(DocumentParam As Aspose.Words.Document, Settings As PrinterSettings)
Dim Doc As New AsposeWordsPrintDocument(DocumentParam)
Doc.PrinterSettings = Settings
End Sub

Not sure if this is a similar issue to ‘WORDSNET-20764’ from the .NET 20.8 release notes


Please note that printing feature is not available in .NET Standard. Please refer to the following article for more detail.
Xamarin and .NET Standard 2.0 Limitations and API Differences

Could you please share the .NET version that you are using?

Using .NET 4.5


To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please create a simple Visual Studio project ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

This is not happening every time and is difficult to reproduce in a test application. Is there any logging we can enable and then send you the log files?


Unfortunately, it is difficult to say what the problem is without code example and document. So, please share the code and document for testing. We will investigate the issue and provide you more information on this issue.

Please find the zip at this location:!ADn37a5DRoZqiB4&cid=227A930A5434FE61&id=227A930A5434FE61!280508&parId=227A930A5434FE61!103&action=locate

I would like to reiterate that this problem is difficult to replicate in the test application


We have tested the scenario using the latest version of Aspose.Words for .NET 20.11 and have not found the shred issue. So, please use Aspose.Words for .NET 20.11.

We were initially on 11.2 and upgraded to 20.2 for some memory leak issues we found in production. We then found that ‘Print’ crashes for some documents and it’s not always consistent. Due to the advice from you on that incident, we upgraded to 20.8. This seemed to fix the issue initially, but we found that in some other places it kept on re-occurring. We have tried 20.11 as you suggested, but still the same happens, it can crash or produce a document of 0KB. As the issue didn’t get fixed, to verify we downgraded to 11.2 and the document print works without any issue. Can you suggest anything or have any thoughts of why this happens on the recent releases but not on the older one?


Unfortunately, it is difficult to say what the problem is without reproducing it. Could you please share your working environment e.g. operating system, .NET framework etc.? We will investigate this issue further and share our findings with you.

Please also share if you are facing this issue with specific document or all document.

.Net 4.5.2, Windows 10, has occurred consistently for the document that is in the test app in the production environment.


We have tested the scenario at Windows 10 with .NET framework 4.5.2 and have not faced this issue at our end.

Yes as i said, unfortunately this a very tricky thing to replicate, it only happens very rarely, but when it does happen it happens constantly.


Please share the screenshot of application when the exception is thrown. Please also share the complete detail of your test case along with all steps that you are using. We will try the same scenario at our end to reproduce this issue.

I don’t think there is anything more i can provide, the test application provided is a replica of the code and the test case is just clicking the Print button in the test application. Doing this can give the error shown at the top of this thread.


Unfortunately, it is difficult to say what the problem is from exception detail. We tested the scenario at the same environment as of yours. By using the shared document and code example, we were unable to reproduce this issue at our end.