<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<blockquote type="cite">
  <pre wrap=""><div class="moz-txt-sig">From: Kenneth Brody <a
 class="moz-txt-link-rfc2396E" href="mailto:kenbrody@spamcop.net">&lt;kenbrody@spamcop.net&gt;</a>
To: Richard Hane <a class="moz-txt-link-rfc2396E"
 href="mailto:yoresoft@sbcglobal.net">&lt;yoresoft@sbcglobal.net&gt;</a>
Cc: <a class="moz-txt-link-abbreviated"
 href="mailto:filepro-list@lists.celestial.com">filepro-list@lists.celestial.com</a>; Rick Hane <a
 class="moz-txt-link-rfc2396E" href="mailto:rhane@deluxestitcher.com">&lt;rhane@deluxestitcher.com&gt;</a>
Sent: Thu, November 5, 2009 10:40:47 AM
Subject: Re: Print Wizard from -pq option

Richard Hane wrote:
</div></pre>
  <blockquote type="cite">
    <pre wrap=""><span class="moz-txt-citetags">&gt; </span>System: fpODBC ver 5.0.15 , Windows 2003 network
<span class="moz-txt-citetags">&gt; </span>
<span class="moz-txt-citetags">&gt; </span>I have several forms that we regulaly print as a pdf via print wizard.? That works fine.
<span class="moz-txt-citetags">&gt; </span>
<span class="moz-txt-citetags">&gt; </span>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.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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 &gt; fp$$$$$$.bat
del fp$$*.bat&gt;NUL
%pfprog%\fp\p repair

