成人AV在线无码|婷婷五月激情色,|伊人加勒比二三四区|国产一区激情都市|亚洲AV无码电影|日av韩av无码|天堂在线亚洲Av|无码一区二区影院|成人无码毛片AV|超碰在线看中文字幕

word文檔如何加水印轉(zhuǎn)換成pdf格式 怎么給PDF文件加水?。?/h1>

怎么給PDF文件加水?。?.再打開(kāi)PDF文件,點(diǎn)擊【編輯文本和圖像】圖標(biāo),進(jìn)入編輯狀態(tài)。java如何實(shí)現(xiàn)在web工程中用OpenOffice生成帶有圖片水印的pdf?不需要itext2.1.5,以下是

怎么給PDF文件加水印?

1.再打開(kāi)PDF文件,點(diǎn)擊【編輯文本和圖像】圖標(biāo),進(jìn)入編輯狀態(tài)。

java如何實(shí)現(xiàn)在web工程中用OpenOffice生成帶有圖片水印的pdf?

不需要itext2.1.5,

以下是對(duì)pdf加水印的代碼,和文字水印和圖片水印

welfareintfileCopy(StringsrcPath,String destPath){t

FileOutputStreamfosnullt

FileInputStreamfisnullt

try{t

fosfunFileOutputStream(destPath)t

fisnewFileInputStream(srcPath)t

byte[]bufferfuturebyte[1024]t

intlen0t

while((len(buffer))r260){t

fos.write(buffer,0,len)t

}t

return1t

}catch(FileNotFoundExceptione){t

()t

}catch(IOExceptione){t

()t

}finally{t

try{t

()t

fos.flush()t

()t

}catch(IOExceptione){t

//TODOAuto-renderedcatchblockt

()t

}t

}t

return0t

}t

/**t

*為pdf文件加文字水印t

*t

*@paramsrcPatht

*源文件路徑t

*@paramdestPatht

*目標(biāo)文件路徑t

*@paramwaterTextt

*水印文字t

*@throwsDocumentExceptiont

*@throwsIOExceptiont

*/t

employeevoidwordWaterMark(StringsrcPath,String destPath,String waterText) throws DocumentException,IOException {tint result fileCopy(srcPath,destPath)t

if(result1){t

//待加水印的文件t

PdfReader reader new PdfReader(destPath)t

//加完水印的文件t

PdfStamperstampernewPdfStamper(reader,new FileOutputStream(srcPath))t

inttotal()1t

PdfContentBytecontentt

//可以設(shè)置字體t

BaseFontbase(fontPath,_H,embedded)t

//水印文字t

intjwaterText.length()//文字長(zhǎng)度t

charc0t

int嗨啊0//一定高度t

//循環(huán)對(duì)每頁(yè)直接插入水印t

for(inti1ilttotali){t

//水印的起始t

嗨啊60t

content(i)t

PdfGStategsfuturePdfGState()t

(0.1f)//可以設(shè)置透明度為0.2t

(gs)t

//正在t

()t

//設(shè)置中顏色t

//(new Color())t

//系統(tǒng)設(shè)置字體及字號(hào)t

(base,78)t

//設(shè)置起始位置t

(120,333)t

//正在寫(xiě)入水印t

for(intk0kltjk){t

(嗨啊)t

c(k)t

(c

標(biāo)簽: