- Home
- Forum
- ASP.NET MVC - EJ 2
- Limited Add Dynamic Stamp to Just Not Approved and Approved
Limited Add Dynamic Stamp to Just Not Approved and Approved
Hi,
I am working PDF Viewer (API control) Add or Edit annotations toolbar. Here are the list of
Enum type for synamic stamp items properties
Approved
Confidential
NotApproved
Received
Reviewed
Revised
When user click on the Add Stamp dropdown list and select the Dynamic, I like to limited the list to (above properties) to just NotApproved and Approved. Here is the function codes and it is not working. Your help is much appreciated!
function LoadPdfViewer() {
var fileID = "@Model.ID";
//Getting Syncfusion API routing
var apiUri = '@Url.Action("", "PdfViewerAPI", null, Request.Url.Scheme)';
apiUri = apiUri.replace("/PdfViewerAPI", "/api/PdfViewerAPI");
apiUri = apiUri + "/" + fileID; //Add ID of file to API
var fileName = "@Model.DisplayName" + " - " + "@Model.FileName";
var pdfviewer = new ej.pdfviewer.PdfViewer({
enableBookmark: false,
enableThumbnail: false,
enableAnnotationToolbar: true,
enableHandwrittenSignature: true,
documentPath: fileName,
serviceUrl: apiUri
});
pdfviewer.appendTo('#pdfviewer');
//Set PDF properties such as fileName, toolbar etc
var pdfViewerobj = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewerobj.toolbar.showToolbarItem(new Array("OpenOption"), false);
pdfViewerobj.fileName = fileName;
pdfViewerobj.stampSettings.author = "@Model.UserName";
pdfViewerobj.stickyNotesSettings.author = "@Model.UserName";
pdfViewerobj.customStampSettings.author = "@Model.UserName";
pdfViewerobj.freeTextSettings.author = "@Model.UserName";
pdfViewerobj.highlightSettings.author = "@Model.UserName";
pdfViewerobj.stampItemSettings = {
enableCustomStamp: true
,dynamicStamps: [DynamicStampItem.NotApproved, DynamicStampItem.Approved]
};
};
Here are my debugger image



