PdfFileStampWeb

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

All Implemented Interfaces: com.aspose.pdf.facades.IPdfFileStamp

public final class PdfFileStampWeb extends APdfFileStamp implements IPdfFileStamp

Class for adding stamps (watermark or background) to PDF files. Enable to work with HttpServletResponse.

Constructors

ConstructorDescription
PdfFileStampWeb()Constructor of the PdfFileStamp.
PdfFileStampWeb(IDocument document)Initializes new PdfFileStamp object on base of the document .
PdfFileStampWeb(IDocument document, OutputStream outputStream)Initializes new PdfFileStamp object on base of the document .
PdfFileStampWeb(IDocument document, String outputFile)Initializes new PdfFileStamp object on base of the document .
PdfFileStampWeb(InputStream inputStream, OutputStream outputStream)Constructor for PdfFileStamp.
PdfFileStampWeb(InputStream inputStream, OutputStream outputStream, boolean keepSecurity)Constructor of PdfFileStamp.
PdfFileStampWeb(String inputFile, String outputFile)Constructor for PdfFileStamp.
PdfFileStampWeb(String inputFile, String outputFile, boolean keepSecurity)Constructor for PdfFileStamp.
PdfFileStampWeb(InputStream inputStream, HttpServletResponse response)Creates PdfFileStampWeb which will save result into HttpResponse object.
PdfFileStampWeb(String inputFile, HttpServletResponse response)Creates PdfFileStampWeb which will save result into HttpResponse object.

Fields

FieldDescription
POS_BOTTOM_MIDDLEBottom middle position.
POS_BOTTOM_RIGHTBottom right position.
POS_UPPER_RIGHTRight upper position.
POS_SIDES_RIGHTRight position.
POS_UPPER_MIDDLEUpper middle position.
POS_BOTTOM_LEFTBottom left position.
POS_SIDES_LEFTLeft position.
POS_UPPER_LEFTUpper let position.

Methods

MethodDescription
getKeepSecurity()Keeps security if true.
setKeepSecurity(boolean value)Keeps security if true.
getInputFile()Gets name and path of input file.
setInputFile(String value)Sets name and path of input file.
getInputStream()Gets input stream.
setInputStream(InputStream value)Sets input stream.
getOutputFile()Gets name and path of output file.
setOutputFile(String value)Sets name and path of output file.
getOutputStream()Gets output stream.
setOutputStream(OutputStream value)Sets or sets output stream.
getPageNumberRotation()Gets rotation of page number.
setPageNumberRotation(float value)Sets rotation of page number.
setConvertTo(PdfFormat value)Sets PDF file format.
getPageHeight()Gets height of first page in source file.
getPageWidth()Gets width of first page in input file.
getStartingNumber()Gets or sets starting number for first page in input file.
setStartingNumber(int value)Sets starting number for first page in input file.
addStamp(Stamp stamp)Adds stamp to the file.
addPageNumber(String formatString)Add page number to file.
addPageNumber(FormattedText formattedText)Adds page number to the page.
addPageNumber(String formatString, int position, float leftMargin, float rightMargin, float topMargin, float bottomMargin)Adds page number to the pages of document.
addPageNumber(String formatString, float x, float y)Adds page number at the specified position on the page.
addPageNumber(FormattedText formattedText, int position, float leftMargin, float rightMargin, float topMargin, float bottomMargin)Adds page number to the pages of document.
addPageNumber(FormattedText formattedText, float x, float y)Adds page number at the specified position on the page.
addHeader(FormattedText formattedText, float topMargin)Adds header to the page.
addHeader(FormattedText formattedText, float topMargin, float leftMargin, float rightMargin)Adds header to the pages of file.
addHeader(String imageFile, float topMargin)Adds image as header to the pages of the file.
addHeader(String imageFile, float topMargin, float leftMargin, float rightMargin)Adds image as header on the pages.
addHeader(InputStream imageStream, float topMargin)Adds image as header on the pages.
addHeader(InputStream inputStream, float topMargin, float leftMargin, float rightMargin)Adds image at the top of the page.
addFooter(FormattedText formattedText, float bottomMargin)Adds footer to the pages of the document.
addFooter(FormattedText formattedText, float bottomMargin, float leftMargin, float rightMargin)Adds footer to the pages of the document.
addFooter(String imageFile, float bottomMargin)Adds image as footer to the pages of the document.
addFooter(String imageFile, float bottomMargin, float leftMargin, float rightMargin)Adds image as footer of the pages.
addFooter(InputStream imageStream, float bottomMargin)Adds image as footer of the page.
addFooter(InputStream imageStream, float bottomMargin, float leftMargin, float rightMargin)Adds image as footer of the page.
addPageNumber(String formatString, int position)Adds page number to the pages.
addPageNumber(FormattedText formattedText, int position)Adds page number to the pages.
getContentDisposition()Gets how content will be stored when result of operation is stored into HttpResponse object.
setContentDisposition(int value)Sets how content will be stored when result of operation is stored into HttpResponse object.
getSaveOptions()Gets save options when result is stored as HttpResponse.
setSaveOptions(SaveOptions value)Sets save options when result is stored as HttpResponse.
getAttachmentName()Gets name of attachment when result of operation is stored into HttpResponse objects as attachment.
setAttachmentName(String value)Sets name of attachment when result of operation is stored into HttpResponse objects as attachment.
close()Closes opened files and saves changes.
getResponse()Gets Response object where result of operation will be stored.
setResponse(HttpServletResponse value)Sets Response object where result of operation will be stored.

