pdflib textflow

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);

最後還有更牛的,你們感受下




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章