无论我尝试什么,我都无法在可以看到的PDF上写任何内容,尽管在记事本中查看结果PDF时文本就在那里。我不做什么?这是一段代码片段。变量tf是类中定义的TextField。这适用于SWF,而不是PDF。
private function onButtonClick(e:MouseEvent):void {
tf.text = "Hey, you clicked the button!";
myPDF = new PDF(Orientation.PORTRAIT, Unit.INCHES, Size.A4);
myPDF.setDisplayMode(Display.FULL_PAGE, Layout.SINGLE_PAGE)
myPDF.addPage();
myPDF.addText(tf.text, 20, 20 );
var filename:String = "Test-file.pdf";
var f:FileStream = new FileStream();
var file:File = File.userDirectory.resolvePath(filename);
f.open(file, FileMode.WRITE);
var bytes:ByteArray = myPDF.save(Method.LOCAL);
f.writeBytes(bytes);
f.close();
}