I’m creating 11x17 documents. When I render a print through the application, only about half of the document prints and the allignment is totally off, but when I save the document and print from Word, it comes out as expected. Is this a known issue or is there a parameter I may be missing. I have already tried to change the printer configuration thinking that may be the issue. Since it prints fine from a saved document, that makes me think I am overlooking something in my application.
Hi
Thanks for your request. Could you please attach your document here for testing? We will check the issue and provide you more information.
Also, please make sure you are using the latest version of Aspose.Words. As I remember there were problems with printing documents with custom page size, but these problem were resolved few releases ago. So please try using the latest version. You can download it from here:
https://releases.aspose.com/words/net
Best regards,
I have upgraded to version 10.2 and still having the issue. The attached document has 4 columns for text and an anchored text box. When rendering the print from the app, half of column 2, all of column 3 and four, and the anchored text box print but it is all shifted to the left of the document. The printer is new and all of the drivers are up to date. I have created legal size and 8.5 x 11 documents and there haven’t been any issues with those. All documents have been mail merge with regions and multiple tables but the 11 x 17 is the only one I have a problem with.
Hi
Thank you for additional information. Does the problem occur only when you print on paper? Have you tried printing the document to file, for example using XPS printer? I ask because when I print the document to XPS it looks fine.
Best regards,
I had the application save it to Word, opened it and submitted a print from there and all works fine. I’m only having an issue when I render the print straight from my application. The application is designed to automate our member statements, some of which are on legal size paper and some on 11 x 17. The legal size renders the print fine but not 11 x 17
Hi
Thank you for additional information. Could you please create and attach a sample application that will allow me to reproduce the problem? I will check it on my side and provide you more information.
Best regards,
I’m sending everything needed to run. It was created in visual studio 2010 and the sql server config, file path setup, and the print/save function, etc. is all in Developer.cs. I’m also sending a dummy database back up file with five records in it and the docx template. I compiled and ran it already so you shouldn’t have any problems.
Hi
Thank you for additional information. I run your code and printed the output document to file (see the attached XPS document). As I can see the output looks as expected.
Have you tried printing your document to file (for testing)? I used the following code to print it:
doc.Print("Microsoft XPS Document Writer");
Could you please try the same on your side and attach the resulting file?
Best regards,
That is working fine for me too when going to some type of file. Attached is the output.
Hi Troy,
Thanks for your inquiry.
I printed your document on my side I was able to reproduce the issue on my side using Aspose.Words, but I’m afraid the same issue also occurs when printing from MS Word. The is down to the page size of the document being too large for my printer, the page will be clipped regardless.
Have you tried printing on a different machine/printer to try discover if this issue is printer or Aspose.Words related?
Thanks,
The printers I’m using are the only ones set up for these types of documents. We have some older printers that used to produce them but those are being taken out so I have no others to print to. Since mine works fine when printing from word and not my application, it led me to believe it is Aspose. Is there a chance that a different driver may be needed for the printer to handle the automated printing from applications?
Hi Troy,
Thanks for this additional information.
I’m afraid it’s hard to know where exactly things are going wrong. It could also be a problem with .NET. Please try using the code below which will attempt to print an image to the printer of the size of your document without using Aspose.Words. Does this work properly?
mImage = Image.FromFile(dataDir + "Image.jpg");
PrintDocument printDoc = new PrintDocument();
printDoc.OriginAtMargins = true;
printDoc.DefaultPageSettings.Landscape = true;
printDoc.DefaultPageSettings.PaperSource.RawKind = doc.FirstSection.PageSetup.FirstPageTray;
printDoc.PrintPage += printDoc_PrintPage;
printDoc.Print();
public static void printDoc_PrintPage(object sender, PrintPageEventArgs e)
{
double cmToUnits = 100 / 2.54;
e.Graphics.DrawImage(mImage, 0, 0, (float)(43.17 * cmToUnits), (float)(27.94 * cmToUnits));
}
Thanks,
It was closer but the margins are off and the print quality is not good.
Hi Troy,
Thanks for this additional information
Does that mean the entire page was printed using that test code? Was any portion cut off?
Since you mentioned that XPS output looks correct you may also want to try using the XpsPrint API instead. Please see the article here for details: https://docs.aspose.com/words/net/print-a-document-programmatically-or-using-dialogs/
Please let us know how you go.
Thanks,
The XpsPrint API is working well. Thank you for all your help.