Re: [iText-questions] Replace images in pdf

2015-12-22 Thread mkl
breegee wrote > I am trying to replace a particular image on several pages in a pdf. It > runs through the code fine but when I open the file I see the first image > replaced and when I scroll to the second page it says there is an error in > the pdf. Unfortunately you did not share your PDF, so

Re: [iText-questions] Replace images in pdf

2015-12-22 Thread breegee
I changed it to use a stream and it works as far as replacing all of my images with no error on the pdf. However, the imaging I am putting in place shows with a black background. Not sure why or how to fix that. Any suggestions? Do While (i <= page_count) Dim pg As PdfDictionary =

Re: [iText-questions] Replace images in pdf

2015-12-22 Thread mkl
breegee wrote > If I wrap the killindirect in 'if i = 1 then killindirect', only doing it > on > page 1, then there is no error in my pdf. But it's not replacing my image > on page 2 also. I would propose not killing the objects at all while you are in the loop but instead adding them to some

Re: [iText-questions] Replace images in pdf

2015-12-22 Thread breegee
mkl, I believe you are right with this one... The same image object is referenced from page 1 and page 2. Your code replaces the reference on page one and kills the object. On page two your code does nothing to the image reference as (due to your killing the image object before) the reference goes