Adding Custom Stamps to PdfViewer on Initialization

I'm trying to add custom stamps to the toolbar, I want the stamps to be available as soon as the document is loaded. I was able to find some code where i could get my stamps to show when i click and drag and at that point it would update the stamp settings but for some reason i cant get it to work on init. Here is the basics of what im trying to do in Blazor.

The toolbar settings and stamp settings seem to work fine but when i try to add the customstamp setting i end up getting this error:

Cannot read property 'push' of undefined
TypeError: Cannot read property 'push' of undefined
    at t.stampBeforeOpen (https://localhost:44353/_content/Syncfusion.Blazor.PdfViewer/scripts/pdfviewer-40a59d.min.js:1:1465774)

This error happens as soon as you go to annotations then open the stamp dropdown. Any assistance on what's wrong would be appreciated. Here is my code for reference.


 <SfPdfViewerServer @ref="pdfViewer"
                           DocumentPath="Succinctly.pdf"
                           Height="90vh"
                           ToolbarSettings="@ToolbarSettings"
                           StampSettings="@StampSettings"  
                           CustomStampSettings="@CustomStampsSettings"
                           Width="100%"
                           ServiceUrl="https://localhost:44365/pdfviewer">

            <PdfViewerEvents PrintStart="@PrintStart"
                             AnnotationAdded="@AnnotationAdded"
                             OnPageClick="@PageClick">
            </PdfViewerEvents>
        </SfPdfViewerServer>

@code {
    SfPdfViewerServer pdfViewer;
    public PdfViewerStampSettings StampSettings { get; set; }
    public PdfViewerToolbarSettings ToolbarSettings { get; set; }
    public PdfViewerCustomStampSettings CustomStampsSettings { get; set; }

 protected async override void OnInitialized()
    {      
        SetViewerToolbarSettings();
        SetViewerStampSettings();
        SetCustomStampSettings();
    }

    protected void SetViewerToolbarSettings()
    {
        ToolbarSettings = new PdfViewerToolbarSettings() {
            ToolbarItems = new List<ToolbarItem>()
           {
                ToolbarItem.PageNavigationTool,
                ToolbarItem.MagnificationTool,
                ToolbarItem.SearchOption,
                ToolbarItem.PrintOption,
                ToolbarItem.DownloadOption,
                ToolbarItem.AnnotationEditTool,
            },
            AnnotationToolbarItems = new List<AnnotationToolbarItem>()
            {
                AnnotationToolbarItem.StampAnnotationTool,
                AnnotationToolbarItem.HandWrittenSignatureTool,
            }

        };
    }

    protected void SetViewerStampSettings()
    {
        StampSettings = new PdfViewerStampSettings()
        {
            DynamicStamps = new List<DynamicStampItem>(),
            StandardBusinessStamps = new List<StandardBusinessStampItem>(),
            SignStamps = new List<SignStampItem>() { SignStampItem.SignHere,SignStampItem.InitialHere,SignStampItem.Accepted},
        };
    }

    protected void SetCustomStampSettings()
    {
        CustomStampsSettings = new PdfViewerCustomStampSettings()
        {
            EnableCustomStamp = true,
            IsAddToMenu = true,
            CustomStamps = new List<PdfViewerCustomStamp>()
                {
                    new PdfViewerCustomStamp()
                    {
                        CustomStampName = "Test 1",

                        CustomStampImageSource = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg=="
                    },
                    new PdfViewerCustomStamp()
                    {
                        CustomStampName = "Test 2",

                        CustomStampImageSource = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg=="
                    },
                    new PdfViewerCustomStamp()
                    {
                        CustomStampName = "T3st 3",

                        CustomStampImageSource = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg=="
                    },
                }
        };

    }


private void PrintStart(PrintStartEventArgs args)
    {
        args.Cancel = true;

    }

    public async void PageClick(PageClickEventArgs e)
    {
        var t = e;

    }

    public async void AnnotationAdded(AnnotationAddEventArgs e)
    {
        var t = e;
    }



5 Replies 1 reply marked as answer

DR Desika Rajendran Syncfusion Team March 11, 2021 10:53 AM UTC

Hi Jeremy, 
 
We can able to reproduce the reported issue. We will provide further details on March 15th 2021. 
 
Regards, 
Desika R 



VS Vasugi Sivajothi Syncfusion Team March 15, 2021 02:20 PM UTC

Hi Jeremy,  
 
We have confirmed that the reported issue is a defect, and the fix will be included on April 7th weekly NuGet release. 
 
 
Regards, 
Vasugi 



JS Jeremy Schoenberger March 23, 2021 12:35 PM UTC

Thank you for the update!


VS Vasugi Sivajothi Syncfusion Team April 7, 2021 04:54 PM UTC

Hi Jeremy,   
 
Sorry for the inconvenience. 
 
The fix for the reported issue was not included in the latest weekly release. The fix will be included in our upcoming weekly nuget release on 14th April 2021. 
 
Regards, 
Vasugi 



VS Vasugi Sivajothi Syncfusion Team April 14, 2021 01:11 PM UTC

Hi Jeremy,    
 
We have fixed the reported “Adding custom stamps in PDF viewer toolbar throws script error” issue and the fix was included in our latest weekly NuGet release v19.1.0.56. Kindly upgrade to that version to get the issue resolved. 
 
 
Packages link:    
Blazor Client  
Blazor Sever 
Service side package    
ASP.NET Core :    
     
ASP.NET MVC:    
   
CDN links:   
 
Regards, 
Vasugi 


Marked as answer
Loader.
Up arrow icon