Custom stamp added programaticly

Hi,

I am trying to add my own stamp amongst the provided stamp of the annotation section. 

I have achieved it by using customStampSettings.customStamp and customStampSettings.isAddToMenu properties but as soon as I add this stamp to the PDF, I am no longer able to use functions such a download() or saveAsBlob().

Instead, this error dialogue show up

and by using my network tab I see that the server has returned this

The thing is that it doesn't say it if I remove the stamp. I was wondering if I am doing something wrong or if the dotnet back-end server might have a problem. 

I have tried it in my work environment with our own instance of the server running the latest version and on a Stackbliz using an official server link and in both cases, I got the same response from the server.

Here is my Stackbliz

Thanks in advance


6 Replies

DM Dhivyabharathi Mohan Syncfusion Team July 27, 2021 12:42 PM UTC

Hi Michael, 
 
Thank you for contacting Syncfusion support. 
 
We were able to reproduce the reported issue “Exception throws while downloading the document with the provided custom stamp”. We will analyze further and provide the details on July 30, 2021. 
 
Regards, 
Dhivya. 



DM Dhivyabharathi Mohan Syncfusion Team July 30, 2021 02:59 PM UTC

Hi Michael, 


We have checked with the provided code snippet. In this the custom stamp is added as a link. If we provide the stamp as a base64 string, then the image will be saved correctly. The HTML image tag will automatically render the image tag which has provided as link. But we will process the data in the server-side as a base64 string. So, while converting the image to the byte array the reported issue occurs. So, we suggest you provide the stamp as base64 string instead of providing its path to get the issue resolved. We have modified the sample to provide the stamp as base 64 string for your reference. 
 
 
 
 
Code snippet: 
 
 
 
ngAfterViewInit(): void { 
 
    this.pdfViewer.customStampSettings.isAddToMenu = true; 
 
    this.pdfViewer.customStampSettings.customStamps = [ 
      { 
        customStampImageSource: 
          'Base64string’, 
        customStampName: 'Test' 
      } 
    ]; 
  } 
 
 
 
 
Kindly try this and revert us, if you have any concerns. 
 
 
Regards, 
Dhivya. 



ML MichelAntoine Lemire July 30, 2021 08:25 PM UTC

Thanks for the reply ! 

It works well both for the download and the saveAsBlob functions but it seems that the stamps are not rendered properly if I save the file using  saveAsBlob and then I re-open it in the PDFViewer. (They are their in the file itself when opened normally) I am saving it in ASW s3 cloud service in case it helps. 

Do you have an idea what could be the cause? 

Regards, 
Michel-Antoine. 


DM Dhivyabharathi Mohan Syncfusion Team August 2, 2021 06:14 AM UTC

Hi Michel, 
 
 
We have checked with the download and saveAsBlob method. The custom stamp annotation is rendered properly while re-loading the downloaded PDF document using the download or saveAsBlob method. We have shared the Angular sample and ASP.Net Core web service in which we tried to replicate this issue. And we have shared the video for your reference. 
 
 
 
 
Run the web service and then run the Angular sample. 
 
 
 
 
 
 
Could you please try the sample and let us know whether the steps which we tried to replicate this issue is correct or not? If the steps which we tried is incorrect, kindly share the video for replicating this issue. It will be helpful for us to investigate further and provide the details at the earliest. 
 
 
Regards, 
Dhivya. 
 



ML MichelAntoine Lemire August 16, 2021 04:41 PM UTC

Thanks for the sample.


After trying a few thing I noticed that the base64 image I was using in me real use-case was generated as a png. I'm using a canvas to get dynamic image (I need the time-stamp) and the canvas.toDataURL() function returned png by default. Strangely, it worked for the most part but adding these parameters fixed it for good canvas.toDataURL('image/jpeg', 1)


Sorry for not looking into it a bit more



DM Dhivyabharathi Mohan Syncfusion Team August 17, 2021 12:42 PM UTC

Hi Michel, 
 
Thank you for your update. Currently we have support for saving and loading the custom stamp only in jpg and Jpeg formats. We do not have support to render the custom stamp of PNG format in our PDF Viewer. Already we have logged this as a feature and the feature implementation will be included in any of our upcoming releases. You can track the status using the below feedback link,  
  
  
 
 
Regards, 
Dhivya. 


Loader.
Up arrow icon