Forum > Packages and Libraries
Join pdf files
neodarkman:
I'm trying join pdf files using TProcess and external program... but TProcess has trouble with * wildcard:
program juntapdf;
uses
Classes, SysUtils,Process;
var
AProcess: TProcess;
begin
AProcess := TProcess.Create(nil);
Aprocess.Executable :='pdftk';
Aprocess.Parameters.add('*.pdf');
Aprocess.Parameters.add('cat');
Aprocess.Parameters.add('output');
Aprocess.Parameters.add('juntos.pdf');
AProcess.Options := AProcess.Options + [poWaitOnExit];
AProcess.Execute;
AProcess.Free;
end.
I get this message:
Error: Failed to open PDF file:
*.pdf
Errors encountered. No output created.
Done. Input errors, so no output created.
All pdfs are in the same folder as the application, even if I enter the full path with them *. pdf does not work.
If I put the name of all pdfs, works. But with *.pdf does not.
Be a bug, or am I doing something wrong...
Ps.: sorry my english... I'm brazilian.
typo:
You must iterate. It is not a bug.
marcov:
It is not tprocess that has a problem with the wildcard, but pdftk.
pdftk apparently assumes that the shell always expands wildcards. That is what Typo means with iterating, namely expanding it yourself.
neodarkman:
--- Quote from: marcov on April 02, 2013, 12:03:16 am ---It is not tprocess that has a problem with the wildcard, but pdftk.
pdftk apparently assumes that the shell always expands wildcards. That is what Typo means with iterating, namely expanding it yourself.
--- End quote ---
But on command line
pdftk *.pdf cat output junta.pdf
functions normally.
If I change the pdftk for a simple ls *. Pdf does not work ...
ls: can not access *. pdf: File or directory not found
typo:
Because the shell does it for you. But as a parameter to the program itself it does not work.
Navigation
[0] Message Index
[#] Next page