1

First off, this is under Drupal 7. I'm looking to have the server save a PDF of the submitted webform when a user submits it or updates it (overwriting the old one on update). So far I've had no success with fill2pdf, views pdf, or entity print modules in getting this accomplished.

I do have the Print module working where I can click a link and download the PDF, but that's only if I take the action.

I figure the easiest way at this point would just be to have a Rules action execute some custom PHP code using the PDF that the Print module is generating.

I'm just not sure what that code would look like. Basically, upon submission, the Rule would Execute Custom PHP code. That code would user the PDF generated by the URL (www.example.com/printpdf/[nid]/submission[sid]) and would save that file to a location on the server (going to that URL would save it on the user's local machine) that I would like to use some tokens from the webform for (private files/year/username/node title.pdf). Preferrably this would all be done in the background so the user wouldn't see it, but if that's not possible redirect the user after saving the webform.

Anyone know how I can accomplish this? Thanks!

0

It seems like the entity_print module does exactly what you want.

From the docs:

Entity Print allows you to print any Drupal entity (Drupal 7 and 8) or View (Drupal 8 only) to PDF.

The module is weel maintained with more then 5K websites using it.

  • I tried using this with the wkhtmltopdf stuff that is supposed to work with it. I cannot get it to work on my site though for some reason. It gets an error. Loading pages (1/6) [> ] 0% [======> ] 10% Error: Failed to load c:\Windows\Temp\tmp1825.tmp.html, with network status code 301 and http status code 0 - Protocol "c" is unknown Error: Failed loading page C:\Windows\Temp\tmp1825.tmp.html (sometimes it will work just to ignore this error with --load-error-handling ignore) – Dan Aug 23 at 13:39
  • Looks like it as a permissions issue - I've got it generating the PDF. Now I just need to find out how to save a specific webform submission to a folder on the server. Any idea how to accomplish that? – Dan Aug 23 at 13:56
  • No, I think you should post that as a new question. – Jdrupal Aug 23 at 14:13
  • Actually, so I'm generating PDFs of entities now. Webform Submissions are not entities though (at least not easily), so I'm as of yet not generating PDFs of Webform Submissions, only Nodes and other entities. I need to get this to generate a PDF of a webform submission before I accept it as the answer. Once I've got that, then I can look at asking a new question for saving it to the server. – Dan Aug 28 at 22:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.