PDF Printing should default to A5 paper size

Hello there

I am converting Aspose Word to PDF. On Printing Word to PDf, it defaults to A4 paper size but i want, it should be default to A5 paper size… Is that feasible…How could i achieve this???

Thanks in Advance…

Hi Deepak,

Thanks for your inquiry. Please use the following code snippet to set the page size to A5. The PageSetup class represents the page setup properties of a section. PageSetup object contains all the page setup attributes of a section (left margin, bottom margin, paper size, and so on) as properties. You can get the Paper size by PageSetup.PaperSize property. Please read the list of paper sizes from here:
https://reference.aspose.com/words/net/aspose.words/papersize/

Hope this helps you. Please let us know if you have any more queries.

Document doc = new Document(MyDir + "in.docx");
foreach (Section section in doc.Sections)
{
     section.PageSetup.PaperSize = Aspose.Words.PaperSize.A5;
}
doc.Save(MyDir + "out.pdf");

Hi Tahir

Thanks for the reply… But i want that if someone prints the output pdf then page setup is defaulted to A5. Is that feasible that we can set the properties of a print layout dynamically.

Hi Deepak,

While printing the PDF document, you can specify the size of document being printed i.e. In adobe reader, open the PDF file and select File → Print… option. Press Page Setup… button and select the page size from size drop down.

Furthermore, please note that we have a component named Aspose.Pdf for .NET which supports the feature to create as well as manipulate existing PDF files. It also offers the feature to print the PDF files and you can also specify the size of printing document. For further information, please visit Printing PDF to an XPS Printer (Facades)

Thanks for the quick reply.

While
printing the PDF document, you can specify the size of document being
printed i.e. In adobe reader, open the PDF file and select File ->
Print… option. Press Page Setup… button and select the page size from
size drop down.

I Know the above thing but the client wants it dynamically.

So just want to know that the same thing can be achieved using Aspose.Words for .Net

Hi Deepak,

Thanks for your inquiry. You can not set page setup setting of output Pdf file by using Aspose.Words.

Please note that Aspose.Words mimics the same behavior as MS Word do. If you convert your document to Pdf by using MS Word, you will get the same output.

deepakleo2003d:
But i want that if someone prints the output pdf then page setup is defaulted to A5. Is that feasible that we can set the properties of a print layout dynamically.

However, you can print the document with paper size as A5 by using following code snippet. If you want to print the output Pdf file generated via Aspose.Words with paper size A5, please use Aspose.Pdf to achieve this. Please read following documentation link for your kind reference.

Printing PDF File to Default Printer using Printer and Page Settings (Facades)

Document doc = new Document(MyDir + "in.docx");
foreach (Section section in doc.Sections)
{
     section.PageSetup.PaperSize = Aspose.Words.PaperSize.A5;
}
doc.Print();