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

No-args constructor for DocumentFormat does not exist #59

Closed
recurve opened this issue Mar 15, 2018 · 6 comments
Closed

No-args constructor for DocumentFormat does not exist #59

recurve opened this issue Mar 15, 2018 · 6 comments

Comments

@recurve
Copy link
Contributor

recurve commented Mar 15, 2018

Hi,

I'm attempting to upgrade from the abandoned version of JODConverter to your new improved one. Package names ("artofsolving") and API has changed slightly but appears to be very similar. I thought I hooked everything up properly but now when I try to convert an image to PDF I get the following error.

RuntimeException: No-args constructor for class org.jodconverter.document.DocumentFormat does not exist. Register an InstanceCreator with Gson for this type to fix this problem.

Any ideas?

Thanks,

@recurve
Copy link
Contributor Author

recurve commented Mar 15, 2018

I got passed this issue by deleting “gson-1.4.jar” and replacing with: “gson-2.8.2.jar” in my project.

That said, I'm now getting a different error:

Error: The source format is missing or not supported
at org.jodconverter.job.AbstractConversionJobWithSourceFormatUnspecified.toInternal(AbstractConversionJobWithSourceFormatUnspecified.java:109)

@recurve
Copy link
Contributor Author

recurve commented Mar 15, 2018

Wow!

I was uploading a JPG file to be converted to PDF. That's where it said "The source format is missing or not supported"

When I upload a DOCX file... it happily converts to PDF.

Hmm...

This used to work with the old forgotten JODConverter... any reason why it was removed here?

@recurve
Copy link
Contributor Author

recurve commented Mar 15, 2018

Looking at: DefaultDocumentFormatRegistry.java
It has no JPG defined!!!!!
It has PNG but no JPG.... must be an oversight.

@recurve
Copy link
Contributor Author

recurve commented Mar 16, 2018

I created a pull request for: JPG, TIFF, and GIF

@sbraconnier
Copy link
Member

Thank you so much for this pull request. I'll take a look as soon as possible tomorrow but I don't see any reason to reject this. Good catch! The supported formats are those supported by the original project (the one I forked). I didn't remove any supported format. I'm not sure why it worked before and not with this version. Thanks again.

@sbraconnier
Copy link
Member

JODConverter now supports JPG, TIFF and GIF formats, thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants