Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF output of the docx file #158

Open
jagdish9 opened this issue Jul 28, 2020 · 5 comments
Open

PDF output of the docx file #158

jagdish9 opened this issue Jul 28, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@jagdish9
Copy link

Is it possible to generate the pdf output of the same docx file, does plugin has inbuilt support for the pdf output.

@jagdish9 jagdish9 added the question Further information is requested label Jul 28, 2020
@Sancretor Sancretor self-assigned this Jul 28, 2020
@Sancretor
Copy link
Contributor

Hi @jagdish9

Thanks for your interest, we appreciate it !

Unfortunately, the plugin is not able to generate a PDF from the docx file in 3.2.2.
I'm not sure it will some day, because you can do that with LibreOffice or Word.
Does this answer your question ?

@jagdish9
Copy link
Author

Hi @Sancretor,

Thanks for your reply !

Yes, I can do with LibreOffice or Word, The problem here is I need to install LibreOffice on every machines.
I tried with XDocReport (Apache POI XWPF), It is able to convert only after editing once.
Please find steps:
steps:

  1. Generate the docx report.
  2. Tried to convert this docx report to pdf, getting below error.

fr.opensagres.poi.xwpf.converter.core.XWPFConverterException: java.lang.NullPointerException
at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:71)
at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:39)
at fr.opensagres.poi.xwpf.converter.core.AbstractXWPFConverter.convert(AbstractXWPFConverter.java:46)
at com.ConvertTest.main(ConvertTest.java:23)
Caused by: java.lang.NullPointerException
at fr.opensagres.poi.xwpf.converter.core.utils.XWPFTableUtil.getWidth(XWPFTableUtil.java:274)
at fr.opensagres.poi.xwpf.converter.core.utils.XWPFTableUtil.computeColWidths(XWPFTableUtil.java:285)
at fr.opensagres.poi.xwpf.converter.core.utils.XWPFTableUtil.computeColWidths(XWPFTableUtil.java:128)
at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.visitTable(XWPFDocumentVisitor.java:970)
at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.visitBodyElements(XWPFDocumentVisitor.java:267)
at fr.opensagres.poi.xwpf.converter.core.XWPFDocumentVisitor.start(XWPFDocumentVisitor.java:215)
at fr.opensagres.poi.xwpf.converter.pdf.PdfConverter.doConvert(PdfConverter.java:57)

  1. Open the docx file and edit something and saved.
  2. Tried to convert this docx to pdf, it converted to pdf, yes it worked in this case.

Note: only after editing once it worked

@jagdish9
Copy link
Author

Hi @Sancretor,

We want that docx should be converted dynamically at the run the time.
is that possible ?

Thanks.

@Sancretor
Copy link
Contributor

Hi @jagdish9

I don't know why your PDF converter does not work, and won't be able to debug it as it is outside of the scope of this project.
I perfectly understand that your need is to have a PDF output, but currently, the plugin is not able to do it.
Maybe have a look at a tool like pandoc ..?

We could investigate on how to do it, but honestly, we may not do it soon or ever. Sorry.
In our minds, the generated documents are just preliminary versions of what you would have to produce to give a clear state of your code quality, so they still need manual editing to add further information from your own analysis.

@begarco begarco added enhancement New feature or request and removed question Further information is requested labels Jul 29, 2020
@begarco
Copy link
Contributor

begarco commented Jul 29, 2020

Hi @jagdish9

This is a known behaviour of the cnes report. By construction, the generated document only contains references to the targeted values. At document opening, references are replaced by the values by the word processing application. So that it may be understandable you get null pointer exception when trying to handle the reports with low level tools.

It may be enhanced, but may need some time to fix it the right way: feel free to contribute if you have time to do so.

Thanks,
Benoît

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants