我需要在ItextSharp library生成的pdf文件上为每个页面添加图像。
我试过这个article没有成功,因为在pdf文件中,图片只出现在文档的第一页上。
你能帮助我吗?
提前谢谢。
我的代码如下。
try
{
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
iTextSharp.text.Image image = iTextSharp.text.Image.GetInstance(imagepath);
image.ScalePercent(50f);
pdfDoc.Add(image);
htmlparser.Parse(sr);
}
catch (Exception ex)
{
throw ex;
}
finally
{
pdfDoc.Close();
Response.End();
}