php print pdf using php_printer.dll on windows serverside
my job is to print pdf-files serverside on a windows-machine with xampp
installed. Now I´ve installed php_printer.dll and copied/written a
test-script from here:
$printer = "\\\\SERVER\\PRINTER";
$file = "test.pdf";
if ($ph = printer_open($printer)) {
// Get file contents
$fh = fopen($file, "rb");
$content = fread($fh, filesize($file));
fclose($fh);
printer_start_doc($ph, "TESTPAGE");
printer_start_page($ph);
// Set print mode to RAW and send PDF to printer
printer_set_option($ph, PRINTER_MODE, "RAW");
printer_write($ph, $content);
printer_close($ph);
echo "-> Job was sent to ".$printer;
} else {
echo "-> Couldn't connect... ".$printer;
}
But it does not work with pdf-files; text-only is okay. If I print
pdf-files, there are only incorrect chars on the paper :( What can I do to
print serverside pdf´s in php? Any tips?
Regards, rumble
No comments:
Post a Comment