confirm packages
SIGN IN To post a reply.
20 Replies
AA
Akshaya Arivoli
Syncfusion Team
September 4, 2020 04:57 PM UTC
Hi vannak ,
Thank you for contacting Syncfusion support.
We can reproduce the issue with the provided code, please try with the below code snippet to resolve the reported issue,
|
var viewer = new ej.pdfviewer.PdfViewer({
documentPath: "FormFillingDocument.pdf",
serviceUrl: 'https://ej2services.syncfusion.com/production/web-services/api/pdfviewer',
stampSettings : {enableCustomStamp : true, dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved]},
});
|
We can hide some of the options in the Stamp menu using the stampSettings API
StandardBusinessStamp : https://ej2.syncfusion.com/javascript/documentation/api/pdfviewer/standardBusinessStampItem/
Please try it and revert us with more details if you still need assistance.
Regards,
Akshaya
VN
vannak nhong
September 4, 2020 07:08 PM UTC
Hi,
Attachment: debugLog_363c64e8.zip
Thanks for your feedback. I am still have the same issue. Here are my code snippet.
//Set PDF properties such as fileName, toolbar etc
var pdfViewerobj = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewerobj.toolbar.showToolbarItem(new Array("OpenOption"), false);
pdfViewerobj.fileName = fileName;
pdfViewerobj.stampSettings.author = "@Model.UserName";
pdfViewerobj.stickyNotesSettings.author = "@Model.UserName";
pdfViewerobj.customStampSettings.author = "@Model.UserName";
pdfViewerobj.freeTextSettings.author = "@Model.UserName";
pdfViewerobj.highlightSettings.author = "@Model.UserName";
//Vannak - Dev_299
pdfViewerobj.stampSettings = {
enableCustomStamp: true
,dynamicStamps: [
ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved
]
};
//pdfViewerobj = new ej.pdfviewer.PdfViewer({
// documentPath: "FormFillingDocument.pdf",
// serviceUrl: 'https://ej2services.syncfusion.com/production/web-services/api/pdfviewer',
// stampSettings: { enableCustomStamp: true, dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved] },
//});
the commented code snippet out, provide the same result.
Please see the attach zip file
Attachment: debugLog_363c64e8.zip
AA
Akshaya Arivoli
Syncfusion Team
September 7, 2020 11:50 AM UTC
Hi Vannak ,
Thank you for your update.
Currently, we can set the stampSettings during the control initialization only. We have created the sample for the same and shared in the below link,
Please try it and revert us with more details about your requirement and confirm us whether you want to set the stampSettings dynamically, if you need further assistance. These details will be helpful for us to assist you with precise solution.
Regards,
Akshaya
VN
vannak nhong
September 7, 2020 07:20 PM UTC
Hi again,
Attachment: ErrorsLog2_7b43d75d.zip
That's fix the custom stamp items. However, I am not able to submit to the server - save the PDF document with the append property value. Here is the full function
function LoadPdfViewer() {
var fileID = "@Model.ID";
//Getting Syncfusion API routing
var apiUri = '@Url.Action("", "PdfViewerAPI", null, Request.Url.Scheme)';
apiUri = apiUri.replace("/PdfViewerAPI", "/api/PdfViewerAPI");
apiUri = apiUri + "/" + fileID; //Add ID of file to API
var fileName = "@Model.DisplayName" + " - " + "@Model.FileName";
ej.base.enableRipple(true); //mvn - Dev_299 added // Render the PDF viewer control
var pdfviewer = new ej.pdfviewer.PdfViewer({
enableBookmark: false,
enableThumbnail: false,
enableAnnotationToolbar: true,
enableHandwrittenSignature: true,
documentPath: fileName, // mVn - Dev_299 grabbing the PDF file
serviceUrl: apiUri //invoke the PDF API web-services
//mVn - Dev_299 limited Dynamic to just Not Approved and Approved
,stampSettings: {
enableCustomStamp: true,
dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved],
dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved],
signStamps: [ej.pdfviewer.SignStampItem.Accepted],
standardBusinessStamps: [ej.pdfviewer.StandardBusinessStampItem.NotForPublicRelease,
ej.pdfviewer.StandardBusinessStampItem.PreliminaryResults,
ej.pdfviewer.StandardBusinessStampItem.Void]
},
});
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.Toolbar, ej.pdfviewer.Magnification, ej.pdfviewer.BookmarkView, ej.pdfviewer.ThumbnailView, ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation, ej.pdfviewer.LinkAnnotation, ej.pdfviewer.Annotation, ej.pdfviewer.FormFields);
pdfviewer.appendTo('#pdfviewer');
//Set PDF properties such as fileName, toolbar etc
var pdfViewerobj = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewerobj.toolbar.showToolbarItem(new Array("OpenOption"), false);
pdfViewerobj.fileName = fileName;
pdfViewerobj.stampSettings.author = "@Model.UserName";
pdfViewerobj.stickyNotesSettings.author = "@Model.UserName";
pdfViewerobj.customStampSettings.author = "@Model.UserName";
pdfViewerobj.freeTextSettings.author = "@Model.UserName";
pdfViewerobj.highlightSettings.author = "@Model.UserName";
};
I am getting internal 500 errors, "The input is not a
valid Base-64 string as it contains a non-base 64 character, more than two
padding characters, or an illegal character among the padding characters. " For more detail please check the attach file zip errors log.
Thank you
-Vannak
Attachment: ErrorsLog2_7b43d75d.zip
AA
Akshaya Arivoli
Syncfusion Team
September 8, 2020 11:50 AM UTC
Hi Vannak,
Thank you for your update.
We were unable to reproduce the reported error with the provided details. We have shared the sample in which we have tried in the below link,
Please try it and revert us with the modified sample and the replication procedure, if you are still facing the issue.
Regards,
Akshaya
VN
vannak nhong
September 8, 2020 06:18 PM UTC
Hi Akshaya,
Attachment: CustomStampImages_65d43b2f.zip
Thanks for the update. Actually, I was able to re-produce the issue with this suggested snippet codes sample link
https://stackblitz.com/edit/renbyd-yxuvcu?file=index.js
The codes provide the ability to control the stamp and produces the specific stamp item. However, if you try to "Add a comment" on specific item, approved or not approved, it will not allow to comment. Essentially this is how it was configured from the original stamp items, provided the provided PDF View API dictionary, which produce problems with posting to the server. For example within the sample snippet codes, I removed the custom stampSettings and it I can see the "Add a comment" was activated. Please see attach images for further clarification.
Best regards,
-Vannak
Attachment: CustomStampImages_65d43b2f.zip
AA
Akshaya Arivoli
Syncfusion Team
September 9, 2020 12:23 PM UTC
Hi Vannak,
Thank you for your update.
We were able to reproduce the issue “Comments for the Stamps are not visible when the StampSettings were provided” with the provided sample. We will analyze further on it and update you with more details on September 11, 2020
Also facing the below issue on downloading the document with the stamps. Can you please confirm us whether you are facing the same while downloading. It will be helpful for us to investigate further and assist you better.
Regards,
Akshaya
VN
vannak nhong
September 9, 2020 01:57 PM UTC
Hi Akshaya,
Attachment: ErrorsLog3_c9ccf77f.zip
Thank you for your update. Yes. But not all the time, I have seen this errors and every time this error occurs, I had to stop the application and re-run. Another incident, the PDF Image were failed to download with a different error message "The file is corrupted and cannot be opened". I was able to reproduce the error on one particular PDF image. Please see attach file for confirmation.
Best regards,
-Vannak
Attachment: ErrorsLog3_c9ccf77f.zip
AA
Akshaya Arivoli
Syncfusion Team
September 10, 2020 12:03 PM UTC
Hi vannak,
Thank you for your update.
We were unable to reproduce the reported issue with the provided details. So can you please share us the PDF document in which you are facing the issue, which will be helpful for us to investigate further and assist you better.
Regards,
Akshaya
VN
vannak nhong
September 10, 2020 04:36 PM UTC
Hello Akshaya,
Attachment: ErrorsLogs_2ca268f7.zip
Thanks for your update. let not worry about the corrupted image issue, as I may not able to provide you the PDF document image. The image may contains sensitive information.
Let move a head with the customize stamp issue and you have all the information to move forward. I think the customize stamp components must match the original, hence the internal server error 500 because the components were expected in the dictionary. Example in the attach file, I have two files
- 1) StampAnnotationJsonObject_NO_ISSUE ->where the original PDF View API was used, these are the contents that were sent to the server. And if you search for "Vannak" you will see the dynamicStampItem and append the author name, Vannak.
- 2) StampAnnotationJsonObject_With_ISSUE ->where the customize with StampSettings was used and the dynamic stamp item that was captured on the UI, was not append and send to the server and if you search for "Vannak", you will not find it.
I hope I provide all the necessary information that you need to speed up the resolution or release.
Best regards,
Vannak
Attachment: ErrorsLogs_2ca268f7.zip
AA
Akshaya Arivoli
Syncfusion Team
September 11, 2020 12:00 PM UTC
Hi Vannak,
Thank you for your update.
We have checked the provided code-snippet, in this, the opacity is not added on including the stamp settings. If we include the opacity then the reported issue will get resolved. Please find the code-snippet and modified sample below.
|
stampSettings : {opacity:1, dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved]},
customStampSettings:{enableCustomStamp:true} |
Please try it and if you still have concerns revert us with more details.
Regards,
Akshaya
Hi Vannak,Thank you for your update.We have checked the provided code-snippet, in this, the opacity is not added on including the stamp settings. If we include the opacity then the reported issue will get resolved. Please find the code-snippet and modified sample below.
stampSettings : {opacity:1, dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved]},customStampSettings:{enableCustomStamp:true}Please try it and if you still have concerns revert us with more details.
Regards,Akshaya
Hi Akshaya,
Thanks for the update. Congrats the code snippet works. I do have another issue which also relate to the Add/Edit annotations, the "Free Text" controller. We would like to customize the default font color from black to red. I modified and added the following:
pdfViewerobj.enableFreeText = true;
pdfViewerobj.freeTextSettings.fontColor = 'red';
pdfViewerobj.annotationModule.setAnnotationMode('FreeText');
with these codes snippet, it enabled the Free Text font color to red, but when I tried to post to the server, I got internal server error 500. The same issue with the dynamic issue.
Here are a full function code snippet.
--------------------------------
function LoadPdfViewer() {
var fileID = "@Model.ID";
//Getting Syncfusion API routing
var apiUri = '@Url.Action("", "PdfViewerAPI", null, Request.Url.Scheme)';
apiUri = apiUri.replace("/PdfViewerAPI", "/api/PdfViewerAPI");
apiUri = apiUri + "/" + fileID; //Add ID of file to API
var fileName = "@Model.DisplayName" + " - " + "@Model.FileName";
ej.base.enableRipple(true); //mvn - Dev_299 added // Render the PDF viewer control
var pdfviewer = new ej.pdfviewer.PdfViewer({
enableBookmark: false,
enableThumbnail: false,
enableAnnotationToolbar: true,
enableHandwrittenSignature: true,
documentPath: fileName, // mVn - Dev_299 grabbing the PDF file
serviceUrl: apiUri //invoke the PDF API web-services
/*
* mVn - DEV_299 modified 9/11/2020
* Dynamic - Approved & Not Approved only stamp
* Sign Here - Rejected/Accepted with ability to add comment
* standardBusinessStamps: [ej.pdfviewer.StandardBusinessStampItem.NotForPublicRelease,
* ej.pdfviewer.StandardBusinessStampItem.PreliminaryResults,
* ej.pdfviewer.StandardBusinessStampItem.Void]
*/
, stampSettings: {
opacity: 1
, dynamicStamps: [ej.pdfviewer.DynamicStampItem.NotApproved, ej.pdfviewer.DynamicStampItem.Approved]
, signStamps: [ej.pdfviewer.SignStampItem.Accepted, ej.pdfviewer.SignStampItem.Rejected]
},
customStampSettings: { enableCustomStamp: true }
});
ej.pdfviewer.PdfViewer.Inject(ej.pdfviewer.Toolbar, ej.pdfviewer.Magnification, ej.pdfviewer.BookmarkView, ej.pdfviewer.ThumbnailView, ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation, ej.pdfviewer.LinkAnnotation, ej.pdfviewer.Annotation, ej.pdfviewer.FormFields);
pdfviewer.appendTo('#pdfviewer');
//Set PDF properties such as fileName, toolbar etc
var pdfViewerobj = document.getElementById('pdfviewer').ej2_instances[0];
pdfViewerobj.toolbar.showToolbarItem(new Array("OpenOption"), false);
pdfViewerobj.fileName = fileName;
pdfViewerobj.stampSettings.author = "@Model.UserName";
pdfViewerobj.stickyNotesSettings.author = "@Model.UserName";
pdfViewerobj.customStampSettings.author = "@Model.UserName";
pdfViewerobj.freeTextSettings.author = "@Model.UserName";
pdfViewerobj.highlightSettings.author = "@Model.UserName";
//mVn - this works!
pdfViewerobj.enableFreeText = true;
pdfViewerobj.freeTextSettings.fontColor = 'red';
pdfViewerobj.annotationModule.setAnnotationMode('FreeText');
};
Best regards,
-Vannak
AA
Akshaya Arivoli
Syncfusion Team
September 14, 2020 10:55 AM UTC
Hi vannak ,
Thank you for your update.
We were able to reproduce the below issue while downloading the PDF document with the provided fee text settings. We will analyze further on it and update you with more details on September 16, 2020
However, we can resolve the issue as workaround by providing the color in hexacode. Please find the sample from the below,
Please try it and revert us with more details if you still need further assistance. These details will be helpful for us to investigate further and assist you better.
Regards,
Akshaya
VN
vannak nhong
September 15, 2020 01:10 PM UTC
Hello Akshaya,
Thank you for all the help. The workaround provided code snippet works for the color in hexacode.
Best regards,
-Vannak
MS
Mohan Selvaraj
Syncfusion Team
September 16, 2020 12:40 PM UTC
Hi vannak ,
We confirm that the reported issue is a defect, and the fix will be available on October 6th, 2020 Weekly NuGet release. You can track the status of the issue by using the below link.
Regards,
Mohan S
AA
Akshaya Arivoli
Syncfusion Team
October 6, 2020 01:16 PM UTC
Hi Vannak ,
Sorry for the inconvenience caused.
The fix for the reported issue will not be included in our latest weekly release. However we will fix the issue and it will be included in our upcoming weekly NuGet release on October 13, 2020
Regards,
Akshaya
AA
Akshaya Arivoli
Syncfusion Team
October 13, 2020 05:15 PM UTC
Hi Vannak
Sorry for the inconvenience caused. The fix was not included in our latest weekly NuGet release. However we will fix the issue and it will be included in our upcoming weekly NuGet release on October 21, 2020
Regards,
Akshaya
AA
Akshaya Arivoli
Syncfusion Team
October 21, 2020 04:51 PM UTC
Hi Vannak ,
Sorry for the inconvenience caused. The fix was not included in our latest weekly NuGet release. However we will fix the issue and it will be included in our upcoming weekly NuGet release on October 28, 2020
Regards,
Akshaya
MS
Mohan Selvaraj
Syncfusion Team
October 29, 2020 03:31 PM UTC
Hi Vannak ,
We have resolved the issue and it is included in the 18.3.0.44 version
|
Client side package |
|
|
Blazor Client |
|
|
Blazor Sever |
|
|
Service side package |
ASP.NET Core :
https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Windows/ https://www.nuget.org/packages/Syncfusion.EJ2.PdfViewer.AspNet.Core.Linux/
ASP.NET MVC:
|
Regards,
Mohan S
VN
vannak nhong
October 29, 2020 03:34 PM UTC
Hello Mohan S,
Thank you so much for your update!
Regards,
-Vannak
SIGN IN To post a reply.
- 20 Replies
- 3 Participants
-
VN vannak nhong
- Sep 3, 2020 03:38 PM UTC
- Oct 29, 2020 03:34 PM UTC