Converting word to PDF along with PageInfo

I have Aspose.words.dll only I need to convert word document to PDF along with Page Setup . For example if word document is Legal size then when I convert PDF should be in Legal size. My code Snippet to convert word to PDF . I dont have Aspose.Pdf.dll , please give me a solution

MemoryStream convertFromDataStream = null;
Document wordDocument = null;
MemoryStream asposePdfXmlStream = null;
byte[] pdfBytes = null;
// First we need to convert word processing data into PDF xml format
InitializeComponent();
convertFromDataStream = new MemoryStream(convertFromData);
asposePdfXmlStream = new MemoryStream();
wordDocument = new Document(convertFromDataStream);
wordDocument.Save(asposePdfXmlStream, saveFormat: SaveFormat.Pdf);
asposePdfXmlStream.Flush();
asposePdfXmlStream.Seek(0, SeekOrigin.Begin);
pdfBytes = asposePdfXmlStream.ToArray();

Hi Siva,
Aspose.Words for .NET renders the same page size as in the input document; if source document has ‘legal’ page size then output PDF will have the same size. I tested your code and it produces the same result.
If you want to change the page size or other properties, you can use PageSetup class for that purpose as you can see in the following code.

wordDocument = new Document(convertFromDataStream);
DocumentBuilder wordDocumentBuilder = new DocumentBuilder(wordDocument);
PageSetup pageSetup = wordDocumentBuilder.PageSetup;
pageSetup.PaperSize = PaperSize.Legal;

Please feel free to contact us in case you have further comments or questions.
Best Regards,