RemoveJavaScript Method (GdPicturePDF)
Removes all JavaScript scripts from the specified objects, that are included in the currently loaded PDF document. You can identify all required objects using the Options parameter according to your preference. Please refer to the
GdPicturePDF.GetActionJavaScript method for more details.
Parameters
- Options
- A bitwise combination of values of the PdfRemoveJavaScriptOptions enumeration.
Return Value
A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
We strongly recommend always checking this status first.
How to remove all JavaScript scripts from the PDF document.
Dim caption As String = "Example: RemoveJavaScript"
Dim gdpicturePDF As GdPicturePDF = New GdPicturePDF()
If gdpicturePDF.LoadFromFile("javascript.pdf", False) = GdPictureStatus.OK Then
If gdpicturePDF.RemoveJavaScript(PdfRemoveJavaScriptOptions.RemoveAllJavaScript) = GdPictureStatus.OK Then
If gdpicturePDF.SaveToFile("javascript_removed.pdf") = GdPictureStatus.OK Then
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption)
Else
MessageBox.Show("The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The RemoveJavaScript() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
Else
MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption)
End If
gdpicturePDF.Dispose()
string caption = "Example: RemoveJavaScript";
GdPicturePDF gdpicturePDF = new GdPicturePDF();
if (gdpicturePDF.LoadFromFile("javascript.pdf", false) == GdPictureStatus.OK)
{
if (gdpicturePDF.RemoveJavaScript(PdfRemoveJavaScriptOptions.RemoveAllJavaScript) == GdPictureStatus.OK)
{
if (gdpicturePDF.SaveToFile("javascript_removed.pdf") == GdPictureStatus.OK)
MessageBox.Show("The example has been followed successfully and the file has been saved.", caption);
else
MessageBox.Show("The file can't be saved. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
MessageBox.Show("The RemoveJavaScript() method has failed with the status: " + gdpicturePDF.GetStat().ToString(), caption);
}
else
{
MessageBox.Show("The file can't be loaded. Status: " + gdpicturePDF.GetStat().ToString(), caption);
}
gdpicturePDF.Dispose();