For the PDF reporting capabilities of the M2T we have experimented with an open source Flex API called AlivePDF. AlivePDF is an open-source ActionScript 3 (Flash, Flex, AIR) PDF generation library.
It allows you to generate PDF's client-side.
All information can be found at:
http://alivepdf.bytearray.org/

it allows the management of multiple pages documents, insertion of:

  • images, texts, colors, links,
  • header and footer definition,
  • attachments, notes, bookmarks,
  • management of different layout and styles, page formats,
  • complex data structures,
  • graphical elements like rectangles, circles etc ... etc.

The pdf object that represents the content can be sent to a PHP server that creates the PDF document and sends it back to the client side, allowing the Flex client application to open it, print it or simply save it.

Video tutorials can be found here:
http://alivepdf.bytearray.org/wp-content/tutorials/alivepdf-tutorial-flex-application.swf

http://alivepdf.bytearray.org/wp-content/tutorials/alivepdf-tutorial-getting-started.swf

Here is a simple example of how to use AlivePDF
(from: http://www.rogue-development.com/blog2/2007/08/alivepdf-flexair-example/)

public class ProjectPDFExporter
{
private var filename:String = “test.pdf”;
private var pdf:PDF;

public function exportPdf(filename:String) : void
{
this.filename = filename;

pdf = new PDF();

pdf.addEventListener(Event.COMPLETE, onComplete);

pdf.setDisplayMode (Display.FULL_PAGE,
Layout.SINGLE_PAGE);


pdf.addPage();
pdf.setFont( FontFamily.ARIAL );
pdf.addText(”My Text”,1,10);
pdf.setFont( FontFamily.ARIAL , “”, 32);
pdf.addText(”Some more text”,10,30);
pdf.finish();
}

protected function onComplete(event:Event)
{
var f:FileStream = new FileStream();
var file:File = File.applicationStorageDirectory.resolve( filename );
f.open( file, FileMode.WRITE);
var bytes:ByteArray = pdf.getPDF()
f.writeBytes(bytes);
f.close();
}
}

Another library that can be used for PDF generation is FPDF:
(http://www.fpdf.org/?lang=en)

FPDF is a PHP class which allows to generate PDF files with pure PHP,
that is to say without using the PDFlib library.
F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.

FPDF has other advantages: high level functions. Here is a list of its main features:

  • Choice of measure unit, page format and margins
  • Page header and footer management
  • Automatic page break
  • Automatic line break and text justification
  • Image support (JPEG, PNG and GIF)
  • Colors
  • Links
  • TrueType, Type1 and encoding support
  • Page compression

FPDF requires no extension (except zlib to activate compression and GD for GIF support)
and works with PHP4 and PHP5.

  Page Info My Prefs Log in
This page (revision-2) last changed on 18:24 25-Mar-2017 by Mirela.
 

Referenced by
AS 3 Flex Develop...

JSPWiki v2.4.102
[RSS]