-
Notifications
You must be signed in to change notification settings - Fork 132
Not working on a standalone windows box #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Did you check for an error message? You can set the command path like this:
|
Thanks for feedback. Among others , I've tryed this use mikehaertl\pdftk\Pdf; public function actionIndex() { //Since path to pdftk.exe contains empty characters, escape it with quotes otherwise windows will //try to execute C:\Program with arguments Files, (x86)\PDF, Server\bin\pdftk.exe, … $pdf = new Pdf('form.pdf', ['command' => '"C:\\Program Files (x86)\\PDFtk Server\\bin\\pdftk.exe"' ] ); $e = $pdf->getError(); echo $e; /* and alternatively this: $pdf = new Pdf('form.pdf', ['command' => '"C:\\Program Files (x86)\\PDFtk Server\\bin\\pdftk.exe"' ] ); $pdf->fillForm(array('name'=>'John Doe')) ->needAppearances() ->saveAs('filled.pdf'); $e = $pdf->getError(); echo $e; */ } but still without success. Nothing happens and no message is shown. |
You could also try Personally I never use windows. If you have to develop there I'd recommend to have a look at Vagrant or maybe even docker. WAMP/XAMP/... is a dead end (to me ;) ). |
Probably related to this: mikehaertl/php-shellcommand#1 |
I have got the same problem. This is my error log: pdftk A="C:[mypath]\my-pdf-with-a-form.pdf" generate_fdf output "data.fdf" The point is that I copy that line to execute it in the windows command line, it works and generates the "data.fdf". Edit: There is not spaces in my path. $temp_file_uri = "C:\my-template.pdf"; // Or another path with no spaces |
@developez Can you maybe help to debug this issue? As said before: I don't do any PHP development on Windows, so I can't help you on this. What I would try:
So simplify as much as possible until you find the point where it works / does not work anymore. Then report back... |
Ok, but one question first. I have to do this to use your code:
Is that correct? Edit: |
No - please read about the composer autoloader: https://getcomposer.org/doc/01-basic-usage.md#autoloading
What about the other variant that uses
|
Ok, with useExec it works.
That generates the fdf file. About the composer, I am learning the tool, the point is that I did "php composer.phar install" and as it downloaded my many files that I don't need, I took the php files in that folder distribution. |
You should not touch the files in So let's conclude for now: |
At this point the fdf is generated, so you library comunicates well with the pdftk. off topic: |
Try |
I'm using yii2 and xampp on a windows 7 home edition box and trying
to fill pdf form using your php-pdftk extension which I've installed using composer.
I've downloaded pdftk and installed it and the binaries libiconf2.dll and pdftk.exe are in C:\Program Files (x86)\PDFtk\bin\
Here is my code in controller (same as the sample you provided with your extension)
use mikehaertl\pdftk\Pdf;
public function actionIndex()
{
// Fill form with data array
$pdf = new Pdf('form.pdf');
$pdf->fillForm(array('name'=>'John Doe'))
->needAppearances()
->saveAs('filled.pdf');
}
bu it does not work. Nothing happens, no errors, absolutely nothing!
form.pdf file is in the webroot directory C:\xampp\htdocs\MyWebsite\form.pdf
It seems, my php script cannot just find the pdftk binaries. I've tryed to put
them in the vendor\bin directory of my yii2 template without any success.
I don't know where to place the pdftk binaries for the extension to find then and/or whether there
are any other configurations steps ( in other words, basic things) I have to do.
You surely cannot have tested your extension in all possible environments but if you've
tested it in a windows environment, please help me.
Thanks in advance.
The text was updated successfully, but these errors were encountered: