AddImage replaces all existing images

Nov 20, 2013 at 1:59 PM
Edited Nov 20, 2013 at 2:00 PM
First i would like to thank you for this great library.
i´m facing a problem on adding images to existing pdf files.
the first time i add a image it does it fine.
now when i later want to add a second or third Image it replaces all existing images from before with the last one added. any ideas for this ? i can see that the images are still in the pdf file because of the size... hope you´ll understand what i mean...

greetings tim
Coordinator
Nov 21, 2013 at 3:44 AM
Can you post the code that replicate the problem ?
Make sure image you add don't have the same name.
Nov 21, 2013 at 1:41 PM
Edited Nov 21, 2013 at 4:55 PM
Thanks for your quick response...

ok after changeing the filename (date-time is now added) it looks still the same, hides the images from before.
I sign a document 3 times, every sign on a different Position, application runs on three different pc´s/users
Here is some of my code:
    Dim page As pdflib.clsPDFPage
    Dim myPDF As New pdflib.ClsPDF(ImageFilePath) 'Path to PDF file
    Dim image As New pdflib.clsPDFImage(tmpSignPath) 'Path to Sign-File / created by System.Drawing.Image - Saved as JPG
    page = myPDF.GetPage(1)
    page.AddImage(image, 100, 150, 75, 75) 'First Sign X-100,Y-150 / Second Sign X-200,Y-150 / Third Sign X-300,Y-150
    myPDF.Save()
    myPDF.Close()
Coordinator
Nov 24, 2013 at 1:19 AM
Edited Nov 24, 2013 at 1:19 AM
I have tried to reproduce the problem without success.
Here is my code:

Page.AddImage(image,100,150,75,75);
Page.AddImage(image,200,150,75,75);

I have two images on my page slightly overlapping because they are large.
Nov 24, 2013 at 12:03 PM
Edited Nov 24, 2013 at 12:07 PM
Ok let me try to explain different...
I´m NOT adding three images at once - they are added one after the other.
heres some code that exactly reproduces the problem that i have:

Imports pdflib

Public Class Form1
Private Sub DoPDFWork1()

    ' First Person sign
    Dim page As pdflib.clsPDFPage
    Dim myPDF As New pdflib.ClsPDF("C:\Test\PDF\sample.pdf")
    Dim image As New pdflib.clsPDFImage("C:\Test\Image\sample1.jpg")
    page = myPDF.GetPage(1)
    page.AddImage(image, 150, 150, 75, 75)
    myPDF.Save()
    myPDF.Close()

    DoPDFWork2()

End Sub

Private Sub DoPDFWork2()

    ' Second person sign
    Dim page As pdflib.clsPDFPage
    Dim myPDF As New pdflib.ClsPDF("C:\Test\PDF\sample.pdf")
    Dim image As New pdflib.clsPDFImage("C:\Test\Image\sample2.jpg")
    page = myPDF.GetPage(1)
    page.AddImage(Image, 250, 150, 75, 75)
    myPDF.Save()
    myPDF.Close()

    DoPDFWork3()

End Sub

Private Sub DoPDFWork3()

    ' Third person sign
    Dim page As pdflib.clsPDFPage
    Dim myPDF As New pdflib.ClsPDF("C:\Test\PDF\sample.pdf")
    Dim image As New pdflib.clsPDFImage("C:\Test\Image\sample3.jpg")
    page = myPDF.GetPage(1)
    page.AddImage(Image, 350, 150, 75, 75)
    myPDF.Save()
    myPDF.Close()

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

    DoPDFWork1()

End Sub
End Class


Output on PDF is like:

Image1 NOT shown - Image2 NOT shown - Image3 is fine
Dec 2, 2013 at 9:56 AM
Hey, here´s some new info for you. I just found out that this is only happening when the pdf is PDF/A (Version 1.4)...
Coordinator
Dec 6, 2013 at 1:10 AM
Ok, I will try reproduce the problem with some PDF/A