Thanks
Rick</pre>
</blockquote>
Rick,<br>
<br>
It seems to me that there are a few potential problems with your setup
especially as you increase the number of users.&nbsp; First, you put all the
output to the same file.&nbsp; If more than one person decides to print to a
.pdf then you can have a conflict or force one to wait.&nbsp; Second, you
require that each PC have a copy of PrintWiz installed in order to
handle the .pdf.<br>
<br>
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. <br>
<br>
In the select processing I have:<br>
::DECLARE GLOBAL PrintSelPos(1,.0,g) 'Set 'Shipping' as the default:<br>
::DECLARE GLOBAL PrintFileOpt(1,yesno,g)&nbsp; 'Allow printing to file as an
option:<br>
::DECLARE GLOBAL PrintToPDF(1,yesno,g)&nbsp;&nbsp;&nbsp; 'Pass whether PDF option was
chosen:<br>
::DECLARE GLOBAL PrintFileName(25,*,g)&nbsp; 'Set the file name prefix:<br>
::PrintSelPos ="1": 'Which is the default selection to be displayed<br>
::PrintFileOpt="Y":&nbsp; 'Some printouts should not be given the option of
printing to a file<br>
::ab(6,mdy)=rd:&nbsp;&nbsp; 'Change for each report to an appropriate reference
number (inv#,PO#, etc.)<br>
::PrintFileName="OpenAPCutOff-"&amp;ab&amp;"-":&nbsp; 'Change as needed for
each report<br>
::CALL NOAUTO "H\fpro\filepro\invno\printsel":<br>
:PrintFileOpt eq "N" and PrintToPDF eq "Y":EXIT&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'BRKY was
pressed:<br>
<br>
This is the "printsel" table:<br>
::DECLARE EXTERN PrintSelPos&nbsp; 'Should be defined as (1,.0):<br>
::DECLARE EXTERN PrintFileOpt&nbsp; ' Should be defined as (1,yesno):<br>
::DECLARE EXTERN PrintToPDF&nbsp; ' Should be defined as (1,yesno):<br>
::DECLARE EXTERN PrintFileName ' Should be defined as (25,*) - used for
filename prefix:<br>
::DIM prnter[10](20,*):<br>
::prnter("2")="SHIPPING" ; prnter("1")="OFFICE" ;
prnter("3")="PDF-FILE":<br>
::DECLARE flname(63,*):<br>
:'Set filename for printer file name with
username-date-time:aa(8,yymd)=@td ; ab(5,*)=GETENV("USERNAME"):<br>
:'Set filename for printer file name with
username-date-time:flname="f/fpro/temp/"&amp;ab{PrintFileName{aa:<br>
::CLS("21","4"):<br>
::SHOW "\r What printer should be used? \r":<br>
LIST:PrintFileOpt eq
"Y":pr=LISTBOX(prnter,"1","3","20","56","","",PrintSelPos):<br>
:PrintFileOpt eq "N" or PrintFileOpt eq
"":pr(1,*)=LISTBOX(prnter,"1","2","20","56","","",PrintSelPos):<br>
:@sk="SAVE":GOTO LIST:<br>
:@sk="BRKY"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Signal that the BRKY was hit with an
impossible:PrintFileOpt="N" ; PrintToPDF="Y" ; END&nbsp;&nbsp; 'combination.:<br>
::SHOW "":<br>
:pr eq "1" or pr eq "2":PRINTER NAME prnter(pr) ; END:<br>
:pr eq "3":PRINTER FILE flname{".txt" ; PrintToPDF="Y":<br>
::SHOW ("24","7") "FILE WILL BE "&amp;flname{".pdf":<br>
::END:<br>
<br>
<br>
The following is put at the end of report processing:<br>
@DONE::DECLARE EXTERN PrintToPDF:<br>
::DECLARE EXTERN PrintFileName:<br>
:PrintToPDF ne "Y":END:<br>
::CALL NOAUTO "H\fpro\filepro\invno\topdf":<br>
::END:<br>
<br>
<br>
This is the "topdf" processing table.<br>
::DECLARE EXTERN PrintFileName ' Should be defined as (25,*):<br>
::DECLARE flname(63,*) ; DECLARE flname2(55,*):<br>
::aa(8,yymd)=@td ; ab(5,*)=GETENV("USERNAME"):<br>
::flname="f\fpro\temp\ "{ab{PrintFileName{aa:<br>
::ad=flname{".txt":<br>
::ae=("!PDF /f\\mirrotek-server\data\fpro\temp\
"{ab{PrintFileName{aa{".pdf"):<br>
::af=("f\fpro\temp\temp"&amp;ab{PrintFileName{aa{".txt"):<br>
::lookup ref = invno&nbsp; r=("1")&nbsp;&nbsp; -ep:<br>
::ai(30,*)="temp"{ref(168)&amp;".pdf" ; ref(168)=ref(168)+"1" ; CLOSE
ref:<br>
::EXPORT ASCII pdf = (af)&nbsp; R=\n:<br>
::pdf(1) = ae:<br>
::CLOSE pdf:<br>
::SYSTEM "TYPE "&amp;ad&amp;" &gt;&gt; "&amp;af:<br>
::SYSTEM "ECHO !PDF /f\\mirrotek-server\data\fpro\temp\ "{ai&amp;"
&gt;&gt; "&amp;af:<br>
::SYSTEM "COPY "&amp;af&amp;" \\mirrotek-server\pw1":<br>
WAITLP:EXISTS("f\fpro\temp\ "{ai) eq "0" and zz lt "60000":SLEEP "500"
; zz(6,.0)=zz+"500" ; GOTO WAITLP:<br>
:zz ge "60000":SHOW "@TIMEOUT ERROR!&nbsp; PLEASE RETRY OR CALL AN
ADMINISTRATOR" ; EXIT:<br>
::SYSTEM "START "&amp;flname{".pdf &gt; "&amp;flname{".err 2&gt;&amp;1":<br>
::SYSTEM "ERASE "&amp;ad:<br>
::SYSTEM "ERASE "&amp;af:<br>
::SYSTEM "ERASE f\fpro\temp\ "{ai:<br>
::SYSTEM "ERASE "&amp;flname{".err":<br>
::END:<br>
<br>
This uses any Printwiz Server and keeps separate filenames per user and
per document.&nbsp; 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.&nbsp; I could probably fix that by adding the time
to the document name.<br>
<br>
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.<br>
<br>
Aside from making a few changes you simply drop the lines you need into
your processing where needed and it works.<br>
<br>
I am open to any suggestions for improvements or easier ways to do the
same thing.<br>
<br>
Also, by printing all reports through Printwiz, I keep the printer
definitions constant (Printwiz) no matter which printer it ctually gets
printed to.&nbsp; 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.<br>
<br>
Boaz
</body>
</html>