Free Support Forum - aspose.com

Printing a PDF to a laser lineprinter in a wide pagesize fails

Hi, I need to print package labels from a pdf document. The papersize of the PDF is Width = 13.96 and the height 3.99

The height and widt are not the problem these are adjusted nicely. However the text of the labels is shifting of the page. See atached xps file and the correct pdf input file.

This is how my code looks

viewer.PrinterJobName = DocName;
viewer.AutoResize = false;
viewer.AutoRotate = false;
viewer.PrintPageDialog = false;

System.Drawing.Printing.PrinterSettings ps = new System.Drawing.Printing.PrinterSettings();
System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
System.Drawing.Printing.PrintDocument prtdoc = new System.Drawing.Printing.PrintDocument();

pgs.PaperSize = new System.Drawing.Printing.PaperSize("Custom", Convert.ToInt16(this.pageWith * 100), Convert.ToInt16(this.pageHeight * 100));
pgs.Margins = new System.Drawing.Printing.Margins(Convert.ToInt32(leftMargin * 100),Convert.ToInt32(rightMargin * 100), Convert.ToInt32(topMargin * 100),Convert.ToInt32(bottomMargin * 100));

ps.PrinterName = "Microsoft XPS Document Writer";
ps.PrintToFile = true;
ps.PrintFileName = @"d:\Temp\opan300.xps";
viewer.PrintDocumentWithSettings(pgs, ps);

I've tried the other options such as

viewer.AutoResize = true; This makse the characters incredible small (6 pts or so)
viewer.AutoRotate = true; Printed the report landscape and we don't want that.

Basically We need to print an exact copy of the PDF.

Any help on this issue is appriciated.

Ron

Anybody out there?

Hi Ron,


Thanks for using our products. I
have tested the scenario where I have used the following code lines to set the page margin and size and I am able to reproduce the same problem. For the
sake of correction, I have logged it in our issue tracking system as
PDFNEWNET-34677. We
will investigate this issue in details and will keep you updated on the status
of a correction.

pgs.PaperSize = new
System.Drawing.Printing.PaperSize(“Custom”, Convert.ToInt16(13.96

  • 100), Convert.ToInt16(3.99 * 100));<o:p></o:p>

pgs.Margins = new System.Drawing.Printing.Margins(Convert.ToInt32(1 * 100), Convert.ToInt32(4 * 100), Convert.ToInt32(.5 * 100), Convert.ToInt32(2 * 100));


We apologize for your inconvenience.

Hi Ron,

In reference to above reply, we have noticed that this issue caused due to margin setting, Please keep margin values to minimum to get desired results, especially right and left margin. We have used following margin values for producing attached document. Hopefully it will serve the purpose.

//pgs.Margins = new System.Drawing.Printing.Margins(Convert.ToInt32(leftMargin * 100), Convert.ToInt32(rightMargin * 100), Convert.ToInt32(topMargin * 100), Convert.ToInt32(bottomMargin * 100));

pgs.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWNET-34677) have been fixed in Aspose.Pdf for .NET 7.8.0update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.