PDFRider creates pdftk.exe in process folder - blocked by restriction policies


Various processes that are run are run via a copy of pdftk.exe that is copied into the source folder of the PDFs.

For networks where .exes are whitelisted (in their locations) or completely blocked from running in %appdata% (ransomware protections etc) this does not work.

I'm guessing the process called is "pdftk.exe 1.pdf 2.pdf" to save having to call the full file path multiple times, but this shouldn't really be a problem to do.

file attachments


malakym wrote Nov 14, 2016 at 1:36 PM

I've managed to fix the problem, which also removes the need for that 1 second delay waiting for the pdftk.exe process to die before deleting it.

Burst is the only process that copies the exe locally.

The fix is to change the "output" entry from just "pg_...pdf" to "c:\folder\pg_.pdf" with quotes to handle spaces - you're allowed to put a path with a mask.

I never normally submit patches so its going to take me a bit to provide a proper one to sumit, in the meanwhile these are the changes


//changed prefix+name to destination+prefix+name
string args = "\"" + inputFileName + "\" burst output " + "\"" + destinationDirectory + "\\" + prefix + "%04d.pdf\"";

//File.Copy(Path.Combine(BASE_DIR, "pdftk.exe"), Path.Combine(destinationDirectory, "pdftk.exe"), true);
//File.Copy(Path.Combine(BASE_DIR, "libiconv2.dll"), Path.Combine(destinationDirectory, "libiconv2.dll"), true);

//p.StartInfo.WorkingDirectory = workingDirectory;
//set working directory to user temp so doc_data.txt can be written as a normal user (there seems to be no option to turn this output off)
p.StartInfo.WorkingDirectory = System.IO.Path.GetTempPath();

//no need to run these anymore
//File.Delete(Path.Combine(destinationDirectory, "pdftk.exe"));
//File.Delete(Path.Combine(destinationDirectory, "libiconv2.dll"));
// doc_data.txt line left (but modified. temp folder) since the doc_data.txt is always created
File.Delete(Path.Combine(System.IO.Path.GetTempPath(), "doc_data.txt"));

malakym wrote Nov 14, 2016 at 1:52 PM

Oh and...
p.StartInfo.FileName = Path.Combine(BASE_DIR, "pdftk.exe");
p.StartInfo.WorkingDirectory = System.IO.Path.GetTempPath();