自己做了一个PDF说明文件给客户,现在需要在每一页上都加上自己的logo图片,具体操作过程如下:建项目这些就省略了,直接上代码:usingiTextSharp。text。pdf;usingSystem;usingSystem。IO;usingSystem。Windows。Forms;namespacePic2PDF{publicpartialclassForm1:Form{publicForm1(){InitializeComponent();}privatevoidbutton1Click(objectsender,EventArgse){stringpathApplication。StartupPath;源PDF地址stringpdffilenamepathtest。pdf;加完图片的PDF地址stringpdffilename1pathtest1。pdf;图片文件地址stringpicfilenamepathsign。jpg;执行操作,加上图片stringrAddPics(pdffilename,pdffilename1,picfilename);MessageBox。Show(r);}publicstaticstringAddPics(stringPdfPath,stringOutPdfPath,stringpicpath){try{if(File。Exists(OutPdfPath)){File。Delete(OutPdfPath);}PdfReaderreadernewPdfReader(PdfPath);PdfStamperstampnewPdfStamper(reader,newFileStream(OutPdfPath,FileMode。Create));intnreader。NumberOfPages;inti0;PdfContentByteunder;iTextSharp。text。ImageimiTextSharp。text。Image。GetInstance(picpath);PDFATTattnewPDFATT(PdfPath);floatwwatt。Width();floathhatt。Height();floatwim。Width;floathim。Height;floatlocationx;floatlocationy;locationxwww20;locationy50;im。SetAbsolutePosition(locationx,locationy);im。ScaleAbsolute(w,h);while(in){i;understamp。GetOverContent(i);under。AddImage(im,false);}stamp。Close();reader。Close();}catch(Exceptionex){returnex。Message;}returnok;}classPDFATT{PdfReaderreader;publicPDFATT(stringiPdfFilePath){readernewPdfReader(iPdfFilePath);}publicintPageCount(){returnreader。NumberOfPages;}publicfloatWidth(){returnreader。GetPageSize(1)。Width;}publicfloatHeight(){returnreader。GetPageSize(1)。Height;}}}}我这里设置的是添加到右下角了,位置的代码主要在这个地方 PDFATTattnewPDFATT(PdfPath); floatwwatt。Width();PDF的宽度 floathhatt。Height();PDF的高度 floatwim。Width;图片宽 floathim。Height;图片高 floatlocationx; floatlocationy; locationxwww20;横向位置自己计算 locationy50;纵向位置自己试下就行 其它的都很简单了。运行效果如下: