open all those pdfs at the same time?
Posted: Wed Sep 13, 2006 6:35 am
hi - i did some searching about the forums (and beyond) with no luck. This all started with writing a simple script to look into directories, capture the contents of txt files and then spit out all the texts into one page , printer friendly.
that worked fine, but now the next step is to do somethign similar with pdf's ...even if the "somethign" was to just open each file in a directory, into a seperate window....that could suffice. I understand that trying to write a script that woudl essentially tie all the pdf's into one printable file would be a bit crazy.
Why? our internal intranet generate weekly reports that are created in pdf...there are about 12 reoorts each week, and having to click, open, print, "back" ,click, open, print , "back" has finally taken its toll! The alternative would be if php could just send the data to the printer, and forego opening all together...but is that really possible???
Code: Select all
<head>
<script language="javascript">
function printEm(){
setTimeout('window.print()',1000);
}
</script>
</head>
<body onLoad="javascript:printEm()">
<?php
$dir="theseDocs/";
$openDir=opendir($dir);
while(false !=($file= readdir($openDir))){
if(!preg_match('/^\./',$file)){
$readFile=fopen($dir.$file,'r');
$contents=fread($readFile,1000);
echo($contents."<br>");
}
}
?>
</body>Why? our internal intranet generate weekly reports that are created in pdf...there are about 12 reoorts each week, and having to click, open, print, "back" ,click, open, print , "back" has finally taken its toll! The alternative would be if php could just send the data to the printer, and forego opening all together...but is that really possible???