Imprimir directamente un PDF sin abrirlo

alfajave

Bovino maduro
#1
Hola, espero alguien me pueda ayudar:

Mi problema es que necesito imprimir un archivo PDF de una página de internet que al darle clic en un botón se imprima el PDF sin necesidad de abrirlo, que lo mande directo a la impresora. Si alguien sabe como hacerlo les agradecería me dijeran como se hace, no importa en cual lenguaje, ya sea JavaScript, PHP, etc.

Tengo un código en PHP pero no me funciona, no me marca error pero baje un programa que se llama CyberPrinter y ahi si me lo registra me dice que se mando a imprimir pero realmente no imprime el documento PDF.

Les agradecería toda la ayuda posible, Gracias

aquí el código que probé:
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
</head>
<body>
<?php 
function print_file($filename)
{
    // path to your adobe executable
    $adobe_path='"C:\Archivos de programa\Adobe\Acrobat 7.0\Reader\AcroRd32.exe"';
 $filename="C:\A1.pdf";
    $ext='';
    $ext=strrchr($filename,'.');
    $ext=substr($ext,1);
    $ext_xl=substr($ext,0,2);
    if ($ext=='pdf') {
        shell_exec ($adobe_path.' /t '.$filename);
    }
    else if ($ext=='doc'||$ext=='rtf'||$ext=='txt') {
        $word = new COM("Word.Application");
        $word->visible = true;
        $word->Documents->Open($filename);
        $word->ActiveDocument->PrintOut();
        $word->ActiveDocument->Close();
        $word->Quit();
    }
    else if ($ext_xl=='xl') {
        $excel = new COM("Excel.Application");
        $excel->visible = true;
        $excel->Workbooks->Open($filename);
        $excel->ActiveWorkBook->PrintOut();
        $excel->ActiveWorkBook->Close();
        $excel->Quit();
    }
}
// example of printing a PDF
print_file("C:\A1.pdf");?>
</body>
</html>
 
Arriba