|
| Re: using pdf995 |
 |
Thu, 28 Feb 2008 21:08:56 -080 |
Ira Berkowitz wrote:
> I would like to cycle through a rowset, generate a report for each record
then send it to the PDF995 printer. I'm able to do this manually, one record at
a time but I would like to automate this.
>
> Is is possible to programatically render a report and send it to the PDF
driver without manually clicking the chooseprinter dialog. Ideally, the report
wouldn't even open (or would close automatically) so the screen does not become
littered with open reports.
>
> I have the reports printer object set to printer = 2 and printName =
"PDF995" but this appears to only affect the printer dialog.
Yes. However, you have to modify the PDF995.ini file ... Do a quick
check on the newsgroups, and if you can't find it, let me know. I have
code that does this ...
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
|
| Post Reply
|
| using pdf995 |
 |
Thu, 28 Feb 2008 22:19:51 -050 |
I would like to cycle through a rowset, generate a report for each record then
send it to the PDF995 printer. I'm able to do this manually, one record at a
time but I would like to automate this.
Is is possible to programatically render a report and send it to the PDF driver
without manually clicking the chooseprinter dialog. Ideally, the report wouldn't
even open (or would close automatically) so the screen does not become littered
with open reports.
|
| Post Reply
|
| Re: using pdf995 |
 |