PdfFileStampWeb()

public PdfFileStampWeb()

Constructor of the PdfFileStamp. Input file and output file may be specified via corresponding properties.


PdfFileStamp fileStamp = new PdfFileStamp();
 fileStamp.setInputFile ( "input.pdf");
 fileStamp.setOutputFile ( "output.pdf");

PdfFileStampWeb(IDocument document)

public PdfFileStampWeb(IDocument document)

Initializes new PdfFileStamp object on base of the document .

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.

PdfFileStampWeb(IDocument document, OutputStream outputStream)

public PdfFileStampWeb(IDocument document, OutputStream outputStream)

Initializes new PdfFileStamp object on base of the document .

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.
outputStreamjava.io.OutputStreamOutput stream.

PdfFileStampWeb(IDocument document, String outputFile)

public PdfFileStampWeb(IDocument document, String outputFile)

Initializes new PdfFileStamp object on base of the document .

Parameters:

ParameterTypeDescription
documentIDocumentPdf document.
outputFilejava.lang.StringOutput file name and path.

PdfFileStampWeb(InputStream inputStream, OutputStream outputStream)

public PdfFileStampWeb(InputStream inputStream, OutputStream outputStream)

Constructor for PdfFileStamp.


InputStream input = new FileInputStream("input.pdf");
 OutputStream output = new FileInputStream("output.pdf");
 PdfFileStamp stamp = new PdfFileStamp(input, output);

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamInput stream.
outputStreamjava.io.OutputStreamOutput stream.

PdfFileStampWeb(InputStream inputStream, OutputStream outputStream, boolean keepSecurity)

public PdfFileStampWeb(InputStream inputStream, OutputStream outputStream, boolean keepSecurity)

Constructor of PdfFileStamp.

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamInput stream.
outputStreamjava.io.OutputStreamOutput stream.
keepSecuritybooleanKeep security if true.

PdfFileStampWeb(String inputFile, String outputFile)

public PdfFileStampWeb(String inputFile, String outputFile)

Constructor for PdfFileStamp.


PdfFileStamp stamp = new PdfFileStamp("input.pdf", "output.pdf");

Parameters:

ParameterTypeDescription
inputFilejava.lang.StringInput file name and path.
outputFilejava.lang.StringOutput file name and path.

PdfFileStampWeb(String inputFile, String outputFile, boolean keepSecurity)

public PdfFileStampWeb(String inputFile, String outputFile, boolean keepSecurity)

Constructor for PdfFileStamp.

Parameters:

ParameterTypeDescription
inputFilejava.lang.StringInput file name and path.
outputFilejava.lang.StringOutput file name and path.
keepSecuritybooleanKeep security if true.

PdfFileStampWeb(InputStream inputStream, HttpServletResponse response)

public PdfFileStampWeb(InputStream inputStream, HttpServletResponse response)

Creates PdfFileStampWeb which will save result into HttpResponse object.

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamStream with input document.
responsejavax.servlet.http.HttpServletResponseHttpResponse object where result will be saved.

PdfFileStampWeb(String inputFile, HttpServletResponse response)

public PdfFileStampWeb(String inputFile, HttpServletResponse response)

Creates PdfFileStampWeb which will save result into HttpResponse object.

Parameters:

