We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Scrambled printout with AsposeWordsPrintDocument

We are experiencing some issues with AsposeWordsPrintDocument. We are using Print method of AsposeWordsPrintDocument to print contents of Aspose.Words.Document. Everything is running fine for a day or 2 and then we are seeing “scrambled” printed outputs. But if we save Aspose.Words.Document object to a file (pdf/docx) the output document is fine. An IIS reset seems to fix the problem and everything is running fine for a day or 2 again.

Below is the code we are using. asposeDocument is Aspose.Words.Document object and when it is saved to file there is no scrambled text.

    Using printDoc = New AsposeWordsPrintDocument(asposeDocument)
        printDoc.DocumentName = "test"
        printDoc.PrinterSettings = settings
        printDoc.PrintController = New StandardPrintController()
        printDoc.Print();
    End Using

Could you please help us what might be the issue. The code is straightforward and we are using Aspose.Words 15.4.0.0 version. I uploaded the sample scrambled Capture.PNG (10.7 KB)
printout we got.

Thanks

@msusta,

Thanks for your inquiry. You are using a very old version of Aspose.Words i.e. 15.4.0 on your end. We would suggest you to please upgrade to the latest version of Aspose.Words for .NET i.e. 18.6. Hope, this helps. In case the problem still remains, please ZIP and attach the following resources here for testing.

  • Sample input Word document causing this problem
  • What are your IIS and Windows versions.
  • Please create a standalone simplified web application (source code without compilation errors) that helps us to reproduce the same problem on our end and attach it here for testing.

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

Thank you for your reply. Let me ask this. For printing we can either use Print method of AsposeWordsPrintDocument by passing Aspose.Words.Document object to its constructor or directly use Print method of Aspose.Words.Document object.

First way:
Using printDoc = New AsposeWordsPrintDocument(asposeDocument)
printDoc.DocumentName = “test”
printDoc.PrinterSettings = settings
printDoc.PrintController = New StandardPrintController()
printDoc.Print();
End Using

Second way:
asposeDocument.Print(settings, “test”)

What is the difference between them?

@msusta,

Functionality wise, there should not be any difference. However, the Document.Print method internally uses the AsposeWordsPrintDocument class. Sometimes, it is much easier to just call the Document.Print() than creating a new instance of AsposeWordsPrintDocument class. But, AsposeWordsPrintDocument class provides a public CachePrinterSettings method which allows you to read and cache some fields of PrinterSettings to reduce printing time.