opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.22k stars 372 forks source link

ODT --> PDF conversion error #102

Open matteomr opened 8 years ago

matteomr commented 8 years ago

Hi guys, I'm trying to convert my odt document to pdf with XDocReport (ODFDOM) converter. My document was generated with ODT with Freemarker method.

Unfortunately, the conversion is not successful and these are the error log:

org.odftoolkit.odfdom.converter.core.ODFConverterException: java.lang.RuntimeException: Not all annotations could be added to the document (the document doesn't have enough pages). at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:82) at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:43) at org.odftoolkit.odfdom.converter.core.AbstractODFConverter.convert(AbstractODFConverter.java:42) at fr.opensagres.xdocreport.samples.odt.converters.pdf.ConvertODTas400ToPDF.main(ConvertODTas400ToPDF.java:198) Caused by: java.lang.RuntimeException: Not all annotations could be added to the document (the document doesn't have enough pages). at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at org.odftoolkit.odfdom.converter.pdf.internal.stylable.StylableDocument.close(StylableDocument.java:380) at org.odftoolkit.odfdom.converter.pdf.internal.ElementVisitorForIText.save(ElementVisitorForIText.java:685) at org.odftoolkit.odfdom.converter.pdf.PdfConverter.processBody(PdfConverter.java:128) at org.odftoolkit.odfdom.converter.pdf.PdfConverter.doConvert(PdfConverter.java:65) ... 3 more Generate ODTBig.pdf with 3066 ms.

Some ideas?

Here my odt file: as400.zip

angelozerr commented 8 years ago

It seems that your ODT is complex. I will see your problem when I will find time.

matteomr commented 8 years ago

I hope to solve fast :-|

matteomr commented 8 years ago

Some news?

angelozerr commented 8 years ago

No times to try to fix your issue today.

matteomr commented 8 years ago

OK Angelo thanks for replying, I hope you can solve in the next few days.

matteomr commented 8 years ago

Hi Angelo can you help me?

matteomr commented 8 years ago

We have several issues for advances features like text styling and issues for PDF converter that we must again improve it. I think it's the main problem today with XDocReport : convert docx/odt to pdf is not perfect, but you can use another converter if you wish.

Hi Angelo, I read just now here (link to issue) that you suggested to zarhk to use an alternative converter. Can You suggest me to an option that is easy and quick to set up and use and some examples?

angelozerr commented 8 years ago

@matteomr I'm so very busy with my other open sources project. No time to help you today. Sorry.

matteomr commented 8 years ago

We have several issues for advances features like text styling and issues for PDF converter that we must again improve it. I think it's the main problem today with XDocReport : convert docx/odt to pdf is not perfect, but you can use another converter if you wish.

Hi Angelo, I read just now here link to issue that you suggested to zarhk to use an alternative >converter. Can You suggest me to an option that is easy and quick to set up and use and some examples?

@angelozerr some news?

matteomr commented 8 years ago

Hello Angelo, there is no hope for my issue? :-|

angelozerr commented 8 years ago

Sorry @matteomr no time to do that. Any contribution are welcome!

matteomr commented 8 years ago

OMG :-|

angelozerr commented 8 years ago

@matteomr I understand your frustration, but I'm very busy with other open source project. If you need support, I suggest you to find a commercial project.

matteomr commented 8 years ago

Hi @angelozerr I understand but I would not change project for not having to redo all the work done.
I look forward to updates from you or others who have solved, in other ways or with other project.

angelozerr commented 8 years ago

Hi @angelozerr I understand but I would not change project for not having to redo all the work done.

I understand, but I'm developping XDocReport in my spare time. It's very difficult for me to fix the whole bugs fXDocReport. Today I try to fix bugs about reporting. Converters are a very big task, so it's very difficult for me to fix bugs.

You could keep XDocReport to generate report and implement a docx->pdf converter by using a commercial project to have support.

matteomr commented 8 years ago

OK thank you @angelozerr , let's see what you can solve today. I would like to keep the format of the report in odt and convert it then in PDF. If there was a command from the command prompt OpenOffice for it....i don't know

angelozerr commented 8 years ago

I would like to keep the format of the report in odt and convert it then in PDF.

Yes sorry, I mean find a commercial ODT->PDF converter.

from the command prompt OpenOffice for it....i don't know

JODConverter could help you (but it's not perfect too). I think it should be very good taht XDocReport provides this converter.

matteomr commented 8 years ago

I understand, but I'm developping XDocReport in my spare time. It's very difficult for me to fix the whole > bugs fXDocReport. Today I try to fix bugs about reporting. Converters are a very big task, so it's very > > difficult for me to fix bugs.

Hi @angelozerr any news?

angelozerr commented 8 years ago

@matteomr I told you that I have no time to fix this issue, please see JODConverter.

matteomr commented 8 years ago

Sorry, I misunderstood . :-|

pensionarchitects-ben commented 8 years ago

@matteomr I've encountered this problem too, after searching for a while I found out it only happened when I had a hyperlink in my footers and headers. I've downloaded the file you uploaded here and see you also use a hyperlink in your odt. So if you don't need the hyperlink just remove it and everything works.

Greetz Ben Maes

rob2universe commented 8 years ago

Removing the hyperlink formatting of the url (turn to plain text) also solved the exception in my case. Now still an image in the header gets lost but that is a different story.

benelot commented 7 years ago

Wow, an excellent documentation about how to bother an open-source developer.

nazarsa commented 7 years ago

Getting into the same issue :(

pensionarchitects-ben commented 7 years ago

@nazarsa Did you check the solution?

nazarsa commented 7 years ago

@pensionarchitects-ben yes...thanks for that solution, however in our case the links cannot be removed :( , so was wondering if there is any other way to solve this problem keeping the links.

pensionarchitects-ben commented 7 years ago

The only other solution would be to fix it in the XDocReport code.

j-dimension commented 6 years ago

I am also running into this issue. Just FYI - I put some code in before the conversion to remove all hyperlinks from the document, but that does not resolve the issue. It seems related to header / footer content, but I have not found a way to automatically remove those.