webERP Forum

Full Version: Automated print pdf to folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi All
I would like to be able to print pdf files such as checks and invoices to folder and batch print them later, such as checks, invoices and packing slips, has anyone successfully accomplished this?

Thanks All
Hi Dave,

What you can do is to go to includes/class.pdf.php and find the OutputD and OutputI methods. Create a new method as follows:

function OutputF($DocumentFilename = 'Document.pdf') {
if (($DocumentFilename == null) or ($DocumentFilename == '')) {
$DocumentFilename = _('Document.pdf');
}
$this->Output('/absolute/path/for/documents/' . $DocumentFilename, 'F');
}

putting in the path where you want to store the files. Then wherever you want to save rather than send to the browser change the OutputD method to OutputF. You might want to add a redirect back to the script after calling this method. Does this make sense?

Tim
Thanks falconer
I will give that a try when I have time later this week.
Here is what I did
replaced
function OutputI($DocumentFilename = 'Document.pdf') {
if (($DocumentFilename == null) or ($DocumentFilename == '')) {
$DocumentFilename = _('Document.pdf');
}
$this->Output($DocumentFilename,'I');
}

function OutputD($DocumentFilename = 'Document.pdf') {
if (($DocumentFilename == null) or ($DocumentFilename == '')) {
$DocumentFilename = _('Document.pdf');
}
$this->Output($DocumentFilename,'D');
}
With
function OutputF($DocumentFilename = 'Document.pdf') {
if (($DocumentFilename == null) or ($DocumentFilename == '')) {
$DocumentFilename = _('Document.pdf');
}
$this->Output('/weberp/App_Data/print/' . $DocumentFilename, 'F');

I keep getting 500 error I have changed the permissions on the server folder thinking that may be the problem so I think it may be the path
The url is http://XXX.15.3.139/weberp I have tried the above and also /App_Data/print/ any help would be greatly appreciated.
Hi, firstly I would keep the OutputD and OutputI methods, just add the OutputF one, as the others are used elsewhere.

The path is an absolute path on your server, so for instance on my Linux machine it could be /home/tim/invoices/ or on a windows machine it could be c:/weberp/invoices

Thanks
Tim
Got it working thanks for all the help.
Gone for a while now back at it where would I add the redirect back to the script after calling this method and will this correct the blank page after sending file to folder.
Thanks For all the help.
Reference URL's