How to Annotate ICON and Watermark in a pdf File

How to find and Annotate ICON and Watermark in a pdf File

@kranthireddyr

Could you please explain a bit more about your requirements? Please try to share some sample source file with an expected output PDF document. We will test the scenario in our environment and address it accordingly.

Hi Asad,

I need to annotate icon from my pdf file. Need to search icon from the pdf and need to annotate it with some comment.

Here is my sample file and iocn :

Input File : sample_input_with_icon.pdf (19.4 KB)

Icon : icon1.jpg (6.2 KB)

Expected output file : sample_expected_output_file.pdf (17.5 KB)

@kranthireddyr

You can search the image inside PDF document and place a text annotation (sticky note) at the image location in order to annotate it. For example, please check the following code snippet and let us know if it does not fulfill your requirements completely:

Document pdf = new Document(dataDir + "sample_input_with_icon.pdf");
foreach (Page page in pdf.Pages)
{
 ImagePlacementAbsorber imagePlacementAbsorber = new ImagePlacementAbsorber();
 page.Accept(imagePlacementAbsorber);
 foreach (ImagePlacement imagePlacement in imagePlacementAbsorber.ImagePlacements)
 {
  TextAnnotation annot = new TextAnnotation(page, imagePlacement.Rectangle);
  annot.Contents = "This is annotation";
  page.Annotations.Add(annot);
 }
}
pdf.Save(dataDir + "annotated.pdf");

Hi Asad,

Thanks for the respose. Annotation for the image is working perfect there is no issue, but i can see there is a problem when trying to find a shape or trying to annotate it. How can we search and annotate a shape within pdf file. Please find the sample files.

Input File : sample_input_with_shape_and_icon.pdf (118.8 KB)

Expected output File : expected_with_shape_and_icon.pdf (152.1 KB)

@kranthireddyr

We have noticed the similar issue at our side and logged it as PDFNET-49245 in our issue tracking system for further investigation. We will look into its details and let you know as soon as the ticket is resolved. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hi Asad,

Thanks for the response. Can you please tell me how much time it will take to ressolved this issue from your’s side.

@kranthireddyr

The icon which you want to extract from the PDF is a drawn object and API does not have feature of extracting drawn shapes from the PDF at the moment. The ticket is logged to investigate the feasibility of this feature and it will be reviewed on a first come first serve basis. We are afraid that we cannot share any ETA before complete analysis of the ticket. However, we will inform you within this forum thread as soon as we have some news in this regard. Please give us some time.

We apologize for the inconvenience.