Free Support Forum - aspose.com

Word to PDF- configure left margin

HI,


I am trying to convert a word to pdf, but the margin of the words is not capture properly in the pdf.

The font in the pdf is also smaller than the words. is there a way to set so that they will look exactly the same when converting words to pdf.

kindly refer to attached docs and pdf.

below is the code i used

Aspose.Words.DocumentBuilder builder = new Aspose.Words.DocumentBuilder();
builder.PageSetup.PaperSize = Aspose.Words.PaperSize.A4;
builder.PageSetup.RightMargin = 72;
builder.PageSetup.LeftMargin = 72;
builder.PageSetup.TopMargin = 14;
builder.PageSetup.BottomMargin = 19;
builder.PageSetup.FooterDistance = 0;

string a = “out” + DateTime.Now.ToString(“ddMMyyyymmss”) + “.doc”;
builder.Document.Save(@“c:\temp”+ a);
Aspose.Words.Document documenta = new Aspose.Words.Document(@“c:\temp” + a);
Aspose.Words.DocumentBuilder builderpdf = new Aspose.Words.DocumentBuilder(documenta);

builderpdf.PageSetup.PaperSize = Aspose.Words.PaperSize.A4;
builderpdf.PageSetup.RightMargin = 72;
builderpdf.PageSetup.LeftMargin = 72;
builderpdf.PageSetup.TopMargin = 14;
builderpdf.PageSetup.BottomMargin = 19;
builderpdf.PageSetup.FooterDistance = 0;
builderpdf.Document.Save(@“c:\temp\out” + DateTime.Now.ToString(“ddMMyyyymmss”) + " .pdf");
documenta.UpdateTableLayout();
documenta.Save(@“c:\temp\123out” + DateTime.Now.ToString(“ddMMyyyymmss”) + " .pdf");

Hi John,


Thanks for your inquiry. Please note that Aspose.Words’ page layout engine tries to mimic the way the Microsoft Word’s page layout engine works. To you, this means that if you convert a Microsoft Word document into PDF, XPS or print it using Aspose.Words, the output will appear almost exactly as if it was done by Microsoft Word. To confirm this, I have attached a couple of PDF documents here for your reference. You can see that the Fonts as well as the Margins are same in both documents. If we can help you with anything else, please feel free to ask.

Best regards,

Hi Aspose,


I realized that after I change the printing settings in my computer
- scaling : No scaling
- size : to actual size instead of previously “Fit to size”,

the printing looks ok. I would like to check if it is possible to configure these two options when converting from docs to pdf?

Thanks
Regards

Hi John,


Thanks for your inquiry. If I understand you correctly, you can use PdfSaveOptions.ZoomBehavior and PdfSaveOptions.ZoomFactor properties to adjust the viewing experience in your PDF reader as follows:

Document
doc = new Document(@“C:\Temp\out250220132645.doc”);

PdfSaveOptions saveOptions = new PdfSaveOptions();

saveOptions.ZoomBehavior = PdfZoomBehavior.ZoomFactor;

saveOptions.ZoomFactor = 10;

doc.Save(@"C:\Temp\out.pdf", saveOptions);


Please let me know if I can be of any further assistance.

Best regards,