Images to PDF using Zen Report

Zen report can create PDF document (https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=GRPT_xslfo_pdf_config ). Store your images in the table. Pass session id to the Zen report. Zen report will select images using SQL. The <img> element will insert images to the report:

<img width="100%" src="!@ImageName" contentHeight="scale-to-fit" contentWidth="#(..ImageWidth)#" style="position:absolute" content-type="image/jpg"/> 

Do the following (See the attachment image_to_pdf_using_zen_reports.doc for details):

  1. Zen report settings to configure PDF report 
  2. Create an image table to store image names
  3. Create Zen PDF report
  4. Execute the following from the terminal to create PDF document
 set tReport = ##class(Training.Zen.ZenImageToPDF).%New()
 //Insert image name to the table
 set tImageTable = ##class(Training.Tbl.ZenImageTable).%New()
 set tImageTable.DateCreated=$ZDateTime($H,3)
 set tImageTable.ImageName = "Chrysanthemum.jpg"   
                                       
 set tImageTable.SessionId = "1"                     
 set mySC = tImageTable.%Save()
 set tImageTable=""
 
 //Repeat this to enter more images
 //Header
 do tReport.arHeader.SetAt("Report ID","1")
 do tReport.arHeader.SetAt("Report Name","2")
 do tReport.arHeader.SetAt(""_$ZDateTime($H,3),"3")
                   
 set tReport.ReportSessionId = "1"                 
 set tReport.BaseUrl="http://localhost:"_tReport.HSPort_"/csp/healthshare/training/ZenImages/"
 set tSC = tReport.GenerateReport("c:\temp\MyZenPdfReport1.pdf",2)
 //Or to create PDF stream
​ //set tSC = tReport.GenerateReportToStream(.tStream,2)
                   
 Quit tSC
  • + 2
  • 0
  • 321
  • 0