Printing_double
unknown
php
2 years ago
953 B
4
Indexable
Never
<?php // Get the PDF file path and the preferred printer name from the ERP system $pdfFilePath = "/path/to/pdf/document.pdf"; $preferredPrinterName = getPreferredPrinterName(); // Implement this function to read the printer name from a configuration file or use a default value // Build the command to print the PDF file with Adobe Acrobat Reader DC $printCommand = "AcroRd32.exe /t \"" . $pdfFilePath . "\" \"" . $preferredPrinterName . "\" /t /h /s /o /n /q"; // Execute the print command $output = shell_exec($printCommand); // Check if the printing job was successful if (strpos($output, "%%[ Error") !== false) { echo "Printing failed: " . $output; } else { echo "Printing successful"; } // Function to read the preferred printer name from a configuration file function getPreferredPrinterName() { // Implement your logic to read the printer name from a file or return a default value return "MyPrinter"; } ?>