Corrupted PDFs Being Generated

Hello,

Just finished are fresh install for a friends company and doing some testing. Everything seems to be working after I ran into a few errors but there seems to be one remaining issue.

When generating a pdf, it shows up extremely corrupted be it an email, preview or downloaded. I can’t seem to find the cause of this and am extremely stuck. I am using snappdf as the pdf generator. I attached an image of what the pdfs look like.

Thanks

Hi,

I believe it’s the issue described here:

1 Like

Thanks, I am definitely having the same issue in that post.

Unfortunately the OP is using Docker on Cloudron and I am self hosting on Ubuntu. I probably should have mentioned that. I don’t know how to apply their repairs to my particular system. I tried setting my PDF_GENERATOR to “hosted_ninja” but its either not applying or same issue occurs. After changing .env I run “systemctl reload nginx.”

Here’s my .env pdf settings:
#options - snappdf / phantom / hosted_ninja

PDF_GENERATOR=snappdf

PHANTOMJS_PDF_GENERATION=false

#PHANTOMJS_KEY='removed'

#PHANTOMJS_SECRET=removed

@aedanc

After changing a setting in your .env you need to run the following

php artisan optimize

If you change to hosted_ninja this will work around the issue.

1 Like

Beautiful! How does hosted_ninja compare to snappdf? From what I know, snappdf is locally generated PDFs while hosted_ninja is handled on invoice ninja servers?

I know you guys have told me this before too lol. Hard to remember the artisan commands because I believe old version did not use artisan and/or required a refresh. Maybe they did though, don’t remember.

Got to say, what an amazing product you guys have developed! With not only developing such a useful and concise program but also being able to help the self hosting guys like me at the same time at no cost. Thank you so much! You can expect me to purchase white-label since there isn’t a donation button I could find.

@aedanc

Yes, snappdf works locally, and is much faster - when it works - we have seen the most recent version of chromium is not producing PDFs correct. hosted_ninja is our hosted servers, so there is some extra latency to produce the PDFs.

We’ll look to move away from chromium and bundle chrome somehow.

Also, thanks for the kind words, we appreciate the love and are very happy to assist :slight_smile:

1 Like

Awesome, thank you for letting me know.