innoveit / play2-pdf

A PDF module for Play Framework 2
MIT License
77 stars 22 forks source link

Broken PDF images when run in production mode #10

Closed aeusebio closed 8 years ago

aeusebio commented 8 years ago

Hi there,

I've been using this module and it have worked wonderfully. But when I run my application in production mode, the PdfGenerator renders the images incorrectly.

Has anyone the same problem? Have you found any solution?

Thanks in advance.

marcosinigaglia commented 8 years ago

I never had problems with images. What kind of problem?

aeusebio commented 8 years ago

Sorry, I forgot to attach the print screen.

screen shot 2016-01-14 at 17 07 21

marcosinigaglia commented 8 years ago

The image is inside your project?

aeusebio commented 8 years ago

Yes, in 'public\img\logo2.png' and is loaded by '@routes.Assets.at("img/logo2.png")'.

marcosinigaglia commented 8 years ago

Can you check with your browser if is correct in production? If you send me the image i'll try to figure it out.

aeusebio commented 8 years ago

Yes, in production the web page from which the pdf is generated is rendered correctly. The logo:

logo2

Btw, I'm using Play! 2.4

marcosinigaglia commented 8 years ago

Can you make a test with an another image? It's a strange behavior.

aeusebio commented 8 years ago

I've tried other images and the result is similar.

marcosinigaglia commented 8 years ago

Do you have a log file? Any errors?

aeusebio commented 8 years ago

No errors on the log file.

marcosinigaglia commented 8 years ago

Can you check if there are any errors on the webserver production log? Are you using ssh on the server?

aeusebio commented 8 years ago

There are no errors.

More info: To package the application I'm using "activator stage", and I start it by running the ".sh" created.

aeusebio commented 8 years ago

I kind of resolved the problem by calling a route defined by me instead of the "Assets.at". That route points to the Application controller in which the image is loaded from disk and returned as a byte array.

It's not a pretty solution but it works...

marcosinigaglia commented 8 years ago

Have you tried other play framework version? Maybe is a framework's bug?

aeusebio commented 8 years ago

After some testing I discovered that the image was generated with the wrong color information. After opening the image with an editor and saving it in another format, the problem was solved.

Thanks for all the help.