Class Cleaner
The Cleaner class can be used to scan or sanitize (remove any potentially harmful content) PDF document.
Inheritance
Namespace: IronPdf
Assembly: IronPdf.dll
Syntax
public static class Cleaner : Object
Methods
SanitizeWithBitmap(PdfDocument)
Sanitize PDF by convert PDF To an Bitmap image and convert it back to PDF. Returns a new PdfDocument object.
Declaration
public static PdfDocument SanitizeWithBitmap(PdfDocument pdfDocument)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | pdfDocument | An PdfDocument of document. |
Returns
Type | Description |
---|---|
PdfDocument |
SanitizeWithBitmap(String)
Sanitize PDF by convert PDF To an Bitmap image and convert it back to PDF. Returns a new PdfDocument object.
Declaration
public static PdfDocument SanitizeWithBitmap(string pdfFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | pdfFilePath | A PDF File path. |
Returns
Type | Description |
---|---|
PdfDocument |
SanitizeWithSvg(PdfDocument)
Sanitize PDF by convert PDF To an SVG image and convert it back to PDF. Returns a new PdfDocument object.
- Quicker than SanitizeWithBitmap(PdfDocument)
- Resulted as a serachable PDF
- Layout might be inconsistency.
Declaration
public static PdfDocument SanitizeWithSvg(PdfDocument pdfDocument)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | pdfDocument | An PdfDocument of document. |
Returns
Type | Description |
---|---|
PdfDocument |
SanitizeWithSvg(String)
Sanitize PDF by convert PDF To an SVG image and convert it back to PDF. Returns a new PdfDocument object.
- Quicker than SanitizeWithBitmap(PdfDocument)
- Resulted as a serachable PDF
- Layout might be inconsistency.
Declaration
public static PdfDocument SanitizeWithSvg(string pdfFilePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | pdfFilePath | A PDF File path. |
Returns
Type | Description |
---|---|
PdfDocument |
ScanPdf(PdfDocument, String[])
Scan for any risk that might exists in a PDF.
Declaration
public static CleanerScanResult ScanPdf(PdfDocument pdfDocument, string[] yaraFiles = null)
Parameters
Type | Name | Description |
---|---|---|
PdfDocument | pdfDocument | a PdfDocument object |
System.String[] | yaraFiles | Optional external yara rule files, this will override the default yara rules |
Returns
Type | Description |
---|---|
CleanerScanResult | scan result as an CleanerScanResult object |
ScanPdf(Byte[], String[])
Scan for any risk that might exists in a PDF.
Declaration
public static CleanerScanResult ScanPdf(byte[] pdfBytes, string[] yaraFiles = null)
Parameters
Type | Name | Description |
---|---|---|
System.Byte[] | pdfBytes | a PDF bytes |
System.String[] | yaraFiles | Optional external yara rule files, this will override the default yara rules |
Returns
Type | Description |
---|---|
CleanerScanResult | scan result as an CleanerScanResult object |
ScanPdf(String, String[])
Scan for any risk that might exists in a PDF.
Declaration
public static CleanerScanResult ScanPdf(string pdfFilePath, string[] yaraFiles = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | pdfFilePath | A PDF File path |
System.String[] | yaraFiles | Optional external yara rule files, this will override the default yara rules |
Returns
Type | Description |
---|---|
CleanerScanResult | scan result as an CleanerScanResult object |