Fri, 29 Feb 2008 21:19:29 -080 |
Ira Berkowitz wrote:
> I have PDF995 properly set to run silently and it works fine. But how do I
get dbase to render a report, send it to PDF995 and close without having to
press the print button.
Note that I use PDF995 for more than just use with dBASE, so it is
useful to have it, under "normal" circumstances ask for the path to
where I want to save the files. The code below is extracted from a
program that generates something like 8-10 different PDFs in one pass --
I trimmed out the variations on the report, so it shows only one report
... I also added some special comments below:
*****
*** You need to determine the value of "cNewPath" variable --
*** this is where the PDF file will be stored ...
*** Also the statement that assigns the title property
*** to the report below in the code -- this property
*** is used by PDF995 as the filename for the PDF file!
*****
// we need to modify PDF995.ini (cute, eh?) to handle the path:
set procedure to :dUFLP:ini.cc addi
oINI = new ini( "c:\pdf995\res\pdf995.ini" )
// save current settings:
cOutPutFolder = oINI.getValue( "Parameters", "Output Folder"
)
cInitialDir = oINI.getValue( "Parameters", "Initial Dir"
)
cOutputFile = oINI.getValue( "Parameters", "Output File"
)
oINI.setValue( "Parameters", "Output Folder", cNewPath )
oINI.setValue( "Parameters", "Initial Dir", cNewPath )
oINI.setValue( "Parameters", "Output File",
"SAMEASDOCUMENT" )
oINI.flush()
/*oINI.release()
close procedure :dUFLP:ini.cc
// First, get the message form up here so we have
// something to see:
set proc to message2.wfm addi
fMessage = new messageForm2()
fMessage.Text := "Creating PDF Files"
fMessage.title.text := "Creating PDF Files"
fMessage.Message.text := "Kingdom Alpha Awards List"
_app.OP = false
fMessage.mdi := false
fMessage.hwndParent := _app.framewin.hwnd
fMessage.repaint()
fMessage.open()
fMessage.top := fMessage.top-6 // so it can be seen above the printing
dialog
// open report file:
set procedure to AwardList.rep addi
// ================ West Kingdom Reports ===================
// Parameters array:
aParams = new AssocArray()
aParams["OP"] = false
aParams["Region"] = "West"
r = new Alpha2Report()
r.output := 1 // Printer
***** The next two lines are vital:
r.printer.printerSource := 2 // Specific
r.printer.printerName := "PDF995"
***** end of that ....
r.printer.resolution := 4 // High
r.params = aParams // use params array
// This needs to change -- it's used for filename:
r.title := "WestAwardList"
// Actually do it
r.render()
// Wait for it to complete
fMessage.Message.text := "Waiting for PDF995 to
finish"+chr(13)+"processing the PDF file."
_app.ExecuteMessages()
oFile = new file()
lDone = false
do while not lDone
if not file( hOut.cPath+"WestAwardList.pdf" )
sleep 5 // wait 5 seconds
loop
else // file exists, but is it big enough? If it's not
// at least 120K it's not ...
nSize = oFile.size( hOut.cPath+"WestAwardList.pdf" ) / 1024
if int( nSize ) < 120
sleep 5
loop
else
lDone = true
endif
endif
if lDone
exit
endif
enddo
// reset PDF995.ini file:
// we need to modify PDF995.ini (cute, eh?) to handle the path:
set procedure to :dUFLP:ini.cc addi
oINI = new ini( "c:\pdf995\res\pdf995.ini" )
// Reset settings:
oINI.setValue( "Parameters", "Output Folder", cOutputFolder
)
oINI.setValue( "Parameters", "Initial Dir", cInitialDir )
oINI.setValue( "Parameters", "Output File", cOutputFile )
oINI.flush()
oINI.release()
close procedure :dUFLP:ini.cc
// cleanup
close procedure awardlist.rep
close procedure message2.wfm
fMessage.release()
r.release()
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
|
| Post Reply
|
| Re: using pdf995 |
 |
Fri, 29 Feb 2008 21:26:31 -050 |
I have PDF995 properly set to run silently and it works fine. But how do I get
dbase to render a report, send it to PDF995 and close without having to press
the print button.
Ken Mayer [dBVIPS] Wrote:
> Ira Berkowitz wrote:
> > I would like to cycle through a rowset, generate a report for each
record then send it to the PDF995 printer. I'm able to do this manually, one
record at a time but I would like to automate this.
> >
> > Is is possible to programatically render a report and send it to the
PDF driver without manually clicking the chooseprinter dialog. Ideally, the
report wouldn't even open (or would close automatically) so the screen does not
become littered with open reports.
> >
> > I have the reports printer object set to printer = 2 and printName =
"PDF995" but this appears to only affect the printer dialog.
>
> Yes. However, you have to modify the PDF995.ini file ... Do a quick
> check on the newsgroups, and if you can't find it, let me know. I have
> code that does this ...
>
> Ken
>
> --
> /(Opinions expressed are purely my own, not those of dataBased
> Intelligence, Inc.)/
>
> *Ken Mayer* [dBVIPS]
> /Golden Stag Productions/
> dBASE at goldenstag dot net
> http://www.goldenstag.net/GSP
> http://www.goldenstag.net/dbase/dBASEBooks.htm
> http://www.goldenstag.net/dbase
|
| Post Reply
|
| Re: using pdf995 |
 |
Sun, 02 Mar 2008 12:43:37 -080 |
Ira Berkowitz wrote:
> Ken
>
> Thanks for the info. I'm still having problems get the dbase report to
render silently without having it appear in a window and then having to push the
print button. Here is my printer object:
> with (this.printer)
> duplex = 1 // None
> orientation = 1 // Portrait
> paperSource = 15
> paperSize = 1
> resolution := 4 // High
> printerName = "PDF995"
> printerSource = 2
> output = 1 //printer
> color = 1 // Monochrome
> trueTypeFonts = 2 // Download
> endwith
>
> Then I use the following code:
> set procedure to sample.rep
> r = new sampleReport()
> r.title = "Ira Berkowitz"
> r.render()
>
> Now, the report appears on the screen. In order to create the PDF I have to
click the print button. The chooseprinter dialog opens with the PDF995 print
driver already selected. If I click on ok then the PDF995 works perfectly. It
even emails me a copy of the PDF!!
>
> But, I want the whole operation to operate silently, without user
intervention - no chooseprinter dialog and no seeing the report on the screen.
If there are 10 rows in my rowset, the user would have to go through the print
routine 10 times. Any suggestions on what I am doing wrong or maybe it is not
possible.
Take a good look at the code that modifies the .INI file. Seriously.
That is part of what is needed. PDF995 needs to know to be in silent mode.
Ken
--
/(Opinions expressed are purely my own, not those of dataBased
Intelligence, Inc.)/
*Ken Mayer* [dBVIPS]
/Golden Stag Productions/
dBASE at goldenstag dot net
http://www.goldenstag.net/GSP
http://www.goldenstag.net/dbase/dBASEBooks.htm
|
| Post Reply
|
|
|