首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AlivePDF中的字包装

AlivePDF中的字包装
EN

Stack Overflow用户
提问于 2010-02-15 05:44:11
回答 1查看 2.1K关注 0票数 1

当我显示一些文本,它是以1行,只有这是为什么整个文本是不可见的pdf。如果txt是更多,它应该自动下一行。请参阅下面的代码

代码语言:javascript
复制
<?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显示文字的解决方案,我们可以给我们的文字字体大小吗?谢谢

EN

回答 1

Stack Overflow用户

发布于 2010-02-15 06:37:38

addText没有包装。使用writeText方法代替。

来自文档

addText()方法将在给定的坐标下输出文本。没有字包装是做的。

链接页面具有这两种方法的代码示例。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2264219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档