How to create rubber stamp annotation using custom image

I want to stamp custom image on PDF document, is it possible? can you give example code?


Attachment: notmaterial_4a1a9d75.png

10 Replies 1 reply marked as answer

AG Aribalakrishnan Govindasamy Syncfusion Team April 3, 2026 06:55 AM UTC

Hi Jackson Tong,

Thank you reaching out,

We have provided the custom image support for rubber stamp annotation. We have created a sample to meet your requirements. Please review the attached sample to see if it fulfills your expectations. If it does not, please share your requirements more clearly so we can provide a more precise solution earlier.  


Please refer to the attached sample below,


Regards,

Aribalakrishnan G.


Attachment: Sample198259_7a5de602.zip


JT Jackson Tong April 3, 2026 08:47 AM UTC

Thanks, however the annotations only show on the PDF, if I take the exported json annotation then load it to the viewer they're invisible, please see my attached code.


Attachment: syncfusiondemo_e740b0ee.zip


VS Venkada Subramanian Durai Syncfusion Team April 6, 2026 03:01 PM UTC

Hi Jackson Tong,

Thank you for the update. Could you please confirm which platform you are using the Syncfusion PDF Viewer on?


If you are using the PDF Viewer in an ASP.NET Core application and need to add a custom stamp annotation as an image, you can do this using the addAnnotation API in the PDF Viewer. We have attached a sample implementation for reference.
 

If the sample does not meet your requirement, please share the following details so we can provide the most accurate solution:
 

  • The platform/framework you are using the Syncfusion PDF Viewer on
  • Whether you need to add annotations using only the PDF Library (server-side code) instead of the PDF Viewer (client-side)
     

Based on your feedback, we will suggest the appropriate approach and provide the correct implementation details.

Code snippet:
 

<script>   

   const addAnnotation = () => {

       var viewer = document.getElementById('pdfviewer').ej2_instances[0];

        viewer.annotation.addAnnotation('Stamp', {

         offset: { x: 80, y: 100 }, width: 100, height: 100, pageNumber: 1,

         author: 'Jackson',

         customStamps: [{ customStampName: 'Image', customStampImageSource: 'BASE-64-OF-IMAGE' }]

       });

    };

</script>



UG for how to add custom stamp annotation programmatically in PDF Viewer


Regards,
Venkada Subramanian D


Attachment: Add_custom_stamp_annotation_in_PDF_Viewer_cd404274.zip


JT Jackson Tong replied to Venkada Subramanian Durai April 7, 2026 01:11 AM UTC

I'm using ASP.NET Core server side on Linux to generate annotation, then the user uses the Webviewer to view the PDF along side with the generated annotation, they can edit/remove the annotation, once they're happy then we'll then merge the annotation to the final PDF for the user to download.



VS Venkada Subramanian Durai Syncfusion Team April 7, 2026 09:52 AM UTC

Hi Jackson Tong,


Thank you for the details. In the previously shared ASP.NET Core project, you provided an annotation JSON file. However, when the same annotation JSON is imported into the Syncfusion JavaScript PDF Viewer, the annotations are not visible, although the comments are populated.

 

Could you please confirm whether you are reporting the same behavior, similar to what is shown in the attached sample video?
 

If so, we were able to reproduce the reported issue where the stamp annotation is not visible after importing the annotations from the provided JSON file. Based on our investigation, we suspect this to be a defect and are currently performing further analysis.  We will update you with more details by April 9, 2026. 
 

In the meantime, could you please confirm whether you are using the Standalone Rendering PDF Viewer (resourceUrl) or the Server Rendering PDF Viewer (serviceUrl)? Additionally, as shared earlier, you can add the stamp annotation image on the client side using the attached sample project with the Syncfusion JavaScript PDF Viewer.
 

If this approach meets your requirements, we recommend using it and sharing your feedback with us.


Code snippet:
 

<script>   

   const addAnnotation = () => {

       var viewer = document.getElementById('pdfviewer').ej2_instances[0];

        viewer.annotation.addAnnotation('Stamp', {

         offset: { x: 80, y: 100 }, width: 100, height: 100, pageNumber: 1,

         author: 'Jackson',

         customStamps: [{ customStampName: 'Image', customStampImageSource: 'BASE-64-OF-IMAGE' }]

       });

    };

</script>


Regards,
Venkada Subramanian D


Attachment: Add_custom_stamp_annotation_in_PDF_Viewer_a9b68b1f.zip


JT Jackson Tong replied to Venkada Subramanian Durai April 7, 2026 09:57 AM UTC

I'm using the Standalone Rendering PDF Viewer (resourceUrl).

Thanks for the info but I can not avoid the server side processing.



VS Venkada Subramanian Durai Syncfusion Team April 8, 2026 08:16 AM UTC

Hi Jay,

Thanks for the details. We are currently performing further analysis and will update you with more information by April 9, 2026.


Regards,
Venkada Subramanian D



VS Venkada Subramanian Durai Syncfusion Team April 9, 2026 01:08 PM UTC

Hi Jackson Tong,

Thank you for your patience. We were able to reproduce the reported issue: "Stamp annotation is not visible after importing the annotations in provided JSON" This issue originates from our PDF Library side. We have reported it to the respective team and will provide further details based on their response by April 10, 2026.


Regards,
Venkada Subramanian D



VS Venkada Subramanian Durai Syncfusion Team April 10, 2026 11:27 AM UTC

 Hi Jackson Tong,


Thank you for your patience. We have confirmed the issue "Stamp annotation is not visible after importing the annotations in provided JSON" and logged it as a defect from PDF Library team.

 

We will include the fix in our weekly release, which is estimated to be available on April 28, 2026.

 

Disclaimer: "Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization."


Regards,

Venkada Subramanian D




VS Venkada Subramanian Durai Syncfusion Team April 28, 2026 01:29 PM UTC

Hi Jackson Tong,
 

Thank you for your patience. We have fixed the reported issue "Stamp annotation is not visible after importing the annotations in provided JSON" and the fix for the reported issue was included in our latest weekly release v33.2.4. Kindly upgrade to that version to get the issue resolved.

 

Root cause: While importing annotation JSON data, Guid and color space entry are not decoded properly, so that output was not preserved properly.

 

 

Solution: Need to update proper implementation for decoding logics on Guid and color spaces.
 

For Core, MVC and JS Packages:

Service side package

ASP.NET Core :     

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core   
 

ASP.NET MVC:     

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Mvc5/   

https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Mvc4/

 

 

CDN Links:

https://cdn.syncfusion.com/ej2/33.2.4/dist/ej2.min.js

https://cdn.syncfusion.com/ej2/33.2.4/material3.css

https://cdn.syncfusion.com/ej2/33.2.4/dist/ej2-pdfviewer-lib/pdfium.js

https://cdn.syncfusion.com/ej2/33.2.4/dist/ej2-pdfviewer-lib/pdfium.wasm


Regards,
Venkada Subramanian D


Marked as answer
Loader.
Up arrow icon