标签:output [] amp abs percent byte some mod osi
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
class Program
{
static void Main(string[] args)
{
using (Stream inputPdfStream = new FileStream("input.pdf", FileMode.Open, FileAccess.Read, FileShare.Read))
using (Stream inputImageStream = new FileStream("some_image.jpg", FileMode.Open, FileAccess.Read, FileShare.Read))
using (Stream outputPdfStream = new FileStream("result.pdf", FileMode.Create, FileAccess.Write, FileShare.None))
{
var reader = new PdfReader(inputPdfStream);
var stamper = new PdfStamper(reader, outputPdfStream);
var pdfContentByte = stamper.GetOverContent(1);
Image image = Image.GetInstance(inputImageStream);
image.SetAbsolutePosition(100, 100);
pdfContentByte.AddImage(image);
stamper.Close();
}
}
}
iTextSharp.text.Image
SetAbsolutePosition()有2个参数,第一个参数是X轴坐标,第二个参数是Y轴坐标,使用PDF坐标系,文档的左下角为坐标原点。
ScalePercent() 缩放比,
标签:output [] amp abs percent byte some mod osi
原文地址:https://www.cnblogs.com/nightnine/p/9571741.html