Printoption for pdf file

is there a way that I can set up some print option for the pdf file just like the PageSetUp class for excel file?

e.g

1. pagesize=Legal

2. page order=Landscape

Hi Jimmy,

Thanks for your inquiry. You can easily set the Page size and orientation option using PageSettings object. Please check following documentation link for the detail. Hopefully it will help you to accomplish the task.


System.Drawing.Printing.PageSettings pgs = new System.Drawing.Printing.PageSettings();

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

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

pgs.Landscape = true;

Please feel free to contact us for any further assistance.

Best Regards,

I have checked this doc, but there is a line code called

viewer.PrintDocumentWithSettings(pgs, ps). Then the process will pop up a save dialogue, is there anyway just save the print option?

Hi Jimmy,

Thanks for your feedback. Please check following documentation link to saving a print to XPS(soft printer) and hiding print dialog. Hopefully it will help you to accomplish the task.

Please feel free to contact us for any further assistance.

Best Regards,

actually what I want is just open the pdf file, change the print option and then save it. I need a pdf file which can preserve all my print option I want to set up when I open it and click the print button

Hi Jimmy,


Thanks for sharing the details.

As per my understanding, you need to set the page orientation and page size. If so is the case, then please follow the instructions specified over Update Page Dimensions.

In order to change page orientation to Landscape, please try using following code line.

[C#]
pdfDocument.PageInfo.IsLandscape = true;