English 中文(简体)
有可能从AIR射线仪向OS输出一个PDF。
原标题:Is it possible to export a PDF from an AIR app for iOS

我从闪电5.5号建筑,用AIR3.1出口,并通过由 Apple果组建的企业(转口我批准)分发。

我现在试图让人民抵抗力量(利用AlivePDF)向iPad出口一些how,要么出口到iBooks,要么在Safari开办。

这是我用上台式版的 app。 尽管描述非常令人迷惑,但还是取得了工作。 我不知道如何改变这种状况,并把它变成一个议会。

//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] + "
";
  }   
  return returnString;
}

var pdf:PDF = new PDF(); 

pdf.setDisplayMode (Display.REAL);     
pdf.addPage(); 

pdf.writeText(7, convertString(  MovieClip(root).selectedProducts.filter(noEmpty).join( 
 )    ));

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");
}
最佳回答

在与AIROS公司进行了一些工作之后,我要说,你的问题是,你需要改变如何保存和储存档案。

You need to save the file to the apps storage directory with something like this that I used to store a jpg image:

f = File.documentsDirectory.resolvePath(imagename+".jpg");      
stream = new FileStream();
stream.open(f, FileMode.WRITE);                                         
j = new JPGEncoder(80);     
bytes = new ByteArray();
bytes = j.encode(snapShot.bitmapData);
stream.writeBytes(bytes, 0, bytes.bytesAvailable);
stream.close();

I m not sure how or if it s even possible through AIR to send the pdf to iBooks. You could use StageWebView within your app though to display the PDF.

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签