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

Free Support Forum - aspose.com

Table is not rendering correctly in PDF

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,


Thanks for your inquiry.

Can you please attach your document and code for testing?

Thanks,

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);

Hi Banshri,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 11.1.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system as WORDSNET-6057. Your request has been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best Regards,

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 your inquiry.

First of all, I would suggest you please read the following article on How Aspose.Words Uses True Type Fonts during rendering to PDF format:
http://docs.aspose.com/display/wordsjava/How+Aspose.Words+Uses+True+Type+Fonts

Secondly, could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

Thanks for the link.

Its the same file i attached before.I am attaching it again.

Hi Banshri,


Thanks for your inquiry. I am afraid, I was unable to find any font difference during rendering to PDF on my side. It would be good if you could give a comparison as to how you are expecting your fonts to be rendered like (even a screenshot of the output will suffice).

Best Regards,

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.

Hi Banshri,

Thanks for your inquiry.

The point here is, when you render documents to fixed-page formats e.g. PDF, Aspose.Words requires TrueType fonts to be installed on your Linux system. Please see the following workarounds:

  1. Please ensure, if the desired fonts are installed on your Linux machine?
  2. As some document formats such as DOCX can contain embedded fonts, please try to embed Arial among the fonts embedded in the original document.
  3. 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");


Moreover, I would suggest you please read the following article on How-to: Install True Type Fonts on Linux:
http://docs.aspose.com/display/wordsnet/How+to++Install+True+Type+Fonts+on+Linux

I hope, this will help,

Best Regards,