Wicked_pdf: Creating fillable pdf

Created on 4 Oct 2017  路  4Comments  路  Source: mileszs/wicked_pdf

Hello, I'm using your awesome gem to generate PDF from HTML in my project.

Question is - Is it possible to generate fillable PDF, that user can download and fill in with this gem?
I tried rendering input, but wasn't able to edit it

Any help in this direction will be greatly appreciated
Thanks

Most helpful comment

I don't completely agree that you can't create fillable PDFs with Wicked PDF.

Because its underlying structure is wkhtmltopdf, you have the "enable-forms" option available:

wkhtmltopdf --enable-forms input-form.html output-pdf.pdf

This will allow you to have fillable PDFs if you feed it an HTML form.

To implement a fillable form, you would pass the "extra" key to the Controller output:
https://github.com/mileszs/wicked_pdf#advanced-usage-with-all-available-options

So something like this:

WickedPdf.new.pdf_from_string('string here', :extra => '--enable-forms')

All 4 comments

It is not possible with WickedPDF or it's underlying wkthmltopdf.

You could, however try https://github.com/yob/prawn-forms or https://github.com/bradediger/prawn-forms (updated fork of prawn-forms) with Prawn.

If you know exactly where to position your fillables on a page generated with WickedPDF, you might be able to supply that generated PDF to PDFtk for adding form fields as shown here: http://adamalbrecht.com/2014/01/31/pre-filling-pdf-form-templates-in-ruby-on-rails-with-pdftk/

Let me know how it goes!

@unixmonkey Thanks for a quick and useful response!
What we falled to in our team is to generate a fillable pdf template and when needed fill in needed data before giving it to users.

I believe issue can be closed, once more thanks for help!

I don't completely agree that you can't create fillable PDFs with Wicked PDF.

Because its underlying structure is wkhtmltopdf, you have the "enable-forms" option available:

wkhtmltopdf --enable-forms input-form.html output-pdf.pdf

This will allow you to have fillable PDFs if you feed it an HTML form.

To implement a fillable form, you would pass the "extra" key to the Controller output:
https://github.com/mileszs/wicked_pdf#advanced-usage-with-all-available-options

So something like this:

WickedPdf.new.pdf_from_string('string here', :extra => '--enable-forms')

@aldefouw I tried to generate fillable pdf with this extra option and it shows those fields as well but I am not able to edit the filled content in the fields

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kavitakanojiya picture kavitakanojiya  路  5Comments

dgdosen picture dgdosen  路  5Comments

amerritt14 picture amerritt14  路  4Comments

thomasbalsloev picture thomasbalsloev  路  3Comments

gregblass picture gregblass  路  4Comments