Home Page Creating PDF files with XSL-FO and REALbasic
Home
                              XSL-FO Server
                            • Getting started
                            • Versions
                            • How to
                            • XSL-FO Editor
                            • XSL-FO resources
                            • XSL-FO in REALbasic
                            • XSL-FO in Php
                            • XSL-FO in VB 6
                            • XSL-FO in .NET
                            • XSL-FO in Ruby
                            • XSL-FO in Delphi
                            • Usage with APEX
                            • Professional license
                            • XSL-FO in REALbasic

                              The following script shows how you can call the FOP server from a REALbasic program:

                              Dim socket as New HTTPSocket
                              Dim file as New FolderItem("output.pdf") // download the PDF output to this file
                              Dim xml as String
                              Dim template as String
                              Dim result as boolean
                              Dim serverURL as String

                              // this is the FOP server
                              serverURL="http://localhost:8087/J4LFOPServer/servlet"

                              // this is the xsl-fo file
                              template ="departmentEmployees.fo"

                              // input xml data
                              xml="<?xml version=""1.0"" encoding=""iso-8859-1""?> <departments><department><departmentName>R&amp;D</departmentName> <person> <name>John Schmidt</name> "
                              xml=xml +"<address>Red street 3</address> <status>A</status> </person> <person> <name>Paul Bones</name> <address>White street 5</address> <status>A</status> "
                              xml=xml +"</person> <person> <name>Mark Mayer</name> <address>Blue street 5</address> <status>A</status> </person> <person> <name>Janet Black</name> "
                              xml=xml +"<address>Black street 8</address> <status>I</status> </person></department><department> <departmentName>Sales</departmentName> <person> "
                              xml=xml +"<name>Juan Gomez</name> <address>Green street 3</address> <status>A</status> </person> <person> <name>Juliet Bones</name> <address>White street 5</address> "
                              xml=xml +" <status>A</status> </person></department></departments>"

                              // call server now
                              socket.SetPostContent(xml , "text/xml")
                              result=socket.post(serverURL+"?TEMPLATE="+template, file, 60)