Report output to PDF

Hello, I want to export my xojo report output to pdf. I have got dynapdf plugin. Can somebody help me with some sample code to export report output to pdf ?

Thanks in advance.

http://www.monkeybreadsoftware.de/xojo/plugin-dynapdf.shtml

I looked at the link and did not find things which I was looking for. My Xojo report is taking data from database. I need to convert that output to pdf.

Are you wanting to create everything about the PDF in code? That’s often very challenging. It can be easier to design a PDF template in a word processor then fill it in with the data. I use a program called PDF Editor Pro to create the fields in the PDF. The MBS plug-in comes with an example of code that will fill in the fields.

Deepak, maybe you try first with checking the example projects.
We include 144 example projects currently.

A few show how to use table class which may help for reports.

Is it not possible to export xojo report output directly to pdf without creating PDF template ?

It’s possible. I was merely suggesting another alternative.

how can I do that ? Can you help ?

Deepak, do you write for Mac Platform only?

others as well like windows…

… use the dark side of force in using shell console :slight_smile:

On windows you still need a PDFprinter (I suggest http://www.pdfforge.org/pdfcreator) but on Mac (and Linux aswell) cupsfilter is a handy solution for creating PDFs directly. Just check out this snippet and replace “EXPORT” with your HTML formated output string and “filename” with the export Filename.


Dim f as FolderItem
Dim t as TextOutputStream
Dim s as new Shell
Dim fileplace as string
Dim filename as string
Dim EXPORT as String    // Your Output String as HTML
    
f = SpecialFolder.Temporary.Child(filename)
t = f.CreateTextFile
t.Write ConvertEncoding(EXPORT, Encodings.UTF8)
t.close

#if TargetWin32
    
  if f <> nil then
    fileplace = "RUNDLL32.EXE MSHTML.DLL,PrintHTML """ + f.Parent.ShellPath + "\" + filename + """"
    s.execute fileplace
  end if

#elseif TargetMacOS
        
  if f <> nil then
    fileplace = "/usr/sbin/cupsfilter "+ f.Parent.ShellPath  + "/" + filename + " > " + f.Parent.ShellPath + "/" + filename.NthField(".",1) + ".pdf"
    s.execute fileplace
    s.execute("open " + f.Parent.ShellPath  + "/" + filename.NthField(".",1) + ".pdf")
  end if

#endif

I understood that dynapdf works for all the three platform. Is it true ? Also, do we have some example code to convert/export xojo report output to pdf using dynapdf ?

we have no examples for connecting to report engine.
If you report using Bob Keeney’s Shorts product, you can use DynaPDF there.

[quote=39518:@Christian Schmitz]we have no examples for connecting to report engine.
If you report using Bob Keeney’s Shorts product, you can use DynaPDF there.[/quote]

Christian have you a sample of dyna pdf for printing a standard xojo report document?

I don’t think so. We can just use NSPrintInfoMBS class to modify printer setup on Mac to redirect to PDF file.

That’s a great tip!

see
https://www.mbsplugins.de/archive/2014-02-24/Print_to_PDF_File_on_Mac_OS_X_