I'm using the latest GdPicture build 14.0.0.23 and my scenario is this:
I load a PDF file into a GdViewer which consists of only a single page with a single image of it, with a resolution of 300dpi, then I draw an area on it so that I may replace it with a filled rectangle. This is the code I use and that is currently working but only the first time:
Code: Select all
float hres = 0, vres = 0;
//get the resolution of the page's image
gdPdf.GetPageImageResolution(0, ref hres, ref vres);
float resolution = hres;
float top = 0, left = 0, width = 0, height = 0;
imageViewer.GetRectCoordinatesOnDocumentInches(ref left, ref top, ref width, ref height);
left *= resolution;
top *= resolution;
width *= resolution;
height *= resolution;
int tempImage = gdPdf.ExtractPageImage(1);
MessageBox.Show("drawfilledrect Status: " + gdPicture.DrawFilledRectangle(tempImage, (int)left, (int)top, (int)width, (int)height, Color.White, true).ToString());
string imageRes = gdPdf.GetPageImageResName(0);
MessageBox.Show("ReplaceImage Status: " + gdPdf.ReplaceImage(imageRes, tempImage, false).ToString());
imageViewer.Redraw();
thumbnailViewer.RedrawItem(0);
MessageBox.Show("Release Status: " + gdPicture.ReleaseGdPictureImage(tempImage).ToString());
MessageBox.Show("Save Status: " + gdPdf.SaveToFile(fileName, true).ToString());
Code: Select all
gdPdf.GetPageImageResolution(0, ref hres, ref vres);
I'd appreciate any thoughts regarding this matter.
Kind regards.