ParameterTypeDescription
inputFilejava.lang.StringSource file name.
responsejavax.servlet.http.HttpServletResponseHttpResponse object where result will be saved.

POS_BOTTOM_MIDDLE

public static final int POS_BOTTOM_MIDDLE

Bottom middle position.

POS_BOTTOM_RIGHT

public static final int POS_BOTTOM_RIGHT

Bottom right position.

POS_UPPER_RIGHT

public static final int POS_UPPER_RIGHT

Right upper position.

POS_SIDES_RIGHT

public static final int POS_SIDES_RIGHT

Right position.

POS_UPPER_MIDDLE

public static final int POS_UPPER_MIDDLE

Upper middle position.

POS_BOTTOM_LEFT

public static final int POS_BOTTOM_LEFT

Bottom left position.

POS_SIDES_LEFT

public static final int POS_SIDES_LEFT

Left position.

POS_UPPER_LEFT

public static final int POS_UPPER_LEFT

Upper let position.

getKeepSecurity()

public boolean getKeepSecurity()

Keeps security if true. (This feature will be implemented in next versions).

Returns: boolean - boolean value

setKeepSecurity(boolean value)

public void setKeepSecurity(boolean value)

Keeps security if true. (This feature will be implemented in next versions).

Parameters:

ParameterTypeDescription
valuebooleanboolean value

getInputFile()

public String getInputFile()

Gets name and path of input file.

Returns: java.lang.String - String object

setInputFile(String value)

public void setInputFile(String value)

Sets name and path of input file.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString object

getInputStream()

public InputStream getInputStream()

Gets input stream.

Returns: java.io.InputStream - InputStream object

setInputStream(InputStream value)

public void setInputStream(InputStream value)

Sets input stream.

Parameters:

ParameterTypeDescription
valuejava.io.InputStreamInputStream object

getOutputFile()

public String getOutputFile()

Gets name and path of output file.

Returns: java.lang.String - String object

setOutputFile(String value)

public void setOutputFile(String value)

Sets name and path of output file.

Parameters:

ParameterTypeDescription
valuejava.lang.StringString object

getOutputStream()

public OutputStream getOutputStream()

Gets output stream.

Returns: java.io.OutputStream - OutputStream object

setOutputStream(OutputStream value)

public void setOutputStream(OutputStream value)

Sets or sets output stream.

Parameters:

ParameterTypeDescription
valuejava.io.OutputStreamOutputStream object

getPageNumberRotation()

public float getPageNumberRotation()

Gets rotation of page number. Rotation is in degrees. Default is 0.

Returns: float - float value

setPageNumberRotation(float value)

public void setPageNumberRotation(float value)

Sets rotation of page number. Rotation is in degrees. Default is 0.

Parameters:

ParameterTypeDescription
valuefloatfloat value

setConvertTo(PdfFormat value)

public void setConvertTo(PdfFormat value)

Sets PDF file format. Result file will be saved in specified file format. If this property is not specified then file will be save in default PDF format without conversion.

Parameters:

ParameterTypeDescription
valuePdfFormatPdfFormat element

getPageHeight()

public float getPageHeight()

Gets height of first page in source file.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  System.out.println("Height = " + fileStamp.getPageHeight());
  fileStamp.close();

Returns: float - float value

getPageWidth()

public float getPageWidth()

Gets width of first page in input file.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  System.out.println("Width = " + fileStamp.getPageWidth());
  fileStamp.close();

Returns: float - float value

getStartingNumber()

public int getStartingNumber()

Gets or sets starting number for first page in input file. Next pages will be numbered starting from this value.

Returns: int - int value

setStartingNumber(int value)

public void setStartingNumber(int value)

Sets starting number for first page in input file. Next pages will be numbered starting from this value. For example if StartingNumber is set to 100, document pages will have numbers 100, 101, 102…


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.setStartingNumber( 100);
  fileStamp.addPageNumber("Page #");
  fileStamp.close();

Parameters:

ParameterTypeDescription
valueintint value

addStamp(Stamp stamp)

public void addStamp(Stamp stamp)

Adds stamp to the file.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  Stamp stamp = new com.aspose.pdf.facades.Stamp();
  stamp.setOrigin(140, 400);
  stamp.setImageSize(50, 50);
  stamp.setOpacity ( 0.8f);
  stamp.isBackground ( true);
  stamp.bindImage("image.jpg");
  fileStamp.addStamp(stamp);
  fileStamp.close();

