Hello all,
I am having problems converting word 2003 documents with auto shapes to Pdf. Documents convert fine but layout of generated document does not match the original. Please see attached word document “sample.doc” and PDF “sample.pdf” and look at the space in PDF document below first autoshape. This extra space is throwing alignment off when generated PDF is superimposed on another image. I am using Aspose.words for .Net Version 5.1.0.0 and Aspose.PDF for .Net Version 3.6.2.0. Sample code to convert from word to PDF is as follows
string wordFileName = "c:\temp\sample.doc";
string pdfFileName = Path.Combine(Path.GetDirectoryName(wordFileName), Path.GetFileNameWithoutExtension(wordFileName) + ".pdf");
if (File.Exists(pdfFileName))
{
File.Delete(pdfFileName);
}
string licenseFileName = @"c:\temp\Aspose.Total.lic";
Aspose.Words.License wordLicense = new Aspose.Words.License();
wordLicense.SetLicense(licenseFileName);
Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
pdfLicense.SetLicense(licenseFileName);
Aspose.Words.Document wordDocument = new Document(wordFileName);
System.IO.MemoryStream asposePdfXmlStream = new MemoryStream();
wordDocument.Save(asposePdfXmlStream, SaveFormat.AsposePdf);
// Convert from PDF xml format to actual PDF
asposePdfXmlStream.Flush();
asposePdfXmlStream.Seek(0, SeekOrigin.Begin);
Aspose.Pdf.Pdf pdfDocument = new Aspose.Pdf.Pdf();
pdfDocument.CompressionLevel = 0;
pdfDocument.BindXML(asposePdfXmlStream, null);
pdfDocument.IsImagesInXmlDeleteNeeded = true;
pdfDocument.Save(pdfFileName);
MessageBox.Show("Converted Word File " + wordDocument + " to pdf " + pdfFileName);
Help me this is driving me up the wall
Thanks
Rao