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

Free Support Forum - aspose.com

Setting Print options while creating PDF file

We are generating PDF files in our application and expect user open the pdf file in any PDF reader (like adobe) and print it. As the file will have bar codes which are going to scanned we want to set the default Page Sizing & Handling print option as “Actual size” (please refer Attached screenshot).


I tried
1. PdfContentEditor
editor.ChangeViewerPreference(ViewerPreference.CenterWindow);
2.PdfViewer
viewer.AutoResize = false;
3. DocumentInfo
inDoc.PageMode = Aspose.Pdf.DOM.PageMode.UseNone;

none of this seems to be working.

Appreciate your help in this matter


Hi Krishna,


Thanks for your inquiry. Please use AutoResize and AutoRotate together. Hopefully it will help you to accomplish the task. If issue persist then please share a sample PDF document, so we will look into it and will provide you more information accordingly.

viewer.AutoResize = false;
viewer.AutoRotate = false;


Please feel free to contact us for any further assistance.

Best Regards,

Thank you for your response, I tried that option and it din’t fix the problem. You can use any pdf file as input parameter


1. Open any PDF file (input.pdf) and set Print page size option to “Shrink Oversized pages”. (refer attached file fr screenshot)
2. Call the following function with “input.pdf” as input parameter
3. Open “output.pdf” file check print page size option it is still set to “Shrink Oversized pages”. We are expecting “Actual size” instead.

public static void SetPrintproperties(string inFile)
{
Document doc = new Document(inFile);
PdfViewer viewer = new PdfViewer();
viewer.BindPdf(doc);
viewer.AutoResize = false;
viewer.AutoRotate = false;
doc.Save(“output.pdf”);
}

Hi Krishna,


Thanks for contacting support.

The option to print the PDF file using Actual Size is related to PDF viewing application and I am afraid its not related to PDF specifications. The PDF files generated with Aspose.Pdf are built on top of Adobe PDF Specifications and it cannot control the options/features being offered by PDF viewing applications. However, you can specify the page size when Printing the PDF file and as you have stated above, you can set PdfViewer.AutoResize to false, in order to force PDF printing with page dimensions specified using PaperSize property of PageSettings class. Please visit the following link for further details on Printing PDF File to Default Printer using Printer and Page Settings (Facades)

In the event of any further query, please feel free to contact.