Having issue with table in pdf

Hi,
I am using licensed version of Aspose word for creating word doc and pdf.
Tables in the generated word doc are being displayed correctly but in the generated pdf it not displayed correctly. text in the table cells are cutting at the bottom edge of the cell in the table.
Another issue with table I am facing is if any row is wide and page breaks and content of rows spans to the next page in that case in the next page it merges all the cells for particular low to a single/double cell.
Please help me.
Regards,
Arunendra

Hello

Thanks for your inquiry. Could you please attach your input and output documents here for testing? We will check the problem on my side and provide you more information.
Best regards,

Hi Andrey,
Can you please provide your mail id so that I can share the documents with you. these documents are the confidential, It would be not wise to share it on forum.
Regards,
Arunendra

Hi Arunendra,

Thanks for your inquiry. It is safe to attach files in the forum. If you attach your document here, only you and Aspose staff members can download it. Also you can send the file to my e-mail as described here:
https://forum.aspose.com/t/aspose-words-faq/2711
Best regards,

Hello

Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (4.0.2). I use the following code for testing:
Please see the code example:

Document doc = new Document("C:\\Temp\\ GeneratedDoc.doc");
doc.saveToPdf("C:\\Temp\\out.pdf");

I send the output PDF to your e-mail.
Could you please create simple application which will allow me to reproduce the problem on my side?
Best regards,

Hi Andrey,
I have not received the documents generated by you at your end. Please resend it.
I have shared you 3 documents. one is word template from which we are dynamically generating word doc and opening the modified content in PDF.
For this i have created a web based application that is opening the generated word doc/ PDF as desired by user at the browser of the user.
I am storing the word template at some location from where my application reads the template and replaces the token in the template and opening the content in either word/DF at the client browser.
I am not saving the generated documents any ware.
Application is opening the word and PDF at the client browser. We are ok with word but in PDF data in table are not displayed properly in table cells.
Regards,
Arunendra

Hello

Thank you for additional information. I use the following code for testing:

// Open template
Document doc = new Document("C:\\Temp\\Template.doc");
// Execute mail merge.
doc.getMailMerge().execute(new String[]
{ "DealName",
"DynamicEquityStepsHtmlText",
"Approver1",
"ApprovedBy1",
"ApprovalDate1",
"TimeApproved1",
"Comment1",
"eBoardroomApprovalStatus",
"eBoardroomNumber"
},
new String[]
{ "TestName",
"TestDynamicText",
"TestApprover1",
"TestApprovedBy1",
"TestApprovalDate1",
"TestTimeApproved1",
"TestComment1",
"TesteBoardroomApprovalStatus",
"TesteBoardroomNumber"
});
// Save output.
doc.save("C:\\Temp\\out.pdf");

I send the output PDF to your e-mail.
Best regards,

Hi Andrey,
I found the solution of my problem.
Thanks for help.
Regards,
Arunendra

Hi Arunendra,

It is perfect, that you already found solution.
Please let me know in case of any issues. I will be glad to help you.
Best regards,

Hi Andrey,
Back to you with another issue.
I am using Tomcat as web server in my local environment. following line code is used to open the template in word and PDF respectively.

doc.save(response.getOutputStream(), SaveFormat.DOC);
doc.save(response.getOutputStream(), SaveFormat.PDF);

In local it is opening the documents perfectly fine in both the formats .
But when I am deploying the war in test environment on SunOne application server same code is opening the word doc but not opening the PDF.
It opening the Adobe Acrobat with error message unable decode file.
When we are saving this file it saved as zero file size.
Please help me solve the issue.
Regards,
Arunendra

Hi
Thanks for your request. Does Aspose.Words throw some exception upon saving document to PDF? If so, could you please provide a stack trace of the exception? Also, does the problem occur with all documents or only with some particular document?
Best regards,

Hi Andrey,
It is giving the following exception on the server

Exception: java.lang.NullPointerException

It is happening with all the documents.
Do we require the Adobe Acrobat to be installed on server?
Sun one application server is on the UNIX box.
Regards,
Arunendra

Hi

Thank you for additional information. Aspose.Words is independent from Adobe Acrobat, and its settings also cannot affect Aspose.Words.
I think in your case you should just specify TrueTypeFontDirectory and this directory should contain fonts, which are using in your document. At least this folder should contain one valid TrueType font. Please try creating folder, put there few valid MS TrueType fonts (Arial and Times New Roman, for example) and specify this folder as TrueTypeFontDirectory. Please let me know if this helps.

Document doc = new Document("yourDoc.docx");
PdfOptions opt = new PdfOptions();
opt.setTrueTypeFontsFolder("C:\\WINNT\\Fonts");
doc.saveToPdf(0, doc.getPageCount(), "out.pdf", opt);

Also, please make sure that you application can read fonts from this folder.
Best regards,

Hi Andrey,
As I mentioned in my previous mail we have to deploy the application on Unix box.
opt.setTrueTypeFontsFolder(“C:\WINNT\Fonts”);
above statement accessing the path C:\WINNT\Fonts .
what path do I need to set for Unix environment.

doc.save(response.getOutputStream(), SaveFormat.PDF);

Above code is working perfectily fine on Windows box but when it not working in Unix box.
Regards,
Arunendra

Hi
Thanks for your request. In Unix environment you should specify folder that contains True Type fonts. TrueTypeFontsFolder should contain fonts, which are using in your document. At least this folder should contain one valid TrueType font. Please try creating folder, put there few valid MS TrueType fonts (Arial and Times New Roman, for example) and specify this folder as TrueTypeFontsFolder. Please let me know if this helps.
Also, please make sure that your application can read fonts from this folder.
Best regards.

Hi Andrey,
I have used the code suggested by you in local environment.

PdfOptions opt = new PdfOptions();
opt.setTrueTypeFontsFolder("C:\\WINNT\\Fonts");
doc.saveToPdf(0, doc.getPageCount(), response.getOutputStream(), opt);

It is not opening the pdf.
giving the error as attached in the screen shot.
Regards,
Arunendra

Hi

Thanks for your request. Please try creating some folder yourself, put there few valid MS TrueType fonts (Arial and Times New Roman, for example) and specify this folder as TrueTypeFontDirectory.

opt.setTrueTypeFontsFolder("E:\\User\\YourFolderWithFonts");

Best regards,

Hi Andrey,
Now code shared by you is working in my local environment.
Regards,
Arunendra