Parameters:

ParameterTypeDescription
stampStampStamp object.

addPageNumber(String formatString)

public void addPageNumber(String formatString)

Add page number to file. Page number text may contain # sign which will be replaced with number of the page. Page number is placed in the bottom of the page centered horizontally.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.addPageNumber("Page #");
  fileStamp.close();

Parameters:

ParameterTypeDescription
formatStringjava.lang.StringText of page number

addPageNumber(FormattedText formattedText)

public void addPageNumber(FormattedText formattedText)

Adds page number to the page. Page number may contain # sign which will be replaced with page number. Page number is placed in the bottom of the page centered horizontally.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.addPageNumber(new FormattedText("Page #"));
  fileStamp.close();

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormat string for page number representes as FormattedText.

addPageNumber(String formatString, int position, float leftMargin, float rightMargin, float topMargin, float bottomMargin)

public void addPageNumber(String formatString, int position, float leftMargin, float rightMargin, float topMargin, float bottomMargin)

Adds page number to the pages of document.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.addPageNumber("Page #", PdfFileStamp.POS_BOTTOM_LEFT, 100, 100, 200, 200);
  fileStamp.close();

Parameters:

ParameterTypeDescription
formatStringjava.lang.StringFormat string for page number.
positionintPosition where page number will be placed on the page. 0-bottom middle, 1-bottom right, 2-upper right, 3 - sides right, 4 - upper middle,5 - bottom left,6 - sides left,7 - upper left. You can use the following constants: PosBottomMiddle = 0, PosBottomRight = 1, PosUpperRight = 2, PosSidesRight = 3, PosUpperMiddle, PosBottomLeft = 5, PosSidesLeft, PosUpperLeft
leftMarginfloatMargin on the left edge of the page.
rightMarginfloatMargin on the right edge of the page.
topMarginfloatMargin on the top edge of the page.
bottomMarginfloatMargin on the bottom edge of the page.

addPageNumber(String formatString, float x, float y)

public void addPageNumber(String formatString, float x, float y)

Adds page number at the specified position on the page.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
 fileStamp.addPageNumber(new FormattedText("Page  #"), 123, 357);
 fileStamp.close();

Parameters:

ParameterTypeDescription
formatStringjava.lang.StringFormat string. Format string can contain # sign which will be replaced with page number.
xfloatX coordinate of page number.
yfloatY coordinate of page number.

addPageNumber(FormattedText formattedText, int position, float leftMargin, float rightMargin, float topMargin, float bottomMargin)

public void addPageNumber(FormattedText formattedText, int position, float leftMargin, float rightMargin, float topMargin, float bottomMargin)

Adds page number to the pages of document.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.addPageNumber(new FormattedText("Page #"), PdfFileStamp.POS_BOTTOM_LEFT, 100, 100, 200, 200);
  fileStamp.close();

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormattedText object which represents page number format and properties iof the text.
positionintPosition where page number will be placed on the page. 0-bottom middle, 1-bottom right, 2-upper right, 3 - sides right, 4 - upper middle,5 - bottom left,6 - sides left,7 - upper left. You can use the following constants: PosBottomMiddle = 0, PosBottomRight = 1, PosUpperRight = 2, PosSidesRight = 3, PosUpperMiddle, PosBottomLeft = 5, PosSidesLeft, PosUpperLeft
leftMarginfloatMargin on the left edge of the page.
rightMarginfloatMargin on the right edge of the page.
topMarginfloatMargin on the top edge of the page.
bottomMarginfloatMargin on the bottom edge of the page.

addPageNumber(FormattedText formattedText, float x, float y)

public void addPageNumber(FormattedText formattedText, float x, float y)

Adds page number at the specified position on the page.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
 fileStamp.addPageNumber(new FormattedText("Page  #"), 123, 357);
 fileStamp.close();

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormatted text which represents page number format and properties of the text. Format string can contain # sign which will be replaced with page number.
xfloatX coordinate of page number.
yfloatY coordinate of page number.

addHeader(FormattedText formattedText, float topMargin)

public void addHeader(FormattedText formattedText, float topMargin)

Adds header to the page.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
 fileStamp.addHeader(new FormattedText("Head of the page"), 50);
 fileStamp.close();

Parameters:

ParameterTypeDescription
formattedTextFormattedTextText for header and properties of the text.
topMarginfloatMargin on the top of page.

