webERP Forum
Automated print pdf to folder - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (/forumdisplay.php?fid=1)
+--- Forum: Development Discussion & Specification (/forumdisplay.php?fid=10)
+--- Thread: Automated print pdf to folder (/showthread.php?tid=2543)



Automated print pdf to folder - daveparrish - 08-15-2015 11:43 AM

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


RE: Automated print pdf to folder - falkoner - 08-16-2015 12:50 AM

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


RE: Automated print pdf to folder - daveparrish - 08-18-2015 12:47 PM

Thanks falconer
I will give that a try when I have time later this week.


RE: Automated print pdf to folder - daveparrish - 08-19-2015 05:21 AM

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.


RE: Automated print pdf to folder - falkoner - 08-19-2015 06:39 PM

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


RE: Automated print pdf to folder - daveparrish - 08-24-2015 06:13 AM

Got it working thanks for all the help.


RE: Automated print pdf to folder - daveparrish - 09-04-2015 12:37 PM

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.