We're sorry GroupDocsCloud doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.cloud

Overlay image in PDF document issue with PHP using GroupDocs.Annotation REST API

I’m adding an image or adding a logo, on the top of the existing logo within the document using the annotation PHP SDK.
It does not replace the image, even the image which I’m using, having a white background.
Ideally, it should have replaced the existing logo image with the new image logo.

There is one more line that gets highlighted for annotate comment. (actually, there isn’t any comment).

Attaching the doc for the reference
WRTSC-1286956274-10_Gr5TheEiffelTower_2.pdf (546.3 KB)

@tilalahmad can you please help here?


I am afraid I can not notice any annotation(comment) in the PDF document. Please share your input document and sample code. I will look into the issue and will suggest you accordingly.

You can not notice any annotation(comment), because you are viewing a pdf document instead of MS Word.
So all I need to do is to replace the logo. I need to add Red log on top of the existing Blue logo in a way that Red logo completely hides the Blue logo. Please, Let me know if you are not clear with it.

I’m adding both the document, the original document, and the annotation processed document.

Original Docs Uploading: WRTSC-1286956274-10_Gr5TheEiffelTower (1).docx…
After annotation Docs: WRTSC-1286956274-10_Gr5TheEiffelTower_2 (3).docx (746.2 KB)

Following is the code I’m using
try {
$apiInstance = self::GetAnnotationApiInstance();

            $a = new GroupDocs\Annotation\Model\AnnotationInfo();
            $pt = new GroupDocs\Annotation\Model\Point();
            $box = new GroupDocs\Annotation\Model\Rectangle();
            //$a->setText("This is image annotation");
            //$a->setCreatorName("Anonym A.");   

            $options = new GroupDocs\Annotation\Model\AnnotateOptions();

            $file = pathinfo($filename, PATHINFO_FILENAME);
            $fileextn = pathinfo($filename, PATHINFO_EXTENSION);

            $request = new GroupDocs\Annotation\Model\Requests\annotateRequest($options);
            $result = $apiInstance->annotate($request);
            echo "AddImageAnnotation: Image Annotation added: " . $result->getHref();
        } catch (Exception $e) {
            header('HTTP/1.1 500 Internal Server error');
            header('Content-Type: application/text; charset=UTF-8');

There is one more option
Don’t know, if I can make use of that.

1 Like

@tilal.ahmad any update on this?

I manage to resolve it to some extent when adding image to pdf file.
So, first I convert it to pdf from docx and then add the logo.

Only problem left is added logo image show up a rectangle border. I just need to get rid of the borderline.
DO you have any idea, how can I achieve that.
attaching the document for the refrence 2 I Shooting stars Booklet PAPER Doc (6).pdf (1.1 MB)

1 Like


Thanks for sharing the additional information. I have noticed the issue and logged an improvement ticket(ANNOTATIONCLOUD-131) for further investigation and resolving the issue.

1 Like


It seems a PDF viewer issue as when I open it on my end using Adobe Acrobat Pro it does not show any border.

I can see the black outlined, when openinig the doucment with web browser. Most of our user could be using a browser to view the document. Please check that, if you can resolve the issue at you end.

1 Like


We have logged a ticket ANNOTATIONCLOUD-132 to investigate the issue. We will keep you updated about the issue resolution progress.

However, as a workaround you can change the default PDF Viewer in the browser, it will fix the issue.

This soultion is not working for us, overlaying a image not perfact most of the time.

Can you please help me with “Replace a image in Word or PDF document” using groupDocs API?
Is this even possible using GroupDocs API?

Thank you,


About the black border issue in browser, I am afraid we are unable to fix it at our side because showing this border depends on viewer settings or behavior that how it will show certain elements inside the PDF documents. We mimics the behavior of Adobe Reader and follows its standards.

So if annotation border is showing in Chrome or Edge, it is their own settings and behavior and has nothing to do with out API.

I am afraid GroupDocs API does not provide option to replace image in a document.

In fix of ANNOTATIONCLOUD-131 we will provide you a solution to overlay an image in a document with better control.

The issues you have found earlier (filed as ANNOTATIONCLOUD-131) have been fixed in this update. This message was posted using Bugs notification tool by sergeiterentev


As stated above, your reported issue(ANNOTATIONCLOUD-131) is resolved in GroupDocs.Annotation Cloud 21.6 release. We have introduced the ZIndex property in this release. Now you can set ZIndex value > 1 to get the image on top as follows. Hopefully, it will help you to accomplish the task.

1 Like