Filepro-list Digest, Vol 70, Issue 3
Boaz Bezborodko
boaz at mirrotek.com
Fri Nov 6 08:17:34 PST 2009
>
> From: Kenneth Brody <kenbrody at spamcop.net> To: Richard Hane
> <yoresoft at sbcglobal.net> Cc: filepro-list at lists.celestial.com; Rick
> Hane <rhane at deluxestitcher.com> Sent: Thu, November 5, 2009 10:40:47
> AM Subject: Re: Print Wizard from -pq option Richard Hane wrote:
>> > System: fpODBC ver 5.0.15 , Windows 2003 network
>> >
>> > I have several forms that we regulaly print as a pdf via print wizard.? That works fine.
>> >
>> > However, I would like to give my users the option to do this on all forms and some reports as a regular option.? To do the above we have to use a batch file in addition to the printer definition.? Is there a way to do this with out a batch file?? IN short they could pick the pdf option as and other printer using the -pq flag.
>>
>
> Can you describe how, exactly, you "use a batch file in addition to the printer definition" to currently do the conversion?
>
> What is the printer definition (specifically, the type and destination), and what is in the batch file?
>
> -- Kenneth Brody
>
> Morning Ken,
>
> here is the printer definition and batch file.
>
> Print Def....
> printer12: rickpdf, printwiz, u:\pdfquote\quote.txt, Create PDF
> Note: 'u' is a mapped dirve on all workstations as the users my documents file located on the main server.
> and below 'v' is a mapped dirve on all workstations to the fpodbc folder?located on the main server.
>
> Repair.bat file
> @echo off
> rem This File created by Rick Hane on 8-7-2009
> set PATH=C:\WINDOWS\COMMAND
> set PFDSK=V
> set PFDATA=V:
> set PFPROG=V:
> set PFDIR=
> set PFLMHOST=server2007
> set PFMENU=V:\fp\menus\rick
> set PFGLOB=
> set PFCONFIG=
> set pfpostprint=c:\program files\printwiz30\printwiz /fpDF://u:\pdfquote\quote.pdf /quiet
> set PATH=%pfprog%;%PFPROG%\fp;%path%
> echo stuff > fp$$$$$$.bat
> del fp$$*.bat>NUL
> %pfprog%\fp\p repair
>
> Thanks
> Rick
Rick,
It seems to me that there are a few potential problems with your setup
especially as you increase the number of users. First, you put all the
output to the same file. If more than one person decides to print to a
.pdf then you can have a conflict or force one to wait. Second, you
require that each PC have a copy of PrintWiz installed in order to
handle the .pdf.
I give people an option in some reports that requires me to put some
lines of code into processing, but the code is portable from one program
to another.
In the select processing I have:
::DECLARE GLOBAL PrintSelPos(1,.0,g) 'Set 'Shipping' as the default:
::DECLARE GLOBAL PrintFileOpt(1,yesno,g) 'Allow printing to file as an
option:
::DECLARE GLOBAL PrintToPDF(1,yesno,g) 'Pass whether PDF option was
chosen:
::DECLARE GLOBAL PrintFileName(25,*,g) 'Set the file name prefix:
::PrintSelPos ="1": 'Which is the default selection to be displayed
::PrintFileOpt="Y": 'Some printouts should not be given the option of
printing to a file
::ab(6,mdy)=rd: 'Change for each report to an appropriate reference
number (inv#,PO#, etc.)
::PrintFileName="OpenAPCutOff-"&ab&"-": 'Change as needed for each report
::CALL NOAUTO "H\fpro\filepro\invno\printsel":
:PrintFileOpt eq "N" and PrintToPDF eq "Y":EXIT 'BRKY was
pressed:
This is the "printsel" table:
::DECLARE EXTERN PrintSelPos 'Should be defined as (1,.0):
::DECLARE EXTERN PrintFileOpt ' Should be defined as (1,yesno):
::DECLARE EXTERN PrintToPDF ' Should be defined as (1,yesno):
::DECLARE EXTERN PrintFileName ' Should be defined as (25,*) - used for
filename prefix:
::DIM prnter[10](20,*):
::prnter("2")="SHIPPING" ; prnter("1")="OFFICE" ; prnter("3")="PDF-FILE":
::DECLARE flname(63,*):
:'Set filename for printer file name with
username-date-time:aa(8,yymd)=@td ; ab(5,*)=GETENV("USERNAME"):
:'Set filename for printer file name with
username-date-time:flname="f/fpro/temp/"&ab{PrintFileName{aa:
::CLS("21","4"):
::SHOW "\r What printer should be used? \r":
LIST:PrintFileOpt eq
"Y":pr=LISTBOX(prnter,"1","3","20","56","","",PrintSelPos):
:PrintFileOpt eq "N" or PrintFileOpt eq
"":pr(1,*)=LISTBOX(prnter,"1","2","20","56","","",PrintSelPos):
:@sk="SAVE":GOTO LIST:
:@sk="BRKY" ' Signal that the BRKY was hit with an
impossible:PrintFileOpt="N" ; PrintToPDF="Y" ; END 'combination.:
::SHOW "":
:pr eq "1" or pr eq "2":PRINTER NAME prnter(pr) ; END:
:pr eq "3":PRINTER FILE flname{".txt" ; PrintToPDF="Y":
::SHOW ("24","7") "FILE WILL BE "&flname{".pdf":
::END:
The following is put at the end of report processing:
@DONE::DECLARE EXTERN PrintToPDF:
::DECLARE EXTERN PrintFileName:
:PrintToPDF ne "Y":END:
::CALL NOAUTO "H\fpro\filepro\invno\topdf":
::END:
This is the "topdf" processing table.
::DECLARE EXTERN PrintFileName ' Should be defined as (25,*):
::DECLARE flname(63,*) ; DECLARE flname2(55,*):
::aa(8,yymd)=@td ; ab(5,*)=GETENV("USERNAME"):
::flname="f\fpro\temp\ "{ab{PrintFileName{aa:
::ad=flname{".txt":
::ae=("!PDF /f\\mirrotek-server\data\fpro\temp\
"{ab{PrintFileName{aa{".pdf"):
::af=("f\fpro\temp\temp"&ab{PrintFileName{aa{".txt"):
::lookup ref = invno r=("1") -ep:
::ai(30,*)="temp"{ref(168)&".pdf" ; ref(168)=ref(168)+"1" ; CLOSE ref:
::EXPORT ASCII pdf = (af) R=\n:
::pdf(1) = ae:
::CLOSE pdf:
::SYSTEM "TYPE "&ad&" >> "&af:
::SYSTEM "ECHO !PDF /f\\mirrotek-server\data\fpro\temp\ "{ai&" >> "&af:
::SYSTEM "COPY "&af&" \\mirrotek-server\pw1":
WAITLP:EXISTS("f\fpro\temp\ "{ai) eq "0" and zz lt "60000":SLEEP "500"
; zz(6,.0)=zz+"500" ; GOTO WAITLP:
:zz ge "60000":SHOW "@TIMEOUT ERROR! PLEASE RETRY OR CALL AN
ADMINISTRATOR" ; EXIT:
::SYSTEM "START "&flname{".pdf > "&flname{".err 2>&1":
::SYSTEM "ERASE "&ad:
::SYSTEM "ERASE "&af:
::SYSTEM "ERASE f\fpro\temp\ "{ai:
::SYSTEM "ERASE "&flname{".err":
::END:
This uses any Printwiz Server and keeps separate filenames per user and
per document. Not completely fine-grain enough as it will error out if
the same user prints out the same document while a previous version is
still open on the screen. I could probably fix that by adding the time
to the document name.
It creates a temporary pdf file at the end of the process to create a
file for which it can check if Printwiz has completed the pdf creation.
Aside from making a few changes you simply drop the lines you need into
your processing where needed and it works.
I am open to any suggestions for improvements or easier ways to do the
same thing.
Also, by printing all reports through Printwiz, I keep the printer
definitions constant (Printwiz) no matter which printer it ctually gets
printed to. I can change a printer to that of a different manufacturer
and just change the drivers and Printwiz setup on the machine acting as
the Printwiz server.
Boaz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20091106/51e294ab/attachment.html
More information about the Filepro-list
mailing list