bensquire / php-pdftk-toolkit Goto Github PK
View Code? Open in Web Editor NEWA PHP Wrapper Interface for the PDFTK command line utility (the manipulation of PDF files)
A PHP Wrapper Interface for the PDFTK command line utility (the manipulation of PDF files)
This functionality is causing me some headache. I have spent the last couple days trying to figure out why this toolkit failed to merge two pdf files that in fact existed. It turns out I don't have pdftk 1.45, and my host is giving me the runaround on upgrading pdftk 1.44. What would it take to add a configuration to remove the handle function for backwards compatibility? I've temporarily made the following changes which appears to be working
//Assign each PDF a multi-char handle (pdftk-1.45)
foreach ($this->aInputFiles AS $iKey => $oFile) {
if ($oFile->getData() != null) {
$aCommand[] = "-";
$this->sInputData = $iKey;
} else {
$handle = chr(65 + floor($iKey/26)%26).chr(65 + $iKey%26);
//$aCommand[] = $handle . "='" . $oFile->getFilename()."'";
$aCommand[] = $oFile->getFilename(); }
}
//Fetch command for each input file
if ($total_inputs > 1) {
foreach ($this->aInputFiles AS $iKey => $oFile) {
$handle = chr(65 + floor($iKey/26)%26).chr(65 + $iKey%26);
//$aCommand[] = $handle . $oFile->_getCatCommand();
$aCommand[] = $oFile->_getCatCommand();
}
}
I'm doing this:
$docpdf=new pdftk();
$docpdf->setInputFile(array('filename' => "test.pdf",'rotation' => 180))
->setOutputFile("test.pdf_rotated")
->_renderPdf();
But the resulting PDF is identical to the original, and it is not rotated
First of all, thanks for your work on this
my issue is when i tried to run the demo example2 i got the following error :
Fatal error: Uncaught exception 'Exception' with message 'System error: Le chemin d' in C:\wamp64\www\php-pdftk-toolkit-master\src\Pdftk\Pdftk.php on line 496
Thanks for your help
First of all, thanks for your work on this. I searched all over for a solid php pdf manipulator and love this one.
My issue is that I want to explode a multipage pdf into separate pdf files. So I have a simple loop and I'm using setInputFile() and I thought I would be good. However, the start_page and end_page options that I send it are only working when I use setInputFile() a second time, however I don't want to add a second input file.
I've poked around a bit in your code and couldn't immediately figure it out, so I'm hoping I'm doing something wrong, or you could point me to what I need to alter to get this working.
Oh, and can your class count the pages in the pdf? I didn't see anything about it in the examples or the codebase. It seems that the underlying pdftk library supports it with the numpages property, so maybe it just needs to be implemented here?
Thanks,
Adam
It seems to be a problem with "getPdftkVersion" method. The method should return a string but instead it returns an array.
I think the problem appears because "_exec" returns an array (array('stdout' => '', 'stderr' => '', 'return' => '')) and the "getPdftkVersion" returns it directly instead of returning the "stdout" from it.
I'm running into issues with spaces in filenames. I'm not sure what the fix would be, but I'm having to rename files before processing them.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.