Steps to remove
JavaScript present in pdf document using Aspose.pdf
Step 1:
//First add reference to Aspose.PDF in your project
using Aspose.Pdf;
Step 2:
//Create memory stream to hold pdf stream without JavaScript
MemoryStream pdfStreamWithoutJanascript
= new MemoryStream();
Step 3:
//Create object of
PdfJavaScriptStripper class using Aspose.pdf
Aspose.Pdf.Facades.PdfJavaScriptStripper objTest = new Aspose.Pdf.Facades.PdfJavaScriptStripper();
Step 4:
//Use Strip() method of PdfJavaScriptStripper class to strip
JavaScript present in pdf stream
//it returns true if JavaScript is present in PDF document
bool isJavascriptExist =
objTest.Strip(file.InputStream, pdfStreamWithoutJanascript
);
No comments:
Post a Comment