Package eu.europa.esig.dss.pdf.pdfbox
Class PdfBoxUtils
java.lang.Object
eu.europa.esig.dss.pdf.pdfbox.PdfBoxUtils
Contains a set of utils for PdfBox implementation
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary
createSignatureAppearanceDictionary
(org.apache.pdfbox.pdmodel.PDDocument pdDocument, org.apache.pdfbox.pdmodel.common.PDRectangle pdRectangle) This method creates a generic Appearance dictionary, containing a Normal Appearancestatic BufferedImage
generateBufferedImageScreenshot
(DSSDocument pdfDocument, char[] passwordProtection, int page) The method generates a BufferedImage for the specified page of the documentstatic BufferedImage
generateBufferedImageScreenshot
(DSSDocument pdfDocument, String passwordProtection, int page) The method generates a BufferedImage for the specified page of the document with String passwordstatic DSSDocument
generateScreenshot
(DSSDocument pdfDocument, char[] passwordProtection, int page) Generates a screenshot image of the specified page for the given PDF documentstatic DSSDocument
generateScreenshot
(DSSDocument pdfDocument, char[] passwordProtection, int page, DSSResourcesHandler dssResourcesHandler) Generates a screenshot image of the specified page for the given PDF document using a providedeu.europa.esig.dss.signature.resources.DSSResourcesHandler
static DSSDocument
generateScreenshot
(DSSDocument pdfDocument, int page) Generates a screenshot image of the specified page for the given PDF documentstatic DSSDocument
generateScreenshot
(DSSDocument pdfDocument, String passwordProtection, int page) Generates a screenshot image of the specified page for the given PDF documentstatic DSSDocument
generateScreenshot
(DSSDocument pdfDocument, String passwordProtection, int page, DSSResourcesHandler dssResourcesHandler) Generates a screenshot image of the specified page for the given PDF document using a providedeu.europa.esig.dss.signature.resources.DSSResourcesHandler
static DSSDocument
generateSubtractionImage
(DSSDocument document1, char[] passwordDocument1, int pageDocument1, DSSDocument document2, char[] passwordDocument2, int pageDocument2) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pagesstatic DSSDocument
generateSubtractionImage
(DSSDocument document1, char[] passwordDocument1, int pageDocument1, DSSDocument document2, char[] passwordDocument2, int pageDocument2, DSSResourcesHandler dssResourcesHandler) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pages.static DSSDocument
generateSubtractionImage
(DSSDocument document1, DSSDocument document2, int page) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the given page numberstatic DSSDocument
generateSubtractionImage
(DSSDocument document1, String passwordDocument1, int pageDocument1, DSSDocument document2, String passwordDocument2, int pageDocument2) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pagesstatic DSSDocument
generateSubtractionImage
(DSSDocument document1, String passwordDocument1, int pageDocument1, DSSDocument document2, String passwordDocument2, int pageDocument2, DSSResourcesHandler dssResourcesHandler) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pages.
-
Method Details
-
generateScreenshot
Generates a screenshot image of the specified page for the given PDF document- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpage
- a page number- Returns:
DSSDocument
PNG screenshot
-
generateScreenshot
public static DSSDocument generateScreenshot(DSSDocument pdfDocument, String passwordProtection, int page) Generates a screenshot image of the specified page for the given PDF document- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpasswordProtection
-String
a PDF password protection phrasepage
- a page number- Returns:
DSSDocument
PNG screenshot
-
generateScreenshot
public static DSSDocument generateScreenshot(DSSDocument pdfDocument, char[] passwordProtection, int page) Generates a screenshot image of the specified page for the given PDF document- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpasswordProtection
- a PDF password protection phrasepage
- a page number- Returns:
DSSDocument
PNG screenshot
-
generateScreenshot
public static DSSDocument generateScreenshot(DSSDocument pdfDocument, String passwordProtection, int page, DSSResourcesHandler dssResourcesHandler) Generates a screenshot image of the specified page for the given PDF document using a providedeu.europa.esig.dss.signature.resources.DSSResourcesHandler
- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpasswordProtection
-String
a PDF password protection phrasepage
- a page numberdssResourcesHandler
-DSSResourcesHandler
- Returns:
DSSDocument
PNG screenshot
-
generateScreenshot
public static DSSDocument generateScreenshot(DSSDocument pdfDocument, char[] passwordProtection, int page, DSSResourcesHandler dssResourcesHandler) Generates a screenshot image of the specified page for the given PDF document using a providedeu.europa.esig.dss.signature.resources.DSSResourcesHandler
- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpasswordProtection
- a PDF password protection phrasepage
- a page numberdssResourcesHandler
-DSSResourcesHandler
- Returns:
DSSDocument
PNG screenshot
-
generateBufferedImageScreenshot
public static BufferedImage generateBufferedImageScreenshot(DSSDocument pdfDocument, String passwordProtection, int page) The method generates a BufferedImage for the specified page of the document with String password- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpasswordProtection
-String
a PDF password protection phrasepage
- a page number to be generates (starts from 1)- Returns:
BufferedImage
-
generateBufferedImageScreenshot
public static BufferedImage generateBufferedImageScreenshot(DSSDocument pdfDocument, char[] passwordProtection, int page) The method generates a BufferedImage for the specified page of the document- Parameters:
pdfDocument
-DSSDocument
to generate screenshot forpasswordProtection
- a PDF password protection phrasepage
- a page number to be generates (starts from 1)- Returns:
BufferedImage
-
generateSubtractionImage
public static DSSDocument generateSubtractionImage(DSSDocument document1, DSSDocument document2, int page) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the given page number- Parameters:
document1
-DSSDocument
document2
-DSSDocument
page
- page number- Returns:
DSSDocument
subtraction result
-
generateSubtractionImage
public static DSSDocument generateSubtractionImage(DSSDocument document1, String passwordDocument1, int pageDocument1, DSSDocument document2, String passwordDocument2, int pageDocument2) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pages- Parameters:
document1
-DSSDocument
the first documentpasswordDocument1
-String
a password protection for thedocument1
when applicable (can be null)pageDocument1
- page number identifying a page of thedocument1
to be proceededdocument2
-DSSDocument
the second documentpasswordDocument2
-String
a password protection for thedocument2
when applicable (can be null)pageDocument2
- page number identifying a page of thedocument2
to be proceeded- Returns:
DSSDocument
subtraction result
-
generateSubtractionImage
public static DSSDocument generateSubtractionImage(DSSDocument document1, char[] passwordDocument1, int pageDocument1, DSSDocument document2, char[] passwordDocument2, int pageDocument2) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pages- Parameters:
document1
-DSSDocument
the first documentpasswordDocument1
- a password protection for thedocument1
when applicable (can be null)pageDocument1
- page number identifying a page of thedocument1
to be proceededdocument2
-DSSDocument
the second documentpasswordDocument2
- a password protection for thedocument2
when applicable (can be null)pageDocument2
- page number identifying a page of thedocument2
to be proceeded- Returns:
DSSDocument
subtraction result
-
generateSubtractionImage
public static DSSDocument generateSubtractionImage(DSSDocument document1, String passwordDocument1, int pageDocument1, DSSDocument document2, String passwordDocument2, int pageDocument2, DSSResourcesHandler dssResourcesHandler) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pages. This method uses a providedDSSResourcesHandler
- Parameters:
document1
-DSSDocument
the first documentpasswordDocument1
-String
a password protection for thedocument1
when applicable (can be null)pageDocument1
- page number identifying a page of thedocument1
to be proceededdocument2
-DSSDocument
the second documentpasswordDocument2
-String
a password protection for thedocument2
when applicable (can be null)pageDocument2
- page number identifying a page of thedocument2
to be proceededdssResourcesHandler
-DSSResourcesHandler
to be used- Returns:
DSSDocument
subtraction result
-
generateSubtractionImage
public static DSSDocument generateSubtractionImage(DSSDocument document1, char[] passwordDocument1, int pageDocument1, DSSDocument document2, char[] passwordDocument2, int pageDocument2, DSSResourcesHandler dssResourcesHandler) This method returns an image representing a subtraction result betweendocument1
anddocument2
for the defined pages. This method uses a providedDSSResourcesHandler
- Parameters:
document1
-DSSDocument
the first documentpasswordDocument1
- a password protection for thedocument1
when applicable (can be null)pageDocument1
- page number identifying a page of thedocument1
to be proceededdocument2
-DSSDocument
the second documentpasswordDocument2
- a password protection for thedocument2
when applicable (can be null)pageDocument2
- page number identifying a page of thedocument2
to be proceededdssResourcesHandler
-DSSResourcesHandler
to be used- Returns:
DSSDocument
subtraction result
-
createSignatureAppearanceDictionary
public static org.apache.pdfbox.pdmodel.interactive.annotation.PDAppearanceDictionary createSignatureAppearanceDictionary(org.apache.pdfbox.pdmodel.PDDocument pdDocument, org.apache.pdfbox.pdmodel.common.PDRectangle pdRectangle) This method creates a generic Appearance dictionary, containing a Normal Appearance- Parameters:
pdDocument
-PDDocument
to create a new Appearance dictionary inpdRectangle
-PDRectangle
used for annotation dictionary- Returns:
PDAppearanceDictionary
-