Page 1 of 1

The .pdf file its different from source file.

PostPosted: Wed Mar 18, 2015 7:30 am
by sunils
Im using a .docx file with a page size of 100mmx70mm with a table on it as its show in the following image.

Image

It has some content controls from MicrosoftWord 2013 in the cells that will be replaced for some parameters inserted by using the library.

However somehow the .pdf file comes divided in 3 pages and not like a single table as the source file.

Any explanation for that? It appers that i cannot change the page size to small ones or the document will be divided in multiple pages.

Here are the evidences of the switch.

Image

Re: The .pdf file its different from source file.

PostPosted: Wed Mar 18, 2015 8:36 am
by jason
You didn't attach the docx in question.

Re: The .pdf file its different from source file.

PostPosted: Wed Mar 18, 2015 8:40 am
by sunils
Im sorry Jason im new in the forum there its the .docx

Re: The .pdf file its different from source file.

PostPosted: Wed Mar 18, 2015 11:06 pm
by jason
When I tried your docx through docx4j's PDF output, the last row appeared on the next page.

It looks like this might be because some spacing is added before the paragraphs in the table rows; or it appears there might be a difference in the calculation of the top margin.

For what its worth, the new commercial PDF outputter gets it right; you can try it at http://webapp.docx4java.org/OnlineDemo/docx_to_pdf.html

Re: The .pdf file its different from source file.

PostPosted: Thu Mar 19, 2015 12:27 am
by sunils
Thanks for your advice Jason, im wondering, is there any way that i can get the same output that the "High fidelity docx to PDF output/conversion" manage to generate. Since yours its getting it right, seems like im doing something wrong or missing some things.

I made a new document, with new dimensions in the table that ill attach. Just like you said the commercial demo does it right. However mine its splitting it into 3 pages.

Check the attachments u can see the massive split. I wish there is something i can do to solve that issue.

Re: The .pdf file its different from source file.

PostPosted: Fri Mar 20, 2015 5:43 pm
by jason
You can get the same output that the "High fidelity docx to PDF output/conversion" generates, by purchasing a license ;-)

The approach it takes is completely different to docx4j's existing XSL FO based approach.

You can of course look at the docx4j source code, identify what is going wrong in your case, and fix it. I'm afraid I don't have the time/inclination to do that for you right now.