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

Free Support Forum - aspose.com

PDF files are not printed correctly (black background)

Print the attached pdf file using pdfviewer class does not generate desired result, the background becomes black and part of the tables are not rendered.

Hi Yuan,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.Pdf for .NET.

I just tested your scenario with the following sample code and the resultant file is fine (Attached). Please download and try the latest version of Aspose.Pdf for .NET and if you still face the issue, please share your sample code with us and we will check it soon.

//create PdfViewer object

PdfViewer viewer = new PdfViewer();

//open input PDF file

viewer.OpenPdfFile(@"D:\AP Data\Source_Files\test.pdf");

//set attributes for printing

viewer.AutoResize = true; //print the file with adjusted size

viewer.AutoRotate = true; //print the file with adjusted rotation

viewer.PrintPageDialog = false; //do not produce the page number dialog when printing

//create objects for printer and page settings and PrintDocument

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();

//set printer name

ps.PrinterName = prtdoc.PrinterSettings.PrinterName;

//set PageSize (if required)

pgs.PaperSize = new System.Drawing.Printing.PaperSize("A4", 827, 1169);

//set PageMargins (if required)

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

//print document using printer and page settings

viewer.PrintDocumentWithSettings(pgs, ps);

//close the PDF file after priting

viewer.ClosePdfFile();

Thank You & Best Regards,

Thanks! It has been fixed. I was using version 6.3.