Apply Rubber Stamp Annotation on all pages
-
- Posts: 38
- Joined: Thu Sep 22, 2016 4:56 am
Apply Rubber Stamp Annotation on all pages
Hi,
Good day, just want to ask how do you apply rubber stamp annotation on all pages? what is the snippet for looping? Any help would be greatly appreciated.
Thank you very much.
Kind Regards,
Eric
Good day, just want to ask how do you apply rubber stamp annotation on all pages? what is the snippet for looping? Any help would be greatly appreciated.
Thank you very much.
Kind Regards,
Eric
Re: Apply Rubber Stamp Annotation on all pages
It depends on the document you want to annotate, the code obviously won't be the same with a PDF document or a TIFF document.
In both cases it implies a for loop from 1 to PageCount which can be obtained through the GetPageCount method that exists in both GdPicturePDF and GdPictureImaging classes.
Inside the loop, for each page you need to call the SelectPage method (that exists in both GdPicturePDF and GdPictureImaging classes too), add your annotation and save it to the page.
In both cases it implies a for loop from 1 to PageCount which can be obtained through the GetPageCount method that exists in both GdPicturePDF and GdPictureImaging classes.
Inside the loop, for each page you need to call the SelectPage method (that exists in both GdPicturePDF and GdPictureImaging classes too), add your annotation and save it to the page.
-
- Posts: 38
- Joined: Thu Sep 22, 2016 4:56 am
Re: Apply Rubber Stamp Annotation on all pages
Hi Cedric, this is what my code looks like, this does the job but obviously it displays all the page one by one upto the last page because of the DisplayPage method, I dont want to display it's page, I just want to apply the stamps automatically on all pages, how do I achieve that? Thank you very much.
for (int i = 1; i <= myViewer.PageCount; i++)
{
myViewer.DisplayPage(i);
AnnotationManager annotMgr = myViewer.GetAnnotationManager();
AnnotationRubberStamp annot = annotMgr.AddRubberStampAnnot(Color.Red, 1.50f, 3.6f, 5.50f, 2.25f, "Lapsed" + Environment.NewLine + lapsedDate);
annot.FontStyle = System.Drawing.FontStyle.Bold;
annot.FontName = "Arial";
annot.BorderWidth = 0.030f;
annot.StrokeColor = Color.Red;
}
Kind Regards,
Eric
for (int i = 1; i <= myViewer.PageCount; i++)
{
myViewer.DisplayPage(i);
AnnotationManager annotMgr = myViewer.GetAnnotationManager();
AnnotationRubberStamp annot = annotMgr.AddRubberStampAnnot(Color.Red, 1.50f, 3.6f, 5.50f, 2.25f, "Lapsed" + Environment.NewLine + lapsedDate);
annot.FontStyle = System.Drawing.FontStyle.Bold;
annot.FontName = "Arial";
annot.BorderWidth = 0.030f;
annot.StrokeColor = Color.Red;
}
Kind Regards,
Eric
Re: Apply Rubber Stamp Annotation on all pages
That's because you are doing it through the viewer instead of doing it directly onto the input document as advised. The DisplayPage method call does what it is supposed to do, it displays the page.
If you really want to do this in the viewer just set the LockViewer property to true before entering your loop and set it back to false on exit and it should work as you expect.
If you really want to do this in the viewer just set the LockViewer property to true before entering your loop and set it back to false on exit and it should work as you expect.
Who is online
Users browsing this forum: No registered users and 1 guest