Printing document via XPS is missing random characters from a word within a document

Printing document via XPS is missing random characters from a word within a document
I have written a window service which takes word templates with different bookmarks in it to be replaced by either some data or creates table and inserts data in those tables.
When a template is filled in with the required information, it is either sent to a printer or emailed.
When a document is emailed, it is emailed fine without any corruption, however when same document is sent to print (using xps to print), for some reason document is randomly missing characters.
It is happening anywhere within the document and mainly, if data is within a table and heading is bold and also when different fonts are used in a document.
I would really appreciate if I can be given any suggestion in terms of how to resolve this problem.v

Hi Erum,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word document.
  • Please create a standalone/runnable simple application (for example a Console Application Project) that demonstrates the code (Aspose.Words code) you used to generate your output document
  • Please attach the output Word file that shows the undesired behavior.
  • Please attach your target Word document showing the desired behavior. You can use Microsoft Word to create your target Word document. I will investigate as to how you are expecting your final document be generated like.

Unfortunately, it is difficult to say what the problem is without the Document(s) and simplified application. We need your Document(s) and simple project to reproduce the problem. As soon as you get these pieces of information to us we’ll start our investigation into your issue.

Hi

Please see the attached document, It does not happen all the times, it is very random. We are using window service for batch printing overnight. Every now and again, the characters from the document are missing, it does not happen is each document and it only happens to the some of the documents.

Can you please advice, as we have bought aspose.words now and this is affecting our live customer data and we have to print these documents again. Your quick response will be much appreciated.

Thanks

Erum Ahsan

Hi Erum,

Thanks for your inquiry. Unfortunately, it is difficult to say what the problem is without the Document(s) and simplified application. We need your Document(s) and simple project to reproduce the problem. As soon as you get these pieces of information to us we’ll start our investigation into your issue.

Hi

We have bought ASPOSE.WORDS and have now started our window service to print documents, whoever we are getting problems that when a job is sent to printer it is somehow getting corrupted.

The problem is that I can not provide the whole source code but we have copied codes from the documentation that aspose provided. link:https://docs.aspose.com/words/net/print-a-document-programmatically-or-using-dialogs/

Can you please let us know what can cause issues like that?

Also, I have read that window is now not recommending to use XPS API to print documents anymore, Is there anything else available that can used to print document via window service?

Thanks
Erum

Hi Erum,

Thanks
for your inquiry.

Please note that Aspose.Words requires TrueType fonts when
rendering documents to fixed-page formats (PDF, XPS or SWF). Make sure
you have all the Fonts installed on your machine you’re using to print Word document using XpsPrint API. I would suggest you please read the
following articles:
https://docs.aspose.com/words/net/specifying-truetype-fonts-location/
https://docs.aspose.com/words/net/using-truetype-fonts/
In case you are using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v14.4.0) from here and let us know how it goes on your side.

If
the problem still remains, please save the Word document into
XPS file format (see the highlighted code below) and print the XPS manually and share your finding.

To ensure a timely and accurate response please supply us with the following information, if you cannot supply us with this information we will not be able to investigate your issue and raise a ticket.

Please attach your input Word document
Please share the output XPS file (using the following highlighted code)
What environment are you running on?
OS (Windows Version)
Architecture (32 / 64 bit)
.NET Framework version

public static void Print(Aspose.Words.Document document, string printerName, string jobName, bool isWait)
{
    if (document == null)
        throw new ArgumentNullException("document");
    // Use Aspose.Words to convert the document to XPS and store in a memory stream.
    MemoryStream stream = new MemoryStream();
    document.Save(@"c:\temp\out.xps", Aspose.Words.SaveFormat.Xps);
    document.Save(stream, Aspose.Words.SaveFormat.Xps);
    stream.Position = 0;
    Print(stream, printerName, jobName, isWait);
}

MFGroup:

Also, I have read that window is now not recommending to use XPS API to print documents anymore, Is there anything else available that can used to print document via window service?

Please check the reason of XPS printing in Windows Service application here:
https://docs.aspose.com/words/net/print-a-document-programmatically-or-using-dialogs/
It would be great if you please share the article/web link about this
query. We will then provide you more information about your query.

Hi there,
We are experiencing this same issue at a customer site. We have also written a Windows service that uses AsposeWords to convert Word documents into XPS for printing by the XpsPrint API. Some letters are missing in the printed output. These are typically capital letter characters in the title areas of letters where a bolded or larger font style is used. E.g. the capital letters in names and street addresses. Robert Downey Junior might print out as " obert owney Junior".
I’m interested to know if this issue was resolved?
It is intermittent for our customer and generally works for a few months then starts exhibiting this behaviour after which point only a reboot of the web server seems to rectify it again.

@simonb2,
Thanks for your inquiry. Please try latest version of Aspose.Words for .NET 18.2. Hope this helps you.
If you still face problem, please attach the following resources here for testing:
Your input Word document.
Please attach the output XPS file that shows the undesired behavior.
As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.
PS: To attach these resources, please zip and upload them.

We had the same issue and eventually found this.
https://marc.durdin.net/2012/08/when-characters-go-astray-diagnosing-missing-characters-when-printing-with-ie9/
And the eventual solution too.
https://support.microsoft.com/en-nz/help/2853777/some-text-is-not-printed-when-you-print-multiple-documents-that-use-th