I am trying to upload the same PDF template, that I'm using on my local machine (ubuntu) to remote server (red hat). Both have pdftk installed.
Problem is, when i upload it to remote server, it shows that there are no fields to be mapped. However, it does show all the fields on localhost.

what could be the problem.

thanks in advance.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

wizonesolutions’s picture

One of two things is happening here:

  1. Your RedHat server's Apache user can't run pdftk or doesn't have it in its path. Change user to it (probably nobody or httpd and type pdftk --version. Does it work (or at least does pdftk output something)?
  2. You haven't configured the remote server at admin/config/media/fillpdf, and thus it doesn't know which fill method to use or is trying to use one that it can't.

Let me know if it's one of those. I should add these to a more visible FAQ section in the documentation and will soon.

turtletrail’s picture

1. The permissions were correct. But i changed them to 777, just in case. Didn't help.
The pdftk --version prints something like:

pdftk 1.41 a Handy Tool for Manipulations PDF Documents ...

so i guess it cannot be blamed as not working

2. It's configured correctly

so, nothing seems to be helping for now.

Thank you.

turtletrail’s picture

so i found the temporary solution, this was to change line nr. 585 in fillpdf.module from:
exec('pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' dump_data_fields', $output);

to

exec('usr/local/bin/pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' dump_data_fields', $output);

certainly, that's not the right way to do this. Can you give me a hint to point shell to the right path?

wizonesolutions’s picture

Title: Same PDF template does not show any fields » Allow specifying pdftk path manually
Version: 7.x-1.1 » 7.x-1.x-dev
Category: support » feature

From the looks of it, /usr/bin simply isn't in your Web server user's path. I think your fix is about the best you could do right now besides fixing it environmentally, however that applies to your environment.

I'm changing this to a feature request to allow defining the path to pdftk manually. This will remove the need for your code change. If you'd like to contribute a patch, you're welcome to. Otherwise, I will do this soon.

makt’s picture

The pdftk is installed under the path usr/bin/pdftk. I changed pdftk.module (see below) but the module is still not detecting the fields within my pdf. It also says the pdftk was not installed correctly but when my hosting company tests it, it works for them. Any idea on why this would happen? Thanks!

exec('usr/bin/pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' dump_data_fields', $output);

wizonesolutions’s picture

makt: See http://drupal.org/node/1302596#comment-5884826

exec() might be disabled on shared hosting.

wizonesolutions’s picture

Oh! Also, that needs to be exec('/usr/bin/pdftk ' . escapeshellarg(drupal_realpath($filename)) . ' dump_data_fields', $output); Note the leading slash before usr. usr isn't /usr.

makt’s picture

Thank you! After enabling exec() & shell_exec() the module works!

wizonesolutions’s picture

Tagging.

wizonesolutions’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Active » Patch (to be ported)
FileSize
4.71 KB

Committed this feature to 7.x-1.x-dev. Here's the patch.

wizonesolutions’s picture

If this gets backported to 6.x-1.x, it also needs to take #1876832: Path to pdftk blank if saved blank on settings page (should fall back to pdftk) into account.

wizonesolutions’s picture

Camp is over.

TolliSysDev’s picture

I am revisiting item#6 because exec() IS disabled on my shared hosting. Is there a workaround for this? At present the /usr/bin/pdftk path is not recognized and I can't get the module to work.

wizonesolutions’s picture

Issue summary: View changes

No, the JavaBridge/pdftk options are not intended for shared hosting. You should either use FillPDF Service or run your site off a VPS/dedicated server where you can set up the other options.

  • Commit 6d640b3 on 7.x-1.x, 7.x-2.x, 7.x-2.x-tests1, 7.x-1.x-ubercartbackporttest by wizonesolutions:
    Issue #1430044: Add fallback value to fillpdf_pdftk_check().
    
  • Commit 7a76f0b on 7.x-1.x, 7.x-2.x, 7.x-2.x-tests1, 7.x-1.x-ubercartbackporttest by wizonesolutions:
    Issue #1430044: Add pdftk path option.
    

kenorb’s picture

Version: 6.x-1.x-dev » 8.x-4.x-dev
Status: Patch (to be ported) » Fixed

Marking as fixed in 7.x & 8.x since Drupal 6 is no longer supported.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.