Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automated print pdf to folder
08-15-2015, 11:43 AM,
#1
Automated print pdf to folder
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
Reply
08-16-2015, 12:50 AM,
#2
RE: Automated print pdf to folder
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
Reply
08-18-2015, 12:47 PM,
#3
RE: Automated print pdf to folder
Thanks falconer
I will give that a try when I have time later this week.
Reply
08-19-2015, 05:21 AM,
#4
RE: Automated print pdf to folder
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.
Reply
08-19-2015, 06:39 PM,
#5
RE: Automated print pdf to folder
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
Reply
08-24-2015, 06:13 AM,
#6
RE: Automated print pdf to folder
Got it working thanks for all the help.
Reply
09-04-2015, 12:37 PM,
#7
RE: Automated print pdf to folder
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)