addHeader(FormattedText formattedText, float topMargin, float leftMargin, float rightMargin)

public void addHeader(FormattedText formattedText, float topMargin, float leftMargin, float rightMargin)

Adds header to the pages of file.


PdfFileStamp stamp = new PdfFileStamp("input.pdf", "output.pdf");
 stamp.addHeader(new FormattedText("Head of the page"), 10, 50, 50);

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormatted text object which contains page text and its properties.
topMarginfloatMargin on the top of the page.
leftMarginfloatMargin on the left of the page.
rightMarginfloatMargin on the right of the page.

addHeader(String imageFile, float topMargin)

public void addHeader(String imageFile, float topMargin)

Adds image as header to the pages of the file.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 fileStamp.addHeader("image.jpg", 50);
 fileStamp.close();

Parameters:

ParameterTypeDescription
imageFilejava.lang.StringPath to the image file.
topMarginfloatMargin at top of the page.

addHeader(String imageFile, float topMargin, float leftMargin, float rightMargin)

public void addHeader(String imageFile, float topMargin, float leftMargin, float rightMargin)

Adds image as header on the pages.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 fileStamp.addHeader("image.jpg", 50, 100, 100);
 fileStamp.close();

Parameters:

ParameterTypeDescription
imageFilejava.lang.StringPath to the image file.
topMarginfloatMargin at top of the page.
leftMarginfloatMargin at left side of the page.
rightMarginfloatMargin at right side of the page.

addHeader(InputStream imageStream, float topMargin)

public void addHeader(InputStream imageStream, float topMargin)

Adds image as header on the pages.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 InputStream input = new FileInputStream("test.jpg");
 fileStamp.addHeader(input, 50);
 fileStamp.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamStream of the image.
topMarginfloatMargin at top of the page.

addHeader(InputStream inputStream, float topMargin, float leftMargin, float rightMargin)

public void addHeader(InputStream inputStream, float topMargin, float leftMargin, float rightMargin)

Adds image at the top of the page.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 InputStream input = new FileInputStream("test.jpg");
 fileStamp.addHeader(input, 50, 100, 100);
 fileStamp.close();

Parameters:

ParameterTypeDescription
inputStreamjava.io.InputStreamStream which contains image data.
topMarginfloatMargin at top of the page.
leftMarginfloatMargin at left side of the page.
rightMarginfloatMargin at right side of the page.

addFooter(FormattedText formattedText, float bottomMargin)

public void addFooter(FormattedText formattedText, float bottomMargin)

Adds footer to the pages of the document.


PdfFileStamp stamp = new PdfFileStamp("input.pdf", "output.pdf");
 stamp.addFooter(new FormattedText("Foot of the page"), 10);

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormattedText object which contains text of the footer and text properties.
bottomMarginfloatMargin at the top of page.

addFooter(FormattedText formattedText, float bottomMargin, float leftMargin, float rightMargin)

public void addFooter(FormattedText formattedText, float bottomMargin, float leftMargin, float rightMargin)

Adds footer to the pages of the document.


PdfFileStamp stamp = new PdfFileStamp("input.pdf", "output.pdf");
 stamp.addFooter(new FormattedText("Foot of the page"), 10, 50, 50);

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormattedText object which contains footer text and text properties.
bottomMarginfloatMargin at the bottom of the page.
leftMarginfloatMargin at the left side of the page.
rightMarginfloatMargin at the right side of the page.

addFooter(String imageFile, float bottomMargin)

public void addFooter(String imageFile, float bottomMargin)

Adds image as footer to the pages of the document.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 fileStamp.addFooter("image.jpg", 50);
 fileStamp.close();

Parameters:

ParameterTypeDescription
imageFilejava.lang.StringImage file name and path.
bottomMarginfloatMargin at the bottom of the page.

addFooter(String imageFile, float bottomMargin, float leftMargin, float rightMargin)

public void addFooter(String imageFile, float bottomMargin, float leftMargin, float rightMargin)

Adds image as footer of the pages.

Parameters:

ParameterTypeDescription
imageFilejava.lang.StringIamge file name and path.
bottomMarginfloatMargin at the bottom of the page.
leftMarginfloatMargin at the left side of the page.
rightMarginfloatMargin at the right side of the page.

addFooter(InputStream imageStream, float bottomMargin)

public void addFooter(InputStream imageStream, float bottomMargin)

