Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically print report to .PDF, Footpad! 1

Status
Not open for further replies.

almir

Technical User
Apr 18, 2000
46
BA
Hello to all!

I have read that Footpad had resolved automatic .PDF file generation from PDOX report.

I would like to get an example of that, since my company publish updated reports from the database on a regular basis.

Automation of .PDF creation would help us a lot.
It wold be great if there would be a way to automatically protect .PDF document.

Footpad, thanks in advance.

Al

 
Al,

It depends on the type of problem you're running into; I've seen several, but they're all fairly easy to resolve.

If you're looking for code that automatically published Paradox reports to Acrobat PDF files, I'll need to dig that up. (IT shouldn't take long.)

If you're having problems printing reports to PDF files, e.g. the table frames appear, but the field values are hard to read, that can be handled by changing a setting on the Details tab of the Print to PDF File dialog. Specifically, the Resolution setting needs to be as high as it can go. By default, it's set to the lowest available resolution (for performance), but you need to change it to the highest available setting.

If you're looking for ways to automatically set the target filename, well, that can also be handled through a bit of ObjectPAL. Again, I'll need to mock up a working example.

Can you give me a few more details about what you're looking for? This will help me use my time most wisely.

Hoping to help...

-- Lance
 
Footpad,

Thank you for so fast answer.

What I would like to get is a piece of code that makes a .PDF file from the report. This would include .PDF file, filename (and, eventually, protection) generation.

I want my users to get just final .PDF file, without opening .RSL or .RDL. Reason is that we publish our reports in .PDF periodically at our site.

We are wondering about printing reports to .PDF, straightly into the web folder.

By the way, I have no problems, such as resolution, fonts, table frames etc.

I know this is too much, but it would be great if someone figures out how to do it.

Hope you have enough details.

All the best,

Almir
 

I know this is an old thread, but I never saw a the resolution. I also would like to be able to automatically print a pdf version of a Paradox report.

Lance - did you ever dig up that code?

Lynn
 
Lynn,

Me bad! I got sidetracked by some stuff in my personal life (moving, marriage, parenting, that sort of thing).

I sincerely apologize and will try to get that online later this week.

Out of curiosity, which version of Acrobat are you using? Which printer driver would you like to use? (There are two and the technique is different for both).

Again, I'm sorry for letting this slip through the cracks.

Thanks for keeping an eye open and for keeping me honest. :)

-- Lance
 
Lance,

I was hoping for something that could be used in a Runtime application where I don't know what printers they have. And to assume they only had acrobat reader.

Oh, well. If it will only work on my machine that is some help. I have a HP LaserJet 5 (not Postscript) and an HP Inkjet 1220c and Acrobat 4.0 (or 4 point something).

Lynn
 
To do this nicely you will need to use the SDK either from Adobe or 3rd party vendors.
Here is a quick and dirty way. However, you do need the FULL version of Acrobat, not the reader.

How it works?
The codes below mimic how you would create and save Pdox report in PDF format manually.
Similar to keyboard macros in Excel.

1. Create report
2. Print to screen
3. Use Sendkeys command to mimic File | Print menu commands
4. Type in pdf file name.
5. Done!

How to use the codes?

Create a new script.
Copy and paste the codes below.
Replace:
YourTable.DB
YourReport.rdl
YourPDF.PDF
With your valid names.

Run script!

Good Luck

Joe

; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Var
sPDFWriterDevice String
EndVar
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Proc SetPrinter(sPDFWriterDevice String) Logical ;Set Printer device driver
Var
arPrinters Array[] String

lFound Logical

PrintInfo PrinterInfo

sPtrData String

siElement SmallInt
EndVar

;Get current output device
PrinterGetInfo(PrintInfo) ;Get Current printer device

If PrintInfo.DeviceName = sPDFWriterDevice Then ;If current output device is PDF Writer, quit
Return True
EndIf

eNumPrinters(arPrinters) ;Get all available printers

lFound = False ;Find PDF Writer device
For siElement From 1 To arPrinters.Size()
sPtrData = arPrinters[siElement]
sPtrData = sPtrData.Upper()
If Match(sPtrData,".."+sPDFWriterDevice.Upper()+"..") Then ;Find PDF device driver
lFound = True
QuitLoop
EndIf
EndFor

If Not lFound Then ;Quit if no PDF Writer device is found
MsgStop("Error","Device "+sPDFWriterDevice+" is not found.")
Return False
EndIf

If Not PrinterSetCurrent(sPtrData) Then ;Set current printer to PDF Writer device driver
Return False
EndIf

Return True

EndProc
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
method run(var eventInfo Event)
Var
RptInfo ReportPrintInfo
Rpt Report
PrintInfo PrinterInfo
sPDFWriterDevice String
FS FileSystem
stmpReportTbl String
sReportFile String
sFTPPath String
sPDFName String
EndVar

sPDFWriterDevice = "Acrobat PDFWriter" ;Device name installed on your computer

stmpReportTbl = "YourTable.DB" ;Report Data table name
sReportFile = "YourReport.rdl" ;Report name (delivered)
sFTPPath = "C:\\" ;PDF location
sPDFName = "YourPDF.PDF" ;PDF name

If Not SetPrinter(sPDFWriterDevice) Then ;Set current outpot device to PDF Writer
MsgStop("Error","Cannot set printer device driver.")
Return
EndIf

If IsFile(sFTPPath+sPDFName) Then ;Delete existing PDF file of the same name
FS.Delete(sFTPPath+sPDFName)
EndIf

RptInfo.MasterTable = stmpReportTbl ;Report data table name
RptInfo.Name = sReportFile ;Report name
RptInfo_Orient = PrintLandscape ;Set paper orientation
Rpt.Open(RptInfo) ;Open report on screen

Sleep(1000) ;Wait for program to catch up

;Initiate key strokes to select File | Print menu options
Sendkeys("{Delay 100}%FP{enter}{Delay 100}"+sFTPPath+sPDFName+"~") ;Save report as pdf

Sleep(1000) ;Wait for program to catch up

Rpt.Close() ;Close report






 
Joe,

Thanks. I have not gotten a chance to try it yet, perhaps this weekend.

Lynn
 
I have used the code provided for automatically creating PDF files successfully when I create a report that is based on a single record. However, I have another application where I am creating summary reports that have no detail, and SOMETIMES (not always) the PDF appears with no data (just the shell of the report) or with the text "squished" so you cannot read it.

I am using Paradox 10 with all patches on a Novell network with Windows XP.

Any ideas?

Thanks
 
Have you checked that the height of the design object is tall enough to display our text?

Also, have you checked that your 'fit height' and 'word wrap' settings are working together?

Fit Height on, should have word wrap on; or reversed depending on your needs.


PDF995 is only $9.95, and extremely easy to control from within Paradox.

I've not had the squished issue since converting to pdf995, and ensuring the wrap/height issues above.



Tony McGuire
"It's not about having enough time. It's about priorities.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top