Hi,
Is there is a way in which I could use PDFViewer to mark certain areas in the PDF and call the backend server to redact those areas and save PDF?
Regards,
Sri
Hi Sri Nistala,
Currently, there is
no support for redaction at the UI level using the PDF Viewer. However, As
a workaround, you can add the redaction for text content using the PDF library.
We have provided the sample and steps below for your reference.
Javascript sample: https://stackblitz.com/edit/ankkds-m4l6ug?file=index.html,index.js
Web service sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Redaction_24.2.6-1895587801.zip
Steps to Redact:
Thank you. I will try this approach.
Hi Sri Nistala,
Thanks
for the update. Kindly try this and let us know if you have any concerns.
Hi, the example you have shared is using server side rendering, do you have an example that works with client side rendering ?
Hi Sri Nistala,
Sorry, there is no direct support for this at the client-side. And so, we are recommending the server-backed PDF Viewer to achieve the redaction.
Hi,
I have managed to get this working. I followed your approach to capture the annotation and get the bounds of the annotation. I sent the annotation to the server for redaction and it successfully redacted the areas as well. All of this was on my local PC (windows). When I deployed this into Azure App service (linux), it failed with Skiasharp missing dll while doing redaction. I have followed the documentation to add - SkiaSharp.NativeAssets.Linux and HarpBuzzSharp nuget packages. After I have added them, the Redaction areas are being offset and also increasing in height and width as shown in the below screenshot. Is the Annotation bounds selected in the pdfViewer and Redaction process different?
Hi Sri Nistala,
We have tried the
reported issue in Azure app service Linux but we were unable to reproduce the
issue. We have shared the sample in which we have tried to reproduce the issue
in the below link, along with a video recording for your reference.
Javascript sample: https://stackblitz.com/edit/ankkds-jg6xwr?file=index.html,index.js
Web service sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/RedactionLinux1617034645.zip
Hosted link: https://webservicepdfviewer.azurewebsites.net/pdfviewer
Note: If you are deploying the application in Linux environment, we recommended to use the "Syncfusion.EJ2.PdfViewer.AspNet.Core" which is compatible with Windows, Linux and OSX platforms.
The bound values obtained from the PDF Viewer are in pixels, whereas the bound values used in the Redaction are in points. Therefore, if you are getting the bound values from the PDF Viewer, you need to convert them to points before adding the redaction. We have provided code snippet to convert the pixel to point and point to pixel.
|
private ConvertPixelToPoint = function (number) { return (number * (72 / 96)); };
private ConvertPointToPixel = function (number) { return (number * (96 / 72)); }; |
Try this sample and revert to us with a modified sample, code snippet and more details about the reported issue if you have any concerns. This will be helpful for us to analyze further and provide the details.
Thanks a ton Karthik, it worked like a charm. You've saved my day.
Problem was the the PixelToPoint conversion, however, I followed your approach to loop through the Annotations directly on server and Redact them rather than depending on the conversions from PixelToPoint.
Hi Sri Nistala,
We are glad to know
that the reported issue was resolved on your end. So, we are closing this
ticket.