Created
September 11, 2021 03:46
-
-
Save kyletaylored/154bd56c73cb0f76db95527dcbe1eb15 to your computer and use it in GitHub Desktop.
Using custom bin / exe on Pantheon
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Ghostscript example | |
// https://www.ghostscript.com/download/gsdnld.html | |
// Disable cache | |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | |
echo "<pre>"; | |
// Create PDF paths | |
$files = implode(" ", array_map(function($file) { | |
return "'{$file}'"; | |
}, ['sample.pdf', 'sample2.pdf'])); | |
// Make temp file path | |
$time = time(); | |
$temp_file = "../sites/default/files/{$time}-sample-gs.pdf"; | |
// Run Ghostscript | |
passthru("gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile='$temp_file' {$files}"); | |
echo "</pre>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// xPDF | |
// https://www.xpdfreader.com/download.html | |
// Disable cache | |
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | |
$bin = $_ENV['DOCROOT'] . 'bin'; | |
echo "<pre>"; | |
passthru("{$bin}/pdfinfo sample.pdf"); | |
echo "</pre>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment