Apache flex AlivePDF中的Wordwrap
当我显示一些文本时,它只显示一行,这就是原因 整个文本在pdf中不可见。 如果txt值大于此值,则应在下一行自动执行。 请参阅下面的代码Apache flex AlivePDF中的Wordwrap,apache-flex,pdf,air,alivepdf,Apache Flex,Pdf,Air,Alivepdf,当我显示一些文本时,它只显示一行,这就是原因 整个文本在pdf中不可见。 如果txt值大于此值,则应在下一行自动执行。 请参阅下面的代码 <?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal" > <mx:Script> <![CDATA
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal" >
<mx:Script>
<![CDATA[
import org.alivepdf.pdf.PDF;
import org.alivepdf.saving.Method;
import org.alivepdf.fonts.*;
import org.alivepdf.pages.Page;
import org.alivepdf.display.Display;
import org.alivepdf.layout.*;
[Bindable] private var message:String;
private var pdf:PDF;
private var file:File;
private function submitData():void {
message+='The Text Value is ' + t1.text + ' The second
text value is' + t2.text +
'it is testing message it is testing message it is
testing message '+
'The Text Value is ' + t1.text + ' The second text value
is' + t2.text+
'it is testing message it is testing message it is
testing message ';
}
public function generate ():void
{
submitData();
var pdf:PDF = new PDF( Orientation.PORTRAIT, Unit.MM,
Size.A4 );
pdf.setDisplayMode( Display.FULL_PAGE,
Layout.SINGLE_PAGE );
var newPage:Page = new Page (Orientation.PORTRAIT,
Unit.MM, Size.A4 );
pdf.addPage( newPage );
//pdf.setFont(IFont,12);
pdf.addText(message,5,15);
pdf.addPage();
var fs:FileStream = new FileStream();
file =
File.desktopDirectory.resolvePath("testPage.pdf");
fs.open( file, FileMode.WRITE);
var bytes:ByteArray = pdf.save(Method.LOCAL);
fs.writeBytes(bytes);
fs.close();
}
]]>
</mx:Script>
<mx:TextInput id="t1" text="txt111" />
<mx:TextInput id="t2" text="txt222"/>
<mx:Button click="generate()" label="Generate PDF"
horizontalCenter="0" verticalCenter="0"/>
</mx:WindowedApplication>
是否有任何解决方案以pdf格式显示文本,我们是否也可以为我们的用户提供字体大小
文本?
谢谢,
addText
没有包装。改用writeText
方法
从:
addText()
方法将在给定坐标处输出文本未完成单词包装
链接页面包含两种方法的代码示例