Adds image as footer of the page.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 InputStream input = new FileInputStream("test.jpg");
 fileStamp.addFooter(input, 50);
 fileStamp.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamStream contains image data.
bottomMarginfloatMargin at the bottom of the page.

addFooter(InputStream imageStream, float bottomMargin, float leftMargin, float rightMargin)

public void addFooter(InputStream imageStream, float bottomMargin, float leftMargin, float rightMargin)

Adds image as footer of the page.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", output.pdf");
 InputStream input = new FileInputStream("test.jpg");
 fileStamp.addFooter(input, 50, 50, 50);
 fileStamp.close();

Parameters:

ParameterTypeDescription
imageStreamjava.io.InputStreamStream contains image data.
bottomMarginfloatMargin at the bottom of the page.
leftMarginfloatMargin at the left side of the page.
rightMarginfloatMargin at the right side of the page.

addPageNumber(String formatString, int position)

public void addPageNumber(String formatString, int position)

Adds page number to the pages.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.addPageNumber("Page #", PdfFileStamp.PosUpperRight);
  fileStamp.close();

Parameters:

ParameterTypeDescription
formatStringjava.lang.StringFormat of the page number. This text may contain # which will be replaced with page number.
positionintPosition where page number will be placed on the page. 0-bottom middle, 1-bottom right, 2-upper right, 3 - sides right, 4 - upper middle,5 - bottom left,6 - sides left,7 - upper left. You can use the following constants: PosBottomMiddle = 0, PosBottomRight = 1, PosUpperRight = 2, PosSidesRight = 3, PosUpperMiddle, PosBottomLeft = 5, PosSidesLeft, PosUpperLeft

addPageNumber(FormattedText formattedText, int position)

public void addPageNumber(FormattedText formattedText, int position)

Adds page number to the pages.


PdfFileStamp fileStamp = new PdfFileStamp("input.pdf", "output.pdf");
  fileStamp.addPageNumber("Page #", PdfFileStamp.PosUpperRight);
  fileStamp.close();

Parameters:

ParameterTypeDescription
formattedTextFormattedTextFormattedText object which contains format of the page number and text properties. This text may contain # which will be replaced with page number.
positionintPosition where page number will be placed on the page. 0-bottom middle, 1-bottom right, 2-upper right, 3 - sides right, 4 - upper middle,5 - bottom left,6 - sides left,7 - upper left. You can use the following constants: PosBottomMiddle = 0, PosBottomRight = 1, PosUpperRight = 2, PosSidesRight = 3, PosUpperMiddle, PosBottomLeft = 5, PosSidesLeft, PosUpperLeft

getContentDisposition()

public int getContentDisposition()

Gets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.

Returns: int - ContentDisposition element

setContentDisposition(int value)

public void setContentDisposition(int value)

Sets how content will be stored when result of operation is stored into HttpResponse object. Possible value: inline / attachment. Default: inline.

Parameters:

ParameterTypeDescription
valueintContentDisposition element

getSaveOptions()

public SaveOptions getSaveOptions()

Gets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.

Returns: SaveOptions - SaveOptions object

setSaveOptions(SaveOptions value)

public void setSaveOptions(SaveOptions value)

Sets save options when result is stored as HttpResponse. Default value: PdfSaveOptions.

Parameters:

ParameterTypeDescription
valueSaveOptionsSaveOptions object

getAttachmentName()

public String getAttachmentName()

Gets name of attachment when result of operation is stored into HttpResponse objects as attachment.

Returns: java.lang.String - string object

setAttachmentName(String value)

public void setAttachmentName(String value)

Sets name of attachment when result of operation is stored into HttpResponse objects as attachment.

Parameters:

ParameterTypeDescription
valuejava.lang.Stringstring object

close()

public void close()

Closes opened files and saves changes. Warning. If input or output streams are specified they are not closed by Close() method.


PdfFileStamp stamp = new PdfFileStamp("input.pdf", "output.pdf");
 //do some work...
 stamp.close();

getResponse()

public HttpServletResponse getResponse()

Gets Response object where result of operation will be stored.

Returns: javax.servlet.http.HttpServletResponse - HttpServletResponse object

setResponse(HttpServletResponse value)

public void setResponse(HttpServletResponse value)

Sets Response object where result of operation will be stored.

Parameters:

ParameterTypeDescription
valuejavax.servlet.http.HttpServletResponseHttpServletResponse object