Word to PDF conversion margin problem

Hi.

We are facing a problem during the delivery of a
proof-of-concept project from which depends the purchase - or not - of
the Aspose.PDF and Aspose.Words packages.

The problem is that while printing the attached Word document, the resulting PDF goes outside the expected margins.

What can we do to correct this behavior?

The code used to print is the following.

MemoryStream m = new MemoryStream(ssDocument);
Document doc = new Document(m);

// Save document in the intermediary XML format to memory stream.
MemoryStream xmlStream = new MemoryStream();
doc.Save(xmlStream, SaveFormat.AsposePdf);
// Seek to the beginning so it can be read by Aspose.Pdf
xmlStream.Seek(0, SeekOrigin.Begin);

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
// Make sure the images that were saved by Aspose.Word into Windows temporary
// folder are automatically deleted by Aspose.Pdf when they are no longer needed.
pdf.IsImagesInXmlDeleteNeeded = true;


// Cache TrueType fonts for petter perfomance.
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = Path.GetTempPath();
pdf.TextInfo.IsFontEmbedded = true;
pdf.TextInfo.IsUnicode = true;
// Load the XML document into Aspose.Pdf.
pdf.BindXML(xmlStream, null);
pdf.PageSetup.PageHeight = Aspose.Pdf.PageSize.A4Height;
pdf.PageSetup.PageWidth = Aspose.Pdf.PageSize.A4Width;

// Cache TrueType fonts for petter perfomance.
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = Path.GetTempPath();
pdf.TextInfo.IsFontEmbedded = true;
pdf.TextInfo.IsUnicode = true;
pdf.DefaultFontName = “Arial”;
pdf.SetUnicode();
// Now produce the PDF file.

MemoryStream o = new MemoryStream();
pdf.Save(o);
o.Seek(0, SeekOrigin.Begin);
ssPDF = new byte[o.Length];
o.Read(ssPDF, 0, (int)o.Length);



Best regards,

Paulo Tavares

Hello paulo,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

I have noticed that there were some blank lines at the end of bottom table and over the 2nd page, I have removed those blank lines, and the Pdf is being generated fine. I have attached the resultant Pdf and the modified word document, please take a look.

If it does not satisfy your query, please feel free to contact.