PdfContent
Inheritance: java.lang.Object, com.groupdocs.watermark.contents.ContentPart, com.groupdocs.watermark.contents.Content
All Implemented Interfaces: com.groupdocs.watermark.internal.IEncryptable
public class PdfContent extends Content implements IEncryptable
Represents a pdf document where a watermark can be placed.
Learn more:
- Add watermarks to PDF documents
 - Existing objects in PDF document
 - Rasterize document or page
 - Watermarks in PDF document
 
Constructors
| Constructor | Description | 
|---|---|
| PdfContent(StreamContainer stream, StrategyManager | 
Methods
PdfContent(StreamContainer stream, StrategyManager strategyManager, PdfLoadOptions pdfLoadOptions, WatermarkerSettings watermarkerSettings) 
public PdfContent(StreamContainer stream, StrategyManager<Integer> strategyManager, PdfLoadOptions pdfLoadOptions, WatermarkerSettings watermarkerSettings)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| stream | StreamContainer | |
| strategyManager | com.groupdocs.watermark.internal.StrategyManager<java.lang.Integer> | |
| pdfLoadOptions | PdfLoadOptions | |
| watermarkerSettings | WatermarkerSettings | 
getPages()
public final PdfPageCollection getPages()
Gets the collection of all pages of this [PdfContent](../../com.groupdocs.watermark.contents/pdfcontent).
Returns:
PdfPageCollection - The collection of all pages of this [PdfContent](../../com.groupdocs.watermark.contents/pdfcontent).
getAttachments()
public final PdfAttachmentCollection getAttachments()
Gets the collection of all attachments of this [PdfContent](../../com.groupdocs.watermark.contents/pdfcontent).
Returns:
PdfAttachmentCollection - The collection of all attachments of this [PdfContent](../../com.groupdocs.watermark.contents/pdfcontent).
getPageMarginType()
public final int getPageMarginType()
Gets pdf page margins to be used during watermark adding.
This property works only when [Watermark.getConsiderParentMargins()](../../com.groupdocs.watermark/watermark#getConsiderParentMargins--) is true. If [Watermark.getConsiderParentMargins()](../../com.groupdocs.watermark/watermark#getConsiderParentMargins--) is false, when pdf CropBox is used as watermarking area.
The default value is [PdfPageMarginType.TrimBox](../../com.groupdocs.watermark.contents/pdfpagemargintype#TrimBox).
Returns: int
setPageMarginType(int value)
public final void setPageMarginType(int value)
Sets pdf page margins to be used during watermark adding.
This property works only when [Watermark.getConsiderParentMargins()](../../com.groupdocs.watermark/watermark#getConsiderParentMargins--) is set to true. If [Watermark.getConsiderParentMargins()](../../com.groupdocs.watermark/watermark#getConsiderParentMargins--) is false, when pdf CropBox is used as watermarking area.
The default value is [PdfPageMarginType.TrimBox](../../com.groupdocs.watermark.contents/pdfpagemargintype#TrimBox).
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| value | int | 
getAsposePdfDocument()
public final Document getAsposePdfDocument()
Returns: com.aspose.pdf.Document
addArtifactWatermark(Watermark watermark)
public final void addArtifactWatermark(Watermark watermark)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| watermark | Watermark | 
addAnnotationWatermark(Watermark watermark, boolean isPrintOnly)
public final void addAnnotationWatermark(Watermark watermark, boolean isPrintOnly)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| watermark | Watermark | |
| isPrintOnly | boolean | 
getDocumentInfo()
public IDocumentInfo getDocumentInfo()
Returns: IDocumentInfo
getFileType()
public FileType getFileType()
Returns: FileType
encrypt(String password)
public final void encrypt(String password)
Encrypts the document using the same password as user password and owner password.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| password | java.lang.String | User and owner password. | 
encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm)
public final void encrypt(String userPassword, String ownerPassword, int permissions, int cryptoAlgorithm)
Encrypts the content.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| userPassword | java.lang.String | User password. | 
| ownerPassword | java.lang.String | Owner password. | 
| permissions | int | Content permissions. | 
| cryptoAlgorithm | int | Cryptographic algorithm. | 
decrypt()
public final void decrypt()
Decrypts the content.
rasterize(int horizontalResolution, int verticalResolution, int imageFormat)
public final void rasterize(int horizontalResolution, int verticalResolution, int imageFormat)
Converts all content pages into images.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| horizontalResolution | int | Horizontal image resolution. | 
| verticalResolution | int | Vertical image resolution. | 
| imageFormat | int | Image format. | 
performSave(String filePath)
public void performSave(String filePath)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| filePath | java.lang.String | 
performSave(String filePath, SaveOptions saveOptions)
public void performSave(String filePath, SaveOptions saveOptions)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| filePath | java.lang.String | |
| saveOptions | SaveOptions | 
performSave(OutputStream stream)
public void performSave(OutputStream stream)
Saves the document data to the specified stream.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| stream | java.io.OutputStream | The stream to save the content data to. | 
performSave(OutputStream stream, SaveOptions saveOptions)
public void performSave(OutputStream stream, SaveOptions saveOptions)
Saves the document data to the specified stream.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| stream | java.io.OutputStream | The stream to save the content data to. | 
| saveOptions | SaveOptions | The options tha should be used when saving the content data. | 
add(Watermark watermark, WatermarkOptions options)
public void add(Watermark watermark, WatermarkOptions options)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| watermark | Watermark | |
| options | WatermarkOptions | 
generatePreview(PreviewOptions previewOptions)
public void generatePreview(PreviewOptions previewOptions)
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| previewOptions | PreviewOptions |