![]() |
||
Home Products Purchase Downloads Demos Forums Blogs Ticket Wiki API Corporate |
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.aspose.pdf.kit.PdfFileMend
Represents a class for adding texts and images on the pages of existing Pdf file.
Constructor Summary | |
PdfFileMend(java.io.InputStream inputStream,
java.io.OutputStream outputStream)
Initializes an object instance of PdfFileMend. |
|
PdfFileMend(java.lang.String inputFileName,
java.lang.String outputFileName)
Initializes an object instance of PdfFileMend. |
Method Summary | |
boolean |
addImage(java.io.InputStream imageStream,
int[] pageNums,
float lowerLeftX,
float lowerLeftY,
float upperRightX,
float upperRightY)
Adheres image to the page of Pdf file at given coordinates,Jpg,Gif,Png,Bmp are supported. |
boolean |
addImage(java.io.InputStream imageStream,
int pageNum,
float lowerLeftX,
float lowerLeftY,
float upperRightX,
float upperRightY)
Adheres image to the page of Pdf file at given coordinates,Jpg,Gif,Png,Bmp are supported. |
boolean |
addImage(java.lang.String imageName,
int[] pageNums,
float lowerLeftX,
float lowerLeftY,
float upperRightX,
float upperRightY)
Adheres image to the page of Pdf file at given coordinates,Jpg,Gif,Png,Bmp are supported. |
boolean |
addImage(java.lang.String imageName,
int pageNum,
float lowerLeftX,
float lowerLeftY,
float upperRightX,
float upperRightY)
Adheres image to the page of Pdf file at given coordinates,Jpg,Gif,Png,Bmp are supported. |
boolean |
addText(FormattedText text,
int[] pageNums,
float lowerLeftX,
float lowerLeftY,
float upperRightX,
float upperRightY)
Adheres text to the page of Pdf file at given coordinates. |
boolean |
addText(FormattedText text,
int pageNum,
float lowerLeftX,
float lowerLeftY,
float upperRightX,
float upperRightY)
Adheres text to the page of Pdf file at given coordinates. |
void |
close()
Writes the text and image to the input stream or file,and closes the PdfFileMend object. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PdfFileMend(java.lang.String inputFileName, java.lang.String outputFileName) throws java.io.FileNotFoundException, java.io.IOException, PdfKitException
inputFileName
- String Input Pdf file (path)name.outputFileName
- String Output Pdf file (path)name.
java.io.FileNotFoundException
java.io.IOException
PdfKitException
public PdfFileMend(java.io.InputStream inputStream, java.io.OutputStream outputStream) throws java.io.IOException, PdfKitException
inputStream
- InputStream Input Pdf stream.outputStream
- OutputStream Output Pdf stream.
java.io.IOException
PdfKitException
Method Detail |
public boolean addText(FormattedText text, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY) throws PdfKitException, java.io.IOException
text
- FormattedText Text with format to be added.pageNum
- int Indicates which page will the text be added to.lowerLeftX
- float The horizontal position of lower left point on the retangle area lined out for adding text.lowerLeftY
- float The vertical position of lower left point on the retangle area lined out for adding text.upperRightX
- float The horizontal position of upper right point on the retangle area lined out for adding text.upperRightY
- float The vertical position of upper right point on the retangle area lined out for adding text.
PdfKitException
java.io.IOException
public boolean addText(FormattedText text, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY) throws java.io.IOException, PdfKitException
[SampleCode] String inputFile = "rotation270.pdf"; String outputFile = "kitOut.pdf"; int[] pages = new int[] {1,2}; PdfFileInfo fileInfo = new PdfFileInfo(inputFile); float height = fileInfo.getPageHeight(1); float width = fileInfo.getPageWidth(1); int rotation = fileInfo.getPageRotation(1); PdfFileMend mendor = new PdfFileMend(inputFile, outputFile); switch (rotation) { case 0: mendor.addText(new FormattedText("PdfFileMend testing! 0 rotation."),pages, 10, height - 25, width, height - 10); //lowerleftX < upperrightX,lowerleftY < upperrightY break; case 90: mendor.addText(new FormattedText("PdfFileMend testing! 90 rotation."),pages, width - 25, height - 10, width - 45,height - 150); //lowerleftX > upperrightX,lowerleftY > upperrightY break; case 180: mendor.addText(new FormattedText("PdfFileMend testing! 180 rotation."),pages, 10, 10, width, 25); //lowerleftX < upperrightX,lowerleftY < upperrightY break; case 270: mendor.addText(new FormattedText("PdfFileMend testing! 270 rotation."),pages, 10, 10, 25, height - 10); //lowerleftX < upperrightX,lowerleftY < upperrightY break; default: break; } mendor.close(); }
text
- FormattedText Text with format to be added.pageNums
- int[] Indicates which pages will the text be added to.lowerLeftX
- float The horizontal position of lower left point on the retangle area lined out for adding text.lowerLeftY
- float The vertical position of lower left point on the retangle area lined out for adding text.upperRightX
- float The horizontal position of upper right point on the retangle area lined out for adding text.upperRightY
- float The vertical position of upper right point on the retangle area lined out for adding text.
java.io.IOException
PdfKitException
public boolean addImage(java.lang.String imageName, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY) throws java.io.IOException, com.aspose.pdf.kit.BadElementException, PdfKitException
imageName
- String Input image (path)name.pageNum
- int Indicates which page will the image be added to.lowerLeftX
- float The horizontal position of lower left point on the retangle area lined out for adding image.lowerLeftY
- float The vertical position of lower left point on the retangle area lined out for adding image.upperRightX
- float The horizontal position of upper right point on the retangle area lined out for adding image.upperRightY
- float The vertical position of upper right point on the retangle area lined out for adding image.
BadElementException
java.io.IOException
PdfKitException
public boolean addImage(java.lang.String imageName, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY) throws com.aspose.pdf.kit.BadElementException, java.io.IOException, PdfKitException
imageName
- String Input image (path)name.pageNums
- int[] Indicates which pages will the image be added to.lowerLeftX
- float The horizontal position of lower left point on the retangle area lined out for adding image.lowerLeftY
- float The vertical position of lower left point on the retangle area lined out for adding image.upperRightX
- float The horizontal position of upper right point on the retangle area lined out for adding image.upperRightY
- float The vertical position of upper right point on the retangle area lined out for adding image.
BadElementException
java.io.IOException
PdfKitException
public boolean addImage(java.io.InputStream imageStream, int pageNum, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY) throws com.aspose.pdf.kit.BadElementException, java.io.IOException, PdfKitException
imageStream
- InputStream Input image stream.pageNum
- int Indicates which page will the image be added to.lowerLeftX
- float The horizontal position of lower left point on the retangle area lined out for adding image.lowerLeftY
- float The vertical position of lower left point on the retangle area lined out for adding image.upperRightX
- float The horizontal position of upper right point on the retangle area lined out for adding image.upperRightY
- float The vertical position of upper right point on the retangle area lined out for adding image.
BadElementException
java.io.IOException
PdfKitException
public boolean addImage(java.io.InputStream imageStream, int[] pageNums, float lowerLeftX, float lowerLeftY, float upperRightX, float upperRightY) throws com.aspose.pdf.kit.BadElementException, java.io.IOException, PdfKitException
[SampleCode] String inputFile = "example2.pdf"; String imageName = "butterfly.jpg"; String outputFile = "kitOut.pdf"; int[] pages = new int[] {1, 2, 3, 4, 5}; FileInputStream inPdfStream = new FileInputStream(inputFile); FileInputStream inImgStream = new FileInputStream(imageName); FileOutputStream outputStream = new FileOutputStream(outputFile); PdfFileMend mendor = new PdfFileMend(inPdfStream, outputStream); mendor.addImage(inImgStream, pages, 50, 50, 100, 100); mendor.close(); outputStream.close();
imageStream
- InputStream Input image stream.pageNums
- int[] Indicates which pages will the image be added to.lowerLeftX
- float The horizontal position of lower left point on the retangle area lined out for adding image.lowerLeftY
- float The vertical position of lower left point on the retangle area lined out for adding image.upperRightX
- float The horizontal position of upper right point on the retangle area lined out for adding image.upperRightY
- float The vertical position of upper right point on the retangle area lined out for adding image.
BadElementException
java.io.IOException
PdfKitException
public void close() throws java.io.IOException, PdfKitException
java.io.IOException
PdfKitException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |