Generate PDF very slow

hello, for now my ninja work very well, but pdf take about 5/6 seconds to generate, i try all 3 snappdf, phantom and hosted_ninja and take same time, so i think it something is wrong whit invoice ninja. I see that a few versions ago.Usually took about 1 second, and now 6 :frowning:
a second question, why the design of recoring invoice is not the same of invoices and quotes? it is a bug?
if help this is my env file

APP_NAME="Invoice Ninja"
APP_ENV=production
APP_KEY=base64:h0Z1CkqGr2EpVorD4zetm+NKzj6HRgRnZ93nVosrICY=
APP_DEBUG="false"

APP_URL="http://gestao.xxxxxxxx.pt/"

DB_CONNECTION="mysql"
MULTI_DB_ENABLED=false

DB_HOST="localhost"
DB_DATABASE="xxxx"
DB_USERNAME="xxxx"
DB_PASSWORD="xxxxx"
DB_PORT="3306"

DEMO_MODE=false

BROADCAST_DRIVER=log
LOG_CHANNEL=stack
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER="smtp"
MAIL_HOST="smtp-pt.securemail.pro"
MAIL_PORT="587"
MAIL_USERNAME="mail@xxxx.pt"
MAIL_PASSWORD=""
MAIL_ENCRYPTION="tls"
MAIL_FROM_ADDRESS="mail@xxxxx.pt"
MAIL_FROM_NAME="Serviços De Jardinagem"
POSTMARK_API_TOKEN=
REQUIRE_HTTPS="false"

GOOGLE_MAPS_API_KEY=
ERROR_EMAIL=
TRUSTED_PROXIES=

NINJA_ENVIRONMENT="selfhost"

#options - snappdf / phantom / hosted_ninja
PDF_GENERATOR=snappdf
#PDF_GENERATOR=hosted_ninja
#PDF_GENERATOR=phantom
#SNAPPDF_EXECUTABLE_PATH=/usr/bin/chromium
SNAPPDF_CHROMIUM_PATH=/usr/bin/chromium
LOCAL_DOWNLOAD=true

PHANTOMJS_PDF_GENERATION=false
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
PHANTOMJS_SECRET=secret

UPDATE_SECRET=secret

DELETE_PDF_DAYS=2
DELETE_BACKUP_DAYS=2

COMPOSER_AUTH='{"github-oauth": {"github.com": "${{ secrets.GITHUB_TOKEN }}"}}'
SENTRY_LARAVEL_DSN=https://39389664f3f14969b4c43dadda00a40b@sentry2.invoicing.co/5

best regards

Hi,

@david do you have any suggestions?

Unsure what could be causing such a slow generation time. There should at least be signficant differences in times between hosted_ninja and snappdf… with hosted_ninja your system only generates the HTML and then sends that to our servers for PDF generation so taking in the latency overhead depending on where you are in the world it should only take ~2 seconds max to get a response from hosted_ninja.

This may indicate the overhead is in the generation of your HTML.

@david i did several tests and hosted_ninja takes same time 5/6 Seconds i try change the design to the clean without changes and same think :frowning: that’s why i think it’s weird, all 3 generators take the same time

I tihnk this may be a DNS resolution issue for the company logo

can you try setting this variable in the .env

LOCAL_DOWNLOAD=true

then

php artisan optimize

and see if it performs faster.

@david maybe you are right, i change the network maneger and now generate in 4 seconds, i will check my connection later.
now my only question is why the recuring invoices dont have the same design?? cant change the design of recuring invoices?

regards

You should be able to change the recurring invoice design in the settings tab of the recurring invoice.

You might have to open the recurring invoices to edit and save them again to pick up the new setting.

Unrelated note: There should be no trailing slash in your APP_URL. In your .env file please change

APP_URL=“http://gestao.xxxxxxxx.pt/

to

APP_URL=“http://gestao.xxxxxxxx.pt

@david @hillel

I suggest adding a comment in .env.example (and the other canned .env versions) that APP_URL should not have a trailing slash.

There’s a check for this in the health check dialog in the app but I agree a comment in the .env.example file is a good idea. Thanks!

@xoo @david ok i remove the trailing slash and edit and save the recurring invoice, and in my setting i have all design for the creative, but recuring generate the clean model.

regards

I cannot recreate this issue. If the recurring invoice design is modern, it generates a modern templated invoice for me.

@david

Neither can I. But you are talking about a separate Recurring Invoice design setting. I only see Invoice, Quote, Credit and Purchase Order design settings, no separate Recurring Invoice Design. Am I missing something? (And yes, I left PO Designs as “Clean”, because I haven’t had a use for PO’s until now.)

Just to confirm, on the recurring invoice there is a settings tab where you can set the default design.

@david

Can you show a picture?

I believe David is referring to the settings tab on the edit invoice page (by the footer/terms), rather than in the settings section of the app.

“… by the footer/terms …” That’s it. @archlnx can you find that on the Recurring Invoice edit page?

2 Likes

@xoo yes that’s it :slight_smile: thank you, i never see that option, i think that was better that option is in general settings, like we define the default invoice or quote design,need to edit all recuring but ok problem solved

tanks @xoo @david @hillel
regards