I have a similar issue.I am using Aspose Word 11.1.0 for Java
If I open WordML doc and save it and run Aspose the conversion to PDF works perfect.But i do not want that.
The table in the document has multiple Header,so the 1st header take the width of the first column.
I tried using
table.autoFit(AutoFitBehavior.AUTO_FIT_TO_WINDOW);
But dint the expected results.
I have the cellFormating also set to auto,still am not sure why the PDF does not come out correctly without opening the document and saving it manually.
Hi there,
I have attached the documents.
The code I m using is:
NodeCollection allTables = doc.getChildNodes(NodeType.TABLE, true);
int i=allTables.getCount();
for(int x=0;x<i;x++)
{
Table table=(Table)allTables.get(x);
if (table.getParentNode().getNodeType()== NodeType.BODY)
{
table.autoFit(AutoFitBehavior.AUTO_FIT_TO_WINDOW);
}
}
doc.updatePageLayout();
doc.updateFields();
doc.save(“test.pdf”, SaveFormat.PDF);
Thanks.
One more thing there is a font change when the .doc is converted to .pdf.
Is this a known issue?or is there is a solution for this?
Thanks,
Banshri
Hi Banshri,
Thanks for the link.
Its the same file i attached before.I am attaching it again.
Hi Banshri,
This is how it should look.This is one is locally running on my computer.
Where as the zip folder is an example of the same running on Linux server.
- Please ensure, if the desired fonts are installed on your Linux machine?
- As some document formats such as DOCX can contain embedded fonts, please try to embed Arial among the fonts embedded in the original document.
- Instead of default location, if your font is located in some other directory, then you have to specify the location of the directory that contains the fonts. Please see the following code snippet:
Document doc = new Document(MyDir + "Rendering.doc");
// Set fonts to be scanned for under the specified directory. Do not search within folders nested this folder.
FontSettings.SetFontsFolder(@"C:\MyFonts\", false);
doc.Save(MyDir + "SetFontsFolder Out.pdf");