尝试使用itextsharp将图像添加到PDF不起作用

时间:2019-03-02 13:02:47

标签: vb.net itext

我的代码没有将图像添加到PDF文件中,我缺少什么吗?

    Private Sub AddPDFImage()

    Dim PdfReader As PdfReader = New PdfReader("PDF INPUT FILE")
    Dim PdfStamper As PdfStamper = New PdfStamper(PdfReader, New FileStream("PDF OUT PUT FILE", FileMode.Create))
    Dim PdfImage As iTextSharp.text.Image
    Dim bytContent As PdfContentByte

    PdfImage = iTextSharp.text.Image.GetInstance("Image")
    PdfImage.ScalePercent(100)
    PdfImage.SetAbsolutePosition(50, 110)
    bytContent = PdfStamper.GetOverContent(1)
    bytContent.AddImage(PdfImage)
    PdfStamper.FormFlattening = False
    PdfStamper.Close()
    PdfReader.Close()

End Sub

0 个答案:

没有答案