How to Convert a Letter size Word Document to A4 Size PDF and vice versa using c#

HI

I have a printer paper tray which is A4 size tray , i need to print a letter size word document with an image in it to A4 size page.
my question is how can i convert a letter size page format word document to A4 size pdf document layout using this aspose .

how do we scale the document?. Is there a way in aspose?.
ie: A4 <-----> Letter
A3 <-------> Ledger

Please add the code snippet for me to understand.

@developerxerox

Following code example shows how to change paper size of document and save the final document to PDF. You can call Document.Print method after changing the paper size. Hope this helps you.

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

tahir.manzoor How do we identify the input docx is a4 size or respective size?.

lets say

if( my input doc is a4)
{
pagesize = letter;

}
else if ( my input doc is A3)
{
pagesize = ledger
}

@developerxerox

Please note that a valid Word document can contains multiple Sections. A word document can has different paper size for different/each page.

You can use following code example to check the paper size of first section.

Document doc = new Document(MyDir + "input.docx");
if (doc.FirstSection.PageSetup.PaperSize == Aspose.Words.PaperSize.A4)
{
    //Your code...

}
else if (doc.FirstSection.PageSetup.PaperSize == Aspose.Words.PaperSize.A3)
{
    //Your code...
}