I have an app that is built from Flash CS5.5, exported using AIR3.1 and distributed through the Enterprise setup from Apple (allows me to bypass appstore approval).
I'm now trying to have a PDF (generated using AlivePDF) exported somehow into the iPad, either into iBooks or just have it opened in Safari.
This is what I'm using for my desktop version of the app. Although the scripting is very messy it gets the job done. I just don't know how to convert this over and make it work on an iPad
//Populate listbox component from array
function noEmpty(item:*, index:int, array:Array):Boolean{
return item != undefined;
}
for(var i:int = 0; i < MovieClip(root).selectedProducts.length; i++) {
if(MovieClip(root).selectedProducts[i] != undefined){
selectedProductsText.dataProvider.addItem({label: MovieClip(root).selectedProducts[i]});
}
}
var myTextFormat:TextFormat = new TextFormat();
myTextFormat.size = 20;
myTextFormat.font = "Arial";
myTextFormat.color = 0x000000;
myTextFormat.leftMargin = 30;
selectedProductsText.rowHeight = 40;
selectedProductsText.setRendererStyle("textFormat", myTextFormat);
//AlivePDF, generate PDF
import org.alivepdf.pdf.PDF;
import org.alivepdf.layout.Orientation;
import org.alivepdf.layout.Size;
import org.alivepdf.layout.Unit;
import org.alivepdf.display.Display;
import org.alivepdf.saving.Method;
import org.alivepdf.fonts.FontFamily;
import org.alivepdf.fonts.Style;
import org.alivepdf.colors.RGBColor;
import com.adobe.images.*;
function convertString(_value:String):String
{
var returnString:String = "";
var _chr:String = String.fromCharCode(13);
var tempArray:Array = _value.split(_chr);
for(var i:uint = 0; i < tempArray.length; i++)
{
returnString += tempArray[i] + "\n";
}
return returnString;
}
var pdf:PDF = new PDF();
pdf.setDisplayMode (Display.REAL);
pdf.addPage();
pdf.writeText(7, convertString( MovieClip(root).selectedProducts.filter(noEmpty).join('\n') ));
var buffer:ByteArray = pdf.save(Method.LOCAL);
var file:FileReference = new FileReference();
//save PDF button
btnPdf.addEventListener( MouseEvent.CLICK, generatePDF );
function generatePDF ( e:MouseEvent )
{
file.save(buffer, "Product Selection List.pdf");
}