Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fillpdf
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
drupal.org
fillpdf
Commits
52572aa7
Commit
52572aa7
authored
12 years ago
by
Kevin Kaland
Browse files
Options
Downloads
Patches
Plain Diff
Issue #1876832: Fix pdftk path check.
parent
94f2e53a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fillpdf.admin.inc
+1
-1
1 addition, 1 deletion
fillpdf.admin.inc
fillpdf.module
+12
-2
12 additions, 2 deletions
fillpdf.module
with
13 additions
and
3 deletions
fillpdf.admin.inc
+
1
−
1
View file @
52572aa7
...
@@ -36,7 +36,7 @@ function fillpdf_settings($form, &$form_state) {
...
@@ -36,7 +36,7 @@ function fillpdf_settings($form, &$form_state) {
}
}
// Check for pdftk.
// Check for pdftk.
$status
=
fillpdf_pdftk_check
(
variable_get
(
'
fillpdf_pdftk_path
'
,
'pdftk'
));
$status
=
fillpdf_pdftk_check
(
fillpdf_pdftk_path
(
));
if
(
$status
===
FALSE
)
{
if
(
$status
===
FALSE
)
{
$options
[
'pdftk'
]
.
=
'<div class="messages warning">'
.
t
(
'pdftk is not properly installed.'
)
.
'</div>'
;
$options
[
'pdftk'
]
.
=
'<div class="messages warning">'
.
t
(
'pdftk is not properly installed.'
)
.
'</div>'
;
}
}
...
...
This diff is collapsed.
Click to expand it.
fillpdf.module
+
12
−
2
View file @
52572aa7
...
@@ -710,7 +710,7 @@ function fillpdf_execute_merge($method, $fields, $fillpdf, $mode = 'url', $flatt
...
@@ -710,7 +710,7 @@ function fillpdf_execute_merge($method, $fields, $fillpdf, $mode = 'url', $flatt
$xfdffile
=
file_save_data
(
$xfdf
,
$xfdfname
,
FILE_EXISTS_RENAME
);
$xfdffile
=
file_save_data
(
$xfdf
,
$xfdfname
,
FILE_EXISTS_RENAME
);
// Now feed this to pdftk and save the result to a variable
// Now feed this to pdftk and save the result to a variable
$path_to_pdftk
=
variable_get
(
'
fillpdf_pdftk_path
'
,
'pdftk'
);
$path_to_pdftk
=
fillpdf_pdftk_path
(
);
ob_start
();
ob_start
();
passthru
(
$path_to_pdftk
.
' '
.
escapeshellarg
(
drupal_realpath
(
$filename
))
.
' fill_form '
.
escapeshellarg
(
drupal_realpath
(
$xfdffile
->
uri
))
.
' output - '
.
(
$flatten
?
'flatten '
:
''
)
.
'drop_xfa'
);
passthru
(
$path_to_pdftk
.
' '
.
escapeshellarg
(
drupal_realpath
(
$filename
))
.
' fill_form '
.
escapeshellarg
(
drupal_realpath
(
$xfdffile
->
uri
))
.
' output - '
.
(
$flatten
?
'flatten '
:
''
)
.
'drop_xfa'
);
$data
=
ob_get_clean
();
$data
=
ob_get_clean
();
...
@@ -807,7 +807,7 @@ function fillpdf_execute_parse($method, $fillpdf, $mode = 'url') {
...
@@ -807,7 +807,7 @@ function fillpdf_execute_parse($method, $fillpdf, $mode = 'url') {
break
;
break
;
}
}
$path_to_pdftk
=
variable_get
(
'
fillpdf_pdftk_path
'
,
'pdftk'
);
$path_to_pdftk
=
fillpdf_pdftk_path
(
);
$status
=
fillpdf_pdftk_check
(
$path_to_pdftk
);
$status
=
fillpdf_pdftk_check
(
$path_to_pdftk
);
if
(
$status
===
FALSE
)
{
if
(
$status
===
FALSE
)
{
drupal_set_message
(
t
(
'pdftk not properly installed.'
),
'error'
);
drupal_set_message
(
t
(
'pdftk not properly installed.'
),
'error'
);
...
@@ -1014,3 +1014,13 @@ function fillpdf_pdftk_check($pdftk_path = 'pdftk') {
...
@@ -1014,3 +1014,13 @@ function fillpdf_pdftk_check($pdftk_path = 'pdftk') {
return
TRUE
;
return
TRUE
;
}
}
// This is a convenience wrapper around variable_get(). It lets us **also**
// return "pdftk" if the variable is empty, not just unset.
function
fillpdf_pdftk_path
()
{
$path_to_pdftk
=
variable_get
(
'fillpdf_pdftk_path'
,
'pdftk'
);
if
(
$path_to_pdftk
)
{
return
$path_to_pdftk
;
}
return
'pdftk'
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment