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

Free Support Forum - aspose.com

Need help for Word to PDF convertion

I download the last version of Aspose.Words for evaluation.

Here is the code to convert DOC file to PDF, I'm using the VS2010 and Net 4.0:

Aspose.Words.Document doc = null;

try

{

doc = new Aspose.Words.Document(infile);

doc.Save(outfile);

}

catch (Exception ex)

{

string er = ex.Message;

throw ex;

}

finally

{

doc = null;

}

infile is Word 2003 and outfile is the file name end with .pdf. The table in Word file was created in seperate sub template and then insert into the main template.

The issue is that the PDF result is not equal to the Word version. I attached the original Word + final Word + final PDF.

Thanks inadvance.

Hi

Thanks for your request. Please try calling UpdateTableLayout method before saving the document to PDF:

http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.document.updatetablelayout.html

Hope this helps.

Best regards,

Thanks Alexey. It works on my case.

I have another issue related with the table when converting from DOC to PDF.

Here is what I do:

- Load the Original Template.doc, replace the mail merge fields in the that doc.

- Save it as PDF (to PDF Result.pdf) and DOC (DOC Result.doc)

Looks at the table inside the result, the DOC result came out correctly, but the PDF result was not correct, so it came out as 2 pages.

Here is the code to save out the results:

master.UpdateTableLayout();

master.UpdateFields();

//save to PDF

master.Save(p_SavePath, Aspose.Words.SaveFormat.Pdf);

master.Save(p_SavePath.Replace(".pdf", ".doc"), Aspose.Words.SaveFormat.Doc);

I've attached all 3 files so that you can see.

Thanks,

Tom

Hi

Thanks for your request. Unfortunately, I cannot reproduce the problem on my side. I used the latest version of Aspose.Words for testing. You can download it from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Here is my code:

Document doc = new Document(@"Test001\Original+Template.doc");

doc.UpdateTableLayout();

doc.UpdateFields();

// Save output.

doc.Save(@"Test001\out.doc");

doc.Save(@"Test001\out.pdf");

Best regards,