Omnis Technical Note TNPR0008 May 2007

Save a report as PDF

For Omnis Studio 4
By Götz Krija

When you are developing with Omnis Studio on the Mac platform you have got one great advantage: you can print directly to a PDF file.

PDF report

Under Mac OS X you can use the property $osxdesttype to set the print destination to kPDF, rather than the default printer. You must assign a valid path to the $osxdestname property and the report will be saved directly to a PDF file. For example, the following code could be used to create a PDF report:

; set destination and path
Do $cdevice.$assign($devices.Printer)
Do $reports.MyReport.$osxdesttype.$assign(kPDF)
Do FileOps.$putfilename(path,'Save PDF file')
Do $reports.MyReport.$osxdestname.$assign(path)
; print report
Do $reports.MyReport.$open() Returns reportRef
Do reportRef.$printrecord()
Do reportRef.$endprint()
; add pdf extension if necessary
Do FileOps.$splitpathname(path,drive,dir,filename,ext)
If ext<>'pdf'
Do FileOps.$rename(path,con(path,'.pdf'))
End If

If you are looking for a cross-platform solution for printing to PDF from Omnis, then you may be able to find a third-party plug-in to do this.

Search Omnis Developer Resources

 

Hit enter to search

X