pdflib textflow

来源:互联网 发布:知乎回答怎么复制 编辑:程序博客网 时间:2024/04/28 19:12

leadercheck问题,发现pdflib真心强大

首先pdflib支持在Wrapping Text around Paths and Images

效果图如下:


其次pdflib支持Placing text in two fitboxes on multiplepages.

效果图如下:


代码如下:

/* Loop until all of the text is placed; create new pages as long as more text needs* to be placed. Two columns will be created on all pages.*/do{String optlist = "verticalalign=justify linespreadlimit=120%";p.begin_page_ext(0, 0, "width=a4.width height=a4.height");/* Fill the first column */result = p.fit_textflow(tf, llx1, lly1, urx1, ury1, optlist);/* Fill the second column if we have more text*/if (!result.equals("_stop"))result = p.fit_textflow(tf, llx2, lly2, urx2, ury2, optlist);p.end_page_ext("");/* "_boxfull" means we must continue because there is more text;* "_nextpage" is interpreted as "start new column"*/} while (result.equals("_boxfull") || result.equals("_nextpage"));/* Check for errors */if (!result.equals("_stop")){/* "_boxempty" happens if the box is very small and doesn't hold any text at all.*/if (result.equals( "_boxempty"))throw new Exception("Error: " + p.get_errmsg());else{/* Any other return value is a user exit caused by the "return" option;* this requires dedicated code to deal with.*/}}p.delete_textflow(tf);

最后还有更牛的,你们感受下




0 0
原创粉丝点击