Steps to
validate existence of JavaScript 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 mem = new MemoryStream();
Step 3:
//Create object of
PdfJavaScriptStripper class to verify presence of javascript in PDF stream
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, mem);
No comments:
Post a Comment