Pdf | |
The PdfSanitizeManager type exposes the following members.
| Name | Description | |
|---|---|---|
| PdfSanitizeManager | Initializes a new instance of the PdfSanitizeManager class. Call one of the Load overloads first. |
| Name | Description | |
|---|---|---|
| Options | Gets or sets what is removed (Clean mode). Default by default. | |
| Rasterize | Gets or sets whether each page is replaced by an image of itself (a new document built from the rendered pages) instead of removing the dangerous objects. False by default. Options does not apply then: nothing of the original is kept, its text included. | |
| Resolution | Gets or sets the resolution the pages are rendered at with Rasterize, in dpi (36 to 600; 150 by default). |
| Name | Description | |
|---|---|---|
| Close | Closes the loaded document. | |
| Dispose | Releases the loaded document, the same as Close; calling it more than once does nothing. | |
| GetDocument | Returns the sanitized document as a new PdfDocument; the document is sanitized first when Sanitize was not called. | |
| Load(Byte) | Loads a PDF document from a byte array. | |
| Load(PdfDocument) | Loads an existing PdfDocument. It is not changed: the result is saved with Save(String) or obtained from GetDocument. | |
| Load(Stream) | Loads a PDF document from a stream. | |
| Load(String) | Loads a PDF document from a file. | |
| Load(Byte, String) | Loads a password-protected PDF document from a byte array. | |
| Load(PdfDocument, String) | Loads an existing password-protected PdfDocument. | |
| Load(Stream, String) | Loads a password-protected PDF document from a stream. | |
| Load(String, String) | Loads a password-protected PDF document from a file. | |
| Sanitize | Sanitizes the document: removes what Options names, or with Rasterize replaces every page with an image of itself. The result is what Save writes. | |
| Save | Saves the sanitized document and returns its bytes; the document is sanitized first when Sanitize was not called. | |
| Save(Stream) | Saves the sanitized document to a stream; the document is sanitized first when Sanitize was not called. | |
| Save(String) | Saves the sanitized document to a file; the document is sanitized first when Sanitize was not called. | |
| Scan | Reports everything the document holds of every kind PdfSanitizeOptions names; changes nothing. |
Two ways. By default the dangerous objects are removed (Options says which) and the file is written again, so the text stays searchable and the vectors, fonts, internal links and tags stay as they were. With Rasterize each page is rendered as an image at Resolution and a new document is built from the images: nothing of the original survives, at the cost of text, size and sharpness.
Always. The document is written whole, so earlier revisions hidden in the file are gone, and its signatures are removed (no signature survives a rewrite) and reported in Signatures. An encrypted document keeps its passwords and permissions in the default way; a rasterized one is not encrypted.
Scan only reports what the document holds, so a server can refuse a file instead of cleaning it.