SDK Portfolio 实际上取代了 AlivePDF?如何在 Flash Builder 中使用这个新库创建 .pdf 文件?

The SDK Portfolio actually replaces the AlivePDF? How to create a .pdf file using this new library in Flash Builder?

SDK 组合实际上取代了 AlivePDF?如何在 Flash Builder 中使用这个新库创建 .pdf 文件?

我使用 AlivePDF 组件进行了 Flex 实验,不幸的是,由于 navigateToURL 和 sendToURL 方法的新限制,这个遗留组件不再用于生成文件。

根据我的研究,SDK 组合(在 Adob​​e 中)为 Acrobat 平台提供了一个更完整的库,但是,通过与 Flash Builder 4.7 集成,AlivePDF 中存在的简单文件创建功能在投资组合(API 或框架)。

我将post这里用AlivePDF做一个简单的例子,想知道是否有对应的Portfolio:

         import org.alivepdf.pdf.PDF;
         // ...
         var pdfTab: PDF PDF = new (Orientation.LANDSCAPE, Unit.MM, Size.A4);
         // ...
         pdfTab.addPage ();
         pdfTab.setFont (myfont.family, myfont.style, myfont.height);
         pdfTab.textStyle (mycolor.text);
         pdfTab.beginFill (mycolor.background);
         pdfTab.addText (text, xposition, yposition);
         pdfTab.endFill ();
         pdfTab.newLine (HEIGHT * 1.5);
         pdfTab.setDisplayMode (Display.FULL_WIDTH, Layout.ONE_COLUMN,
          PageMode.USE_THUMBS);
         pdfTab.save (Method.LOCAL, urlService, Download.INLINE, fileName
          + "& Ext = pdf & mime = application / pdf");

AlivePDF 仍然适用于我。您可以像这样将它与 FileReference 一起使用:

var bytes:ByteArray = pdf.save(Method.LOCAL);
saveData(bytes, fileName);

public static function saveData(data:*, filename: String, parent: Sprite): Alert
{
    function closeHandler(event: CloseEvent): void
    {
        if (event.detail == Alert.YES)
        {
            // due to security restrictions FileReference.save()
            // can only be invoked upon user interaction
            var fileRef: FileReference = new FileReference();
            fileRef.save(data, filename);
        }
    }        
    var alert: Alert = Alert.show(
        'Are you sure you want to save the file ' + filename + ' ?', 
        'Confirmation', Alert.YES | Alert.NO, parent, closeHandler);
    return alert;
}