PdfFileSanitization

Inheritance: java.lang.Object, com.aspose.pdf.facades.IVentureLicenseTarget, com.aspose.pdf.facades.Facade, com.aspose.pdf.facades.SaveableFacade

All Implemented Interfaces: com.aspose.pdf.engine.security.impl.signatures.sanitization.IRecovery

public final class PdfFileSanitization extends SaveableFacade implements IRecovery

Represents sanitization and recovery API. Use it if you can’t create/open documents in any other way.

Constructors

ConstructorDescription
PdfFileSanitization()Initializes a new instance.

Methods

MethodDescription
getLog()After file has Saved you can check what was done with file.
getUseTrimTop()Allows to remove data before pdf data.
setUseTrimTop(boolean value)Allows to remove data before pdf data.
getUseTrimBottom()Allows to remove data after pdf data
setUseTrimBottom(boolean value)Allows to remove data after pdf data
getUseRebuildXrefAndTrailer()Allows to generate new xref and trailer for document.
setUseRebuildXrefAndTrailer(boolean value)Allows to generate new xref and trailer for document.
save(String outputFile)Saves the result PDF to file.
save(OutputStream outputStream)Saves the result PDF to stream.
bindPdf(String inputFile)Binds a Pdf file for Sanitize.
bindPdf(InputStream inputStream)Binds a Pdf stream for Sanitize.
bindPdf(Document srcDoc)Initializes the facade.
recover()Recovers document.
trimTop()Removes data before %PDF.
trimBottom()Removes data after last %%EOF.
rebuildXrefAndTrailer()Removes old xref with trailer and creates a new xref with trailer.
close()Closes the facade.

PdfFileSanitization()

public PdfFileSanitization()

Initializes a new instance.

getLog()

public final List<String> getLog()

After file has Saved you can check what was done with file.

Returns: java.util.List<java.lang.String> - list of String elements

getUseTrimTop()

public final boolean getUseTrimTop()

Allows to remove data before pdf data.

Returns: boolean - boolean value

setUseTrimTop(boolean value)

public final void setUseTrimTop(boolean value)

Allows to remove data before pdf data.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getUseTrimBottom()

public final boolean getUseTrimBottom()

Allows to remove data after pdf data

Returns: boolean - boolean value

setUseTrimBottom(boolean value)

public final void setUseTrimBottom(boolean value)

Allows to remove data after pdf data

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getUseRebuildXrefAndTrailer()

public final boolean getUseRebuildXrefAndTrailer()

Allows to generate new xref and trailer for document.

Returns: boolean - boolean value

setUseRebuildXrefAndTrailer(boolean value)

public final void setUseRebuildXrefAndTrailer(boolean value)

Allows to generate new xref and trailer for document.

Parameters:

ParameterTypeDescription
valuebooleanboolean value

save(String outputFile)

public void save(String outputFile)

Saves the result PDF to file.

Parameters:

ParameterTypeDescription
outputFilejava.lang.Stringoutput pdf file

save(OutputStream outputStream)

public void save(OutputStream outputStream)

Saves the result PDF to stream.

Parameters:

ParameterTypeDescription
outputStreamjava.io.OutputStreamoutput pdf stream

bindPdf(String inputFile)

public void bindPdf(String inputFile)

Binds a Pdf file for Sanitize.

Parameters:

ParameterTypeDescription
inputFilejava.lang.StringThe pdf file to be edited.

bindPdf(InputStream inputStream)

public void bindPdf(InputStream inputStream)

Binds a Pdf stream for Sanitize.

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamThe pdf stream to be edited.

bindPdf(Document srcDoc)

public void bindPdf(Document srcDoc)

Initializes the facade.

Parameters:

ParameterTypeDescription
srcDocDocumentThe Document object.

recover()

public final void recover()

Recovers document. Use properties to customize.

trimTop()

public final void trimTop()

Removes data before %PDF.

trimBottom()

public final void trimBottom()

Removes data after last %%EOF.

rebuildXrefAndTrailer()

public final void rebuildXrefAndTrailer()

Removes old xref with trailer and creates a new xref with trailer.

close()

public void close()

Closes the facade.