We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document Conversion Issue

Hi,

We are using Aspose.Words and Aspose.Cells components for one of our web applications. We are creating a document export in Word. If the user wants a pdf version, we are using the Aspose API to export a pdf version. Here is the code that does the conversion.

if (szExportType == "PDF")

{

MyDoc.SaveOptions.ExportImagesFolder = context.Server.MapPath("~/temp");

if (!Directory.Exists(MyDoc.SaveOptions.ExportImagesFolder))

Directory.CreateDirectory(MyDoc.SaveOptions.ExportImagesFolder);

// Save the DOC file as Aspose.Pdf.Xml in memory.

MemoryStream xmlDoc = new MemoryStream();

MyDoc.Save(xmlDoc, Aspose.Words.SaveFormat.AsposePdf);

xmlDoc.Position = 0;

// Read the document into Aspose.Pdf.

Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

pdf.BindXML(xmlDoc, null);

// Instruct Aspose.Pdf to delete temporary image files.

pdf.IsImagesInXmlDeleteNeeded = true;

// Produce the PDF file.

pdf.Save(szFileName + ".pdf", Aspose.Pdf.SaveType.OpenInAcrobat, context.Response);

}

Most of the conversion works well. However, we are seeing that some formatting of table cells is not working well. The text gets shifted or the margin is changed. I have attached a zip file that shows an example of this. Here are a couple of problem areas:

pdf doc - page 2 - several examples of the text in cells not being placed at the correct place (cell to left of cell that has the text 30037Z and cell to left of cell that has the text 10480X). You can check in the Word doc and see that it is correct there.
pdf doc - page 11 - notice that the cell that says "Specimen Requirements" has different margins than the other cells. You can check in the Word doc and see that it is correct there.

Any help on how to fix this issue is appreciated.

With best regards,


Scott Butler

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

Thanks for your request. It seems that problems are already fixed in the latest version of Aspose.Word sand Aspose.Pdf. I use Aspose.Words 6.1.0 and Aspose.Pdf 3.9.0 for testing. You can download the latest versions from here:

http://www.aspose.com/community/files/51/file-format-components/aspose.words-for-.net-and-java/entry163323.aspx

http://www.aspose.com/community/files/51/file-format-components/aspose.pdf-for-.net-and-java/entry151891.aspx

Also note, the latest version of Aspose.Words supports direct conversion to PDF (Without using Aspose.Pdf). You can try using this method in your project. Please see the following link to learn more:

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/aspose.words.document.savetopdf_overloads.html

Best regards.