Print PDF document using Aspose.PDF for .NET - Page content is missing in printed document

hello experts,

when i use the follow code to print the pdf document Online Assessment 1 RM.pdf (1.2 MB)

, the page number disappear image.png (103.6 KB)
, how to set the Pdfviewer print to fit the page content.

        PdfViewer viewer = new PdfViewer();
        viewer.BindPdf(doc);
        //viewer.AutoResize = true;
        viewer.PrintPageDialog = true;
        viewer.PrintDocumentWithSettings(printerSettings);
        viewer.Close();

when i invoke the viewer.AutoResize = true, the page content resize and the page number also display, but the pdf layout is different with original, look like image.png (111.6 KB)

so, whether there are some API to set the pdf content fit the paper size when print not auto resize or background.

Look forward your reply, thks,

@TommyZhou

We used following code snippet with Aspose.PDF for .NET 20.6 and were unable to notice the issue that you have mentioned.

var viewer = new Facades.PdfViewer();
viewer.BindPdf(dataDir + "Online Assessment 1 RM.pdf");

viewer.AutoResize = true;
viewer.PrintAsImage = true;

var ps = new System.Drawing.Printing.PrinterSettings();
ps.PrinterName = "Microsoft Print to PDF";
            
viewer.PrintDocumentWithSettings(ps);
viewer.Close();

PrintedPDF.pdf (3.5 MB)

Would you kindly make sure to use latest version of the API and in case the issue still persists, please share the details about printer that you are using. We will further proceed to assist you accordingly.

PS: You can further try to set paper size and margins as well:

System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();
 // 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
ps.Copies = 1;
viewer.PrintDocumentWithSettings(pgs, ps);