tambien hice esta clase , pero tampoco corrio
Código :
package com.prueba
{
public class Prueba
{
import org.alivepdf.colors.RGBColor;
import org.alivepdf.fonts.FontFamily;
import org.alivepdf.layout.Orientation;
import org.alivepdf.layout.Size;
import org.alivepdf.layout.Unit;
import org.alivepdf.pages.Page;
import org.alivepdf.pdf.PDF;
import org.alivepdf.saving.Method;
import flash.display.Sprite;
import flash.events.IOErrorEvent;
import flash.events.SecurityErrorEvent;
import flash.events.TextEvent;
import flash.net.FileReference;
import flash.text.StyleSheet;
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFieldType;
import flash.text.TextFormat;
import flash.utils.ByteArray;
private var pdf:PDF;
private var page:Page;
private var body:TextField;
private var title:TextField;
private var ba:ByteArray;
public function Main()
{
ba = new ByteArray();
title = new TextField();
title.type = TextFieldType.INPUT;
title.border = true;
title.borderColor = 0xefefef;
title.width = 500;
title.height = 50;
title.defaultTextFormat = new TextFormat( "Times", 40, 0x666666 );
title.x = 20;
title.y = 20;
title.text = "Title";
addChild( title );
body = new TextField();
body.type = TextFieldType.INPUT;
body.border = true;
body.borderColor = 0xefefef;
body.width = 500;
body.height = 200;
body.wordWrap = true;
body.multiline = true;
body.x = 20;
body.y = 75;
body.text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Praesent tempor ultricies eros. Sed erat ipsum, ultrices fermentum, euismod ac, commodo nec, tellus. Curabitur faucibus. Proin at sapien. Aliquam ullamcorper. \n\nAliquam tincidunt. Nunc blandit, mauris eu egestas consectetuer, enim lacus ullamcorper mi, sed dignissim nisl erat sed nulla. Donec nisl. Vestibulum volutpat congue odio. Maecenas nibh sem, congue vel, scelerisque non, placerat sed, nisl. Cras congue. Nam iaculis. Fusce adipiscing ipsum vitae sem lacinia congue. Pellentesque luctus ultrices nisi. Etiam ut mi nec arcu pellentesque sagittis. Duis accumsan est a nibh. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi vulputate turpis suscipit ipsum. Nunc posuere tortor id est. ";
body.defaultTextFormat = new TextFormat( "Arial", 12, 0x666666 );
body.setTextFormat(new TextFormat( "Arial", 12, 0x666666 ));
addChild( body );
var buttonCSS:StyleSheet = new StyleSheet();
buttonCSS.setStyle("a:link", {textDecoration: "none", fontSize: 24});
buttonCSS.setStyle("a:hover", {textDecoration: "underline", fontSize: 24});
var button:TextField = new TextField();
button.autoSize = TextFieldAutoSize.LEFT;
button.width = 200;
button.addEventListener(TextEvent.LINK, generatePDF );
button.htmlText = "<a href="event:generate">[ Generate PDF ]</a>";
button.styleSheet = buttonCSS;
button.x = body.x + body.width - button.textWidth;
button.y = body.y + body.height;
addChild( button);
}
private function generatePDF(event:TextEvent):void
{
page = new Page(Orientation.PORTRAIT, Unit.MM, Size.A4 );
pdf = new PDF();
pdf.addPage( page );
pdf.textStyle(new RGBColor(0x666666));
pdf.setFont( FontFamily.TIMES, "", 40 );
pdf.addText( title.text, title.x, title.y );
pdf.setFont( FontFamily.ARIAL, "", 12 );
pdf.setAuthor( "wezside" );
pdf.setXY( body.x, 30 );
pdf.addMultiCell( 150, 5, body.text );
pdf.setTitle( title.text );
ba = pdf.save( Method.LOCAL );
var file:FileReference = new FileReference();
file.addEventListener( IOErrorEvent.IO_ERROR, error );
file.addEventListener( SecurityErrorEvent.SECURITY_ERROR, error );
file.save( ba, title.text + ".pdf");
}
private function error( event:IOErrorEvent ):void
{
body.text = event.type + " | Error occured | " + event.text;
}
}
}
SI ALGUIEN SABE AMIGO QUE HAYA FUNCIONANDO AVISEN!!!!!
LA OTRA FORMA QUE ESTOY PENSANDO ES UTILIZAR EL ITEX con java pasarle los datos a este y luego generar el pdf
LO PEOR QUE LOS EJEMPLOS QUE ESTAN EL ALIVEPDF ESTAN SIN CODIGO Y DEMUESTRA QUE LA CLASES SI FUNCIONA
AAAAAAAAAAAAAAAAAAAA!! QUE RABIA