John Noble
2008-11-05 12:17:49 UTC
This question is perhaps really directed at Ken.
Here is my code based on Ken's code from pages 353 & 354 of his Reports
Book.
// The following variables may need to be changed pending on where .ini file
is stored and location of PDF directories
private oReg, nError, hOut, cNewPath, aFiles, oINI, fMessage, aParams
private lDone, oFile
set procedure to :samples:registry.prg additive
#include <winreg.h>
oReg = new registry( HKEY_LOCAL_MACHINE , "SOFTWARE\pdf995", false)
nError = oReg.error
release object oReg
close procedure :samples:registry.prg
if nError > 0
msgbox("PDF995 is not installed, cannot generate PDF for email", "PDF
Error", 16)
return
endif
cNewPath = "C:\"
set procedure to :DUFLP:ini.cc addi
oINI = new ini( "C:\pdf995\res\pdf995.ini")
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()
set procedure to FM_01.rep addi // this can be any report
rep = new FM_01REPORT()
rep.output := 1 // printer
rep.printer.printersource := 2 // Specific
rep.printer.printerName := "PDF995"
rep.printer.resolution := 4 // High
rep.title := "Report1"
rep.render() // send to print
documentName = trim(rep.title)
oFile = new File()
lDone = false
do while not lDone
if not file (cNewPath + documentName + ".pdf")
sleep 3
loop
else // file exists but is it big enough. If it s not at least 120k
then its not.
nSize = oFile.size(hOut.cPath + documentName) / 1024 // THE
PROBLEM IS HERE
if int(nSize) < 120
sleep 3
loop
else
lDone = true
endif
endif
if lDone
exit
endif
enddo
I am able to produce the PDF. The problem Im experiencing lies in the code
that checks the size of the pdf in question.
On the line: nSize = oFile.size(hOut.cPath + documentName) / 1024
It does not recognise the hOut variable (Variabke Undefined hout).
Can anyone advise?
Thanks,
J
Here is my code based on Ken's code from pages 353 & 354 of his Reports
Book.
// The following variables may need to be changed pending on where .ini file
is stored and location of PDF directories
private oReg, nError, hOut, cNewPath, aFiles, oINI, fMessage, aParams
private lDone, oFile
set procedure to :samples:registry.prg additive
#include <winreg.h>
oReg = new registry( HKEY_LOCAL_MACHINE , "SOFTWARE\pdf995", false)
nError = oReg.error
release object oReg
close procedure :samples:registry.prg
if nError > 0
msgbox("PDF995 is not installed, cannot generate PDF for email", "PDF
Error", 16)
return
endif
cNewPath = "C:\"
set procedure to :DUFLP:ini.cc addi
oINI = new ini( "C:\pdf995\res\pdf995.ini")
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()
set procedure to FM_01.rep addi // this can be any report
rep = new FM_01REPORT()
rep.output := 1 // printer
rep.printer.printersource := 2 // Specific
rep.printer.printerName := "PDF995"
rep.printer.resolution := 4 // High
rep.title := "Report1"
rep.render() // send to print
documentName = trim(rep.title)
oFile = new File()
lDone = false
do while not lDone
if not file (cNewPath + documentName + ".pdf")
sleep 3
loop
else // file exists but is it big enough. If it s not at least 120k
then its not.
nSize = oFile.size(hOut.cPath + documentName) / 1024 // THE
PROBLEM IS HERE
if int(nSize) < 120
sleep 3
loop
else
lDone = true
endif
endif
if lDone
exit
endif
enddo
I am able to produce the PDF. The problem Im experiencing lies in the code
that checks the size of the pdf in question.
On the line: nSize = oFile.size(hOut.cPath + documentName) / 1024
It does not recognise the hOut variable (Variabke Undefined hout).
Can anyone advise?
Thanks,
J