I keep begging you all to tune into my webcasts ;-)

Yes, the CE version runs the same code as the full version but with many
of the key features like Monitoring and Code Tracing disabled. There is
no reverse proxy in ANY edition of Zend Server. But I might be able to
craft one specifically for you if you think you will miss it too much.



mike.p@xxxxxxxx Cell: (408)679-1011 Office: (815)722-3454

Zend Server for IBM i Beta avilable at

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Kelly Cookson
Sent: Friday, February 26, 2010 9:15 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Zend PDF and the RPG Experiment

I wasn't aware there was free "community version" of the Zend Server for
IBM i.

I'm assuming the free version does NOT have the tools from the Zend

But does the community version do away with the reverse proxy?

Kelly Cookson
Senior Programmer/Analyst
Dot Foods, Inc.
217-773-4486 x12676

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Mike Pavlak
Sent: Friday, February 26, 2010 8:48 AM
To: Web Enabling the AS400 / iSeries
Subject: [WEB400] Zend PDF and the RPG Experiment


I am starting a new thread.

I was hoping someone would open the door for PHP. I would recommend
Zend Server for IBM i Community Edition. (GA, VERY soon, beta available
at link below) This is the no charge runtime for PHP and includes Zend
Framework. Why do I mention ZF? Simply because there is support for
Zend_PDF which supports a template approach to PDF generation. I am
working with some folks to put an nice example here. See this link for
the documentation on Zend_PDF for more details:

Once you start with PHP, you may never go back to Java ;-)

Of course, you can use FPDF in this environment too.

I am not aware of another solution to deliver PHP to IBM i short of Rob
Ward. But all I see of his previous site is a blog now. If you hear of
one I would like to know.

Below is a really BASIC example of Zend_PDF in action without a
template. It's not gl;amorous but I think you get the idea. There are
quite a few interesting components in this little hunk of code. In
addition to the Zend_PDF example is an example of how you can use the
library list in PHP, using PHP functions, DB2 error trapping, DB2 Fetch
of a record into an associative array (one of my favorites) and the use
of the root file system to drop the PDF. Once it is there you can do
with it what you want like attach it to an email, archive, etc.

Why buy tools when you can get this for free?


Mike Pavlak

Solutions Consultant

Zend Technologies, Inc.




Check out my blog at http://mikepavlak.blogspot.com/

Zend Server for IBM i Beta avilable at


// Bring in the PDF classes from Zend Framework

require_once 'Zend/Pdf.php';

// Read through detail records...

//Function to get Order Details...

function getConnection() {

$conn = "*LOCAL"; $name = "PHPUSER"; $pwd = "phpuser";

$LibraryList = array("i5_lib"=>"ZENDSMP010"); // Yes, you can
use a library list in PHP...

$db2_link = db2_connect($conn, $name, $pwd, $LibraryList);

if (!$db2_link) {

echo 'Connection failed: '.db2_stmt_error().' :



return $db2_link;


function getSales($orderNumber){


global $db2_link; // Share connection to DB...

$Sales_Rec = db2_exec($db2_link, $sql); // Execute the

if (!$Sales_Rec) {

echo "SQL statement $sql Call Failed: " .db2_stmt_error().'
: '.db2_stmt_errormsg();



// Roll through the sales records for this order and
calculate values...

/* echo '<table><tr><td>Order Number</td><td>Line Number</td>

<td>Product Number</td><td>Quantity</td><td>Line
Sales</td>'; */

while ($row=db2_fetch_assoc($Sales_Rec)) {








return $return;

// echo "</table>";


$db2_link = getConnection();

$return = getSales(5); //hard code order number for convenience...

// Create a new PDF object

$pdf = new Zend_Pdf();

// Create a new PDF page

$pdf->pages[] = ($nextPage =

// Create a new font

$font =

// Apply the font

$nextPage->setFont($font, 20);

// Print the first line of data on the page

$dataLine = "Sales Detail report for order 5\n";

$printLine = 576;

$nextPage->drawText($dataLine, 72, $printLine);

// Print the remaining lines of data

foreach ($return as $index=> $value)


$printLine -= 21;

$amount = sprintf("$%.2f", $value[4]);

$text="Order: {$value[0]} Line: {$value[1]}
Product: {$value[2]}

Quantity: {$value[3]} Amount:

$nextPage->drawText($text, 72, $printLine);


// Save the PDF in directory /tmp/pdf



echo "Order printed";

/* */


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].