Hello Team,
We have ASPOSE.Total license.
We are converting the Word document to PDF using aspose.word but the formatting like line space font space not preserved while conversion. It should be exactly the same as we see in word document. Below is the code we are using
var doc = new Aspose.Words.Document(sDocName);
doc.Save(path + "Output\\output.pdf");
We have used the ASPOSE.WORD 23.4 as well but this seems issue is still present.
We found a thread WORDSNET-12999 which supposed to be fix in the mentioned version.
output.zip (92.9 KB)
@Sudrashya your document contain invalid cell spacing, even MS Word app correct the visualization when you click in the table
After that automatic adjustment the pdf generated by MS Word app look the same that the generated by Aspose.Words API.
@Sudrashya
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-25247
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@eduardo.canal
Thanks for reply. We have created HTML file using Table structure and then converting HTML to word document and then after user editing we are converting it in PDF format.
We are using below code to convert in word file
Aspose.Words.Document document = new Aspose.Words.Document(new MemoryStream(Encoding.UTF8.GetBytes(content)));
foreach (Aspose.Words.Section s in document.Sections)
{
s.PageSetup.TopMargin = 10;
s.PageSetup.BottomMargin = 10;
s.PageSetup.LeftMargin = 50;
s.PageSetup.RightMargin = 10;
}
// table in the source HTML are too wide to fit the page.
// Fix this by autofiting the table to window.
foreach (Aspose.Words.Tables.Table t in document.GetChildNodes(NodeType.Table, true))
{
t.AutoFit(AutoFitBehavior.FixedColumnWidths);
}
document.Save(path + "Output\\output.doc");
Please let me know what to do to achieve the exact formatting in this scenario.
@Sudrashya We have reproduced the problem with table formatting upon conversion to PDF and logged it as WORDSNET-25247. We will keep you informed and let you know once the issue is resolved.
In general HTML is not the best format to start from, since Aspose.Words is designed to work with MS Word documents. HTML and MS Word documents are quite different and it is difficult and sometimes impossible to provide 100% fidelity after conversion from one format to another.
Please delete the screen shot(GIF) reference in your response.
@Sudrashya I have removed the GIF.
1 Like