Free Support Forum - aspose.com

PDF Printing using Aspose.Pdf.Kit and PdfViewer

When I print to the default printer using the viewer.PrintDocument command, the result is an image that appears to be zoomed in at about 500%, (the print only contains the upper left hand corner of the file). When I print using viewer.PrintDocumentWithSetup, the resulting print cuts off a very samll amount of the right hand side of the PDF file. Is there a way to print this item correctly in PDFKit? I have looked thru this forum and found other printing issues, but not this one. Thank you for any help.

Jeff

Hi,

Thank you for considering Aspose.

Can you please send us the document that you are having problems with so that we ca more accurately determine the cause of the problem.

Thanks.

Hi Adeel-

How can I send you a private attachment?

Thanks,

Jeff

Hi,

You can send the files at adeel.ahmad@aspose.com

Thanks.

Hi,

When using the PrintDocumentWithSetup function you should set all margins to 0 to get the correct print.

However if you don't want to have the use the setup dialog then the same result can be achieved with the following code:

System.Drawing.Printing.PrinterSettings prs = new System.Drawing.Printing.PrinterSettings();

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings(prs);
pgs.Margins.Bottom = 0;
pgs.Margins.Top = 0;
pgs.Margins.Left = 0;
pgs.Margins.Right = 0;
pgs.PaperSize = new System.Drawing.Printing.PaperSize("Letter",850,1100);

viewer.PrintDocumentWithSettings(pgs,prs);

Thanks.

Thank you again for such a quick response! I printed both ways you suggested, but I got the same results as before. If you look at page 1 of the pdf I sent to you, you will see a vertical line running down the right side page. Even the right parenthesis (after the word Transfer) is printed on the page, but the line is not. Any other ideas?

Thank You,

Jeff

Hi,

I have not been able to reproduce the error that you report. I have printed the document to the Microsoft Office Document Image Writer and am attaching the output for your inspection.

Thanks.

I was able to solve the problem (so far) by using the above code and reducing the size of the page. The entire PDF file then printed.