pdf頁首頁尾

2021-10-23 19:13:33 字數 1662 閱讀 2061

*/

public class itextlist catch (ioexception e)

font chinese = new font(fontchinese, 10, font.normal);

/*** headerfooter的第2個引數為非false時代表列印頁碼

* 頁首頁尾中也可以加入,並非只能是文字

*/headerfooter header=new headerfooter(new phrase("這僅僅是個頁首,頁碼在頁尾處",chinese),false);

//設定是否有邊框等// header.setborder(rectangle.no_border);

header.setborder(rectangle.bottom);

header.setalignment(1);

header.setbordercolor(color.red);

doc.setheader(header);

headerfooter footer=new headerfooter(new phrase("-",chinese),new phrase("-",chinese));

/*** 0是靠左

* 1是居中

* 2是居右

*/footer.setalignment(1);

footer.setbordercolor(color.red);

footer.setborder(rectangle.box);

doc.setfooter(footer);

/*** 頁首頁尾的設定一定要在open前設定好

*/doc.open();

/*** true:代表要排序,10代表序號與文字之間的間距

* false:代表不排序,則文字前的符號為"-"

*/list itextlist=new list(true,10);

/*** 也可以改變列表的符號[可選]

* $$$$$$$$$$$

* 要改變列表符號時,上面的list構造方法第一引數值必須為false

* $$$$$$$$$$$

* 可以使用字串,chunk,image等作列表符號,如下

*/"*");

listitem firstitem=new listitem("first paragraph");

listitem seconditem=new listitem("second paragraph");

listitem thirditem=new listitem("third paragraph");

itextlist.add(firstitem);

itextlist.add(seconditem);

itextlist.add(thirditem);

doc.add(itextlist);

annotation annotation=new annotation("what's this?","it's a tree and it is not a big");

doc.add(annotation);

doc.close();

} catch (filenotfoundexception e) catch (documentexception e)

}

C 新增PDF頁首 頁尾

概述 頁首頁尾是一篇完整 精緻的文件的重要組成部分。在頁首頁尾處,可以呈現的內容很多,如公司名稱 頁碼 工作表名 日期 如logo 標記等。在下面的文章中,將介紹如何在pdf中新增頁首頁尾。通過 測試,新增頁首頁尾可以分兩種情況來實現效果 1.通過新增新的一頁,在新建的頁面上來新增頁首頁尾 2.通過...

VC設定頁首頁尾

準備呼叫documents add函式了,需要定義4個引數。從word巨集可以看出來3個引數的型別為 template字元,newtemplate布林,documenttype數值 但add函式還需要乙個引數是visible,傻子也能看出來這個值表示是否顯示出新文件 並且可以給預設值 vt empt...

python docx修改頁首頁尾

官方文件肯定是最正規的,但是有點簡單,有必要記一下,網上資料較少。開啟乙個文件後,頁首和頁尾是跟著 節 走的,也就是一節統一乙個頁首和頁尾,如果要插入新的頁首頁尾,要在word插入分節符。doc.sections這個列表就是doc所有的節。head doc.sections 0 header這就是第...