mileszs / wicked_pdf

PDF generator (from HTML) plugin for Ruby on Rails
http://www.mileszs.com/wicked-pdf-plugin
MIT License
3.52k stars 640 forks source link

Error: PDF could not be generated! #1086

Open Dimasfullxq opened 6 months ago

Dimasfullxq commented 6 months ago

Error: PDF could not be generated!

I have an error while generating PDF, but sometimes it works. 1 of 100 tries

/Users/dimasfullxq/.rvm/gems/ruby-3.2.1@online-consulting-backend/gems/wicked_pdf-2.6.3/lib/wicked_pdf.rb:80:in `rescue in pdf_from_url': Failed to execute: (RuntimeError)
["/Users/dimasfullxq/.rvm/gems/ruby-3.2.1@online-consulting-backend/bin/wkhtmltopdf", "--enable-local-file-access", "file:////var/folders/ng/0095qts9355cdj2_cp18z14c0000gn/T/wicked_pdf20231219-33636-1krr8o.html", "/var/folders/ng/0095qts9355cdj2_cp18z14c0000gn/T/wicked_pdf_generated_file20231219-33636-jnjpi5.pdf"]
Error: PDF could not be generated!
 Command Error: Loading pages (1/6)
Counting pages (2/6)                                               
[============================================================] Object 1 of 1
/Users/dimasfullxq/.rvm/gems/ruby-3.2.1@online-consulting-backend/gems/wicked_pdf-2.6.3/lib/wicked_pdf.rb:76:in `pdf_from_url': PDF could not be generated! (RuntimeError)
 Command Error: Loading pages (1/6)
Counting pages (2/6)                                               
[============================================================] Object 1 of 1

System specifications

wicked_pdf gem version (output of cat Gemfile.lock | grep wicked_pdf): wicked_pdf (2.6.3) wicked_pdf

wkhtmltopdf version (output of wkhtmltopdf --version): wkhtmltopdf 0.12.6 (with patched qt)

whtmltopdf provider gem and version if one is used: default binary

platform/distribution and version (e.g. Windows 10 / Ubuntu 16.04 / Heroku cedar): MacOs 14.1.2 (23B92), Intel

Rails 7.0.4 Ruby 3.2.1. WickedPdf.config = { enable_local_file_access: true }

P.S Checked on test application with same rails and ruby version - works fine. Maybe you can support why I have such issue?

slapsstick commented 4 months ago

The trip through the complexities of making PDF forms in development projects is always a journey full of learning courses and sometimes, unanticipated the barriers to them. The problem with wicked_pdf is very much akin to a glitch that I personally experienced a few months ago on a project that I was in charge of. In my journey of overcoming the same impediment, I discovered a useful resource that not only tackled what was immediate for me, but also boosted the security of the PDF files I used. It's a platform called PDF Guru https://pdfguru.com/password-protect-pdf , it is a one-stop-shop that combines advanced security measures and reliable features. This feature ended up being a game changer for me ensuring that confidential information was secured but lies in authority which is easy to access the authorized users. In fact, the process of finding technological obstacles enables us to stumble upon instruments that can return our working routine to normal and even improve it.