我正在构建一个纯 actionscript 项目,并想创建一个带有世界地图的 pdf 以显示我的数据。
可以创建地图并另存为图像,然后使用alivepdf嵌入pdf吗?
package
{
import MyButton;
import flash.display.*;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.external.*;
import flash.net.*;
import flash.net.FileReference;
import flash.system.Security;
import flash.utils.ByteArray;
import org.alivepdf.display.*;
import org.alivepdf.fonts.*;
import org.alivepdf.layout.*;
import org.alivepdf.pdf.*;
import org.alivepdf.saving.*;
public class WorldTest extends Sprite
{
private var saveButton:MyButton = new MyButton();
// declared of logo or imagen on top of the PDF's document.
[Embed(source="FCMap_World.swf", mimeType="application/octet-stream" )]
protected var jpgBytes:Class;
protected var pdf:PDF;
public function WorldTest() {
saveButton.y = 0;
addChild(saveButton);
this.addEventListener(MouseEvent.CLICK, onMouseClickEvent);
}
protected function onMouseClickEvent(event:Event):void{
pdf = new PDF(Orientation.LANDSCAPE, Unit.MM, Size.LETTER);
pdf.setDisplayMode(Display.FULL_WIDTH);
pdf.addPage();
pdf.addImage(new jpgBytes() as DisplayObject, null, 0, 0, 0);
var bytes:ByteArray = pdf.save(Method.LOCAL);
var file:FileReference = new FileReference();
file.save(bytes, "myPDF.pdf");
}
}
}