That's neat, Razzak, and presumably will also work with the appropriate
changes for Word, etc.
Regards,
Alastair.
--------------------------------------------------
From: "A. Razzak Memon" <[email protected]>
Sent: Saturday, June 05, 2010 12:35 PM
To: "RBASE-L Mailing List" <[email protected]>
Subject: [RBASE-L] - Re: Printing to 2 different outputs
At 05:35 PM 6/4/2010, Mark Lindner wrote:
Is there a syntax to allow a report to be printed to both a pdf
and a printer at the same time without rerunning the whole print
command, similar to the old OUTPUT PRINTER WITH SCREEN option?,
in effect PRINT repoortname | option printer | Option PDF? or
PRINT reportname OPTION PRINTER with OPTION PDF
Mark,
Yes, you CAN in R:BASE!
First PRINT the Report to a file as PDF and then immediately use
the "/p /h" option of the Acrobat Reader to print the report to
your default printer.
Here's how:
-- Start here ...
-- CreateAndPrintPDFReportInRBASE.RMD
-- A. Razzak Memon
-- June 5, 2010
-- For Mark Lindner on R:BASE List
-- CONNECT the database
IF (CVAL('DATABASE')) <> 'RRBYW16' OR (CVAL('DATABASE')) IS NULL THEN
CONNECT RRBYW16 IDENTIFIED BY NONE
ENDIF
-- Pre-Define All Global Variables
SET VAR vQuotes TEXT = (CVAL('QUOTES'))
SET VAR vChkFile INTEGER = NULL
SET VAR vReportName TEXT = 'Invoice'
SET VAR vInvoiceNo INTEGER = 1040
SET VAR vPDFFileName TEXT = +
('PDF\'+.vReportName+'_'+(CTXT(.vInvoiceNo))+'.PDF')
SET VAR vPrintString TEXT = NULL
-- Verify the existence of PDF Sub-Directory
SET VAR vChkFile = (CHKFILE('PDF'))
IF vChkFile <> 1 THEN
MD PDF
ENDIF
-- PRINT report to a file as PDF
PRINT .vReportName WHERE TransID = .vInvoiceNo +
OPTION PDF +
|FILENAME .vPDFFileName +
|SHOW_CANCEL_DIALOG OFF +
|TITLE Running R:BASE Your Way! (Part 16) +
|SUBJECT Customer Invoice +
|AUTHOR R:BASE eXtreme 9.0 +
|KEYWORDS R:BASE eXtreme 9.0 Invoice
{Define Print String
If Using Full Version of Adobe Acrobat 8.0
C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe
If Using Adobe Acrobat 8.0 Reader Only
C:\Program Files\Adobe\Acrobat 8.0\Reader\AcroRd32.exe
If Using Full Version of Adobe Acrobat 9.0
C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Acrobat.exe
If Using Adobe Acrobat 9.0 Reader Only
C:\Program Files\Adobe\Acrobat 9.0\Reader\AcroRd32.exe}
SET VAR vPrintString = +
(.vQuotes+'C:\Program Files\Adobe\Acrobat 8.0\Acrobat\Acrobat.exe|/p
/h' +
&.vPDFFilename+.vQuotes)
LAUNCH &vPrintString
CLEAR VAR
vQuotes,vChkFile,vReportName,vInvoiceNo,vPDFFileName,vPrintString
RETURN
-- End here ...
This techniques will print and save the report as R:BASE PDF document and
then
directly print the report to your default printer by launching the Adobe
Acrobat
(Full Version or Reader).
The only thing you really need to verify and update the command for
appropriate
path and the .exe file name of your PDF File Association, such as Adobe
Acrobat
version and executable name. Thus, update the vPrintString variable
accordingly.
If you need more examples and/or the actual sample application, feel free
to
contact me privately.
Enjoy and have fun automating this routine into your R:BASE application!
Very Best R:egards,
Razzak.