![]() |
||
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.PdfContentEditor
Represents a class to edit the pdf file's content.
Constructor Summary | |
PdfContentEditor()
The constructor of the PdfContentEditor object. |
Method Summary | |
void |
bindPdf(java.io.InputStream inputStream)
Binds a Pdf Stream for editing. |
void |
bindPdf(java.lang.String inputFile)
Binds a Pdf file for editing |
void |
createApplicationLink(java.awt.Rectangle rect,
java.lang.String application,
int originalPage)
Creates a application link in the same pdf. |
void |
createBookmarkOfPage(java.lang.String[] bookmarkName,
int[] pageNumber)
Creates bookmarks for multipages using the corresponding bookmark names. |
void |
createBookmarkOfPage(java.lang.String bkname,
int pagenumber)
Creates bookmark for the page you want. |
void |
createBookmarks()
Creates bookmark for all of pages. |
void |
createFileAttachment(java.awt.Rectangle rect,
java.lang.String contents,
java.lang.String filePath,
int page,
java.lang.String name)
Creates a file attachment annotation. |
void |
createFreeText(java.awt.Rectangle rect,
java.lang.String contents,
int page)
Creates FreeText Annotations. |
void |
createLine(java.awt.Rectangle rect,
java.lang.String contents,
float x1,
float y1,
float x2,
float y2,
int page,
int border,
java.lang.String borderStyle,
int[] dashArray,
java.lang.String[] LEArray,
java.awt.Color clr)
Creates Line Annotations. |
void |
createLocalLink(java.lang.String outputFile,
java.awt.Rectangle rect,
int desPage,
int page)
Creates a local link in the pdf by add annotation. |
void |
createMarkup(java.awt.Rectangle rect,
java.lang.String contents,
int type,
float[] quadPoints,
int page,
java.awt.Color clr)
Creates Markup Annotations. |
void |
createPdfDocumentLink(java.awt.Rectangle rect,
java.lang.String document,
int originalPage,
int pageOfOpenDocument)
Creates a pdf document link in the same pdf file. |
void |
createPopup(java.awt.Rectangle rect,
java.lang.String contents,
boolean open,
int page)
Creates Popup Annotations. |
void |
createText(java.awt.Rectangle rect,
java.lang.String title,
java.lang.String contents,
boolean open,
java.lang.String icon,
int page)
Creates Text Annotations. |
void |
createWebLink(java.awt.Rectangle rect,
java.lang.String url,
int page)
Creates a web link in the pdf by add annotation. |
void |
replaceText(java.lang.String srcString,
java.lang.String descString)
Replaces srcString in the PDF file with descString. |
void |
save(java.io.OutputStream outputStream)
Saves the result PDF to stream. |
void |
save(java.lang.String outputFile)
Saves the result PDF to file. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PdfContentEditor()
Method Detail |
public void bindPdf(java.lang.String inputFile) throws java.io.FileNotFoundException
inputFile
- The pdf file to be edited.
java.io.FileNotFoundException
bindPdf(InputStream)
public void bindPdf(java.io.InputStream inputStream)
inputStream
- The pdf Stream to be edited.
java.io.FileNotFoundException
replaceText(String, String)
public void save(java.lang.String outputFile) throws java.lang.Exception
outputFile
- output pdf file
java.lang.Exception
save(OutputStream)
public void save(java.io.OutputStream outputStream) throws java.io.IOException, PdfKitException
outputStream
- output pdf stream
java.io.IOException
PdfKitException
replaceText(String, String)
public void replaceText(java.lang.String srcString, java.lang.String descString) throws java.io.IOException, com.aspose.pdf.kit.COSVisitorException
[SampleCode] //Replace the string "Pdf" with "WordPpt" in the give pdf file PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("text.pdf"); editor.replaceText("Pdf", "WordPpt"); editor.save("replace.pdf");
srcString
- the string to be replaceddescString
- the replaced string
java.io.IOException
COSVisitorException
public void createBookmarks() throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.CreateBookmarks();
java.lang.Exception
- if input file not exist,throw exceptionpublic void createBookmarkOfPage(java.lang.String bkname, int pagenumber) throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.createBookmarkOfPage("bkname",pagenumber);
bkname
- bookmark's name you want to definepagenumber
- the desination page
java.lang.Exception
- if input file not exist,throw exceptionpublic void createWebLink(java.awt.Rectangle rect, java.lang.String url, int page) throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); Rectangle rect=new Rectangle(130,130,150,150); try{ editor.createWebLink(rect,"http://www.aspose.com",2); } catch(Exception e){ e.printStackTrace(); }
rect
- Rectangle the Rectangle for active clickurl
- String the web destinationpage
- int create rectangle in the page
java.io.IOException
java.lang.Exception
public void createLocalLink(java.lang.String outputFile, java.awt.Rectangle rect, int desPage, int page) throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); Rectangle rect=new Rectangle(130,130,150,150); String outputFile="test.pdf" try{ editor.createLocalLink(outputFile,rect,1,2); } catch(Exception e){ e.printStackTrace(); }
outputFile
- String the edited filerect
- Rectangle the Rectangle for active clickdesPage
- the destination pagepage
- int create rectangle in the page
java.io.IOException
java.lang.Exception
public void createBookmarkOfPage(java.lang.String[] bookmarkName, int[] pageNumber) throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("test.pdf"); String []bookmarkName={"test1","test2","test3"}; int []pageNumber={3,2,1}; editor.createBookmarkOfPage(bookmarkName,pageNumber); editor.save("test_output.pdf");
bookmarkName
- The specified bookmark name arraypageNumber
- The specified desination page array
java.lang.Exception
public void createPdfDocumentLink(java.awt.Rectangle rect, java.lang.String document, int originalPage, int pageOfOpenDocument) throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(130,130,150,150); String document="example1_document.pdf"; editor.createPdfDocumentLink(rect,document,1,2); editor.save("example1_pageofdocument.pdf");
rect
- Rectangle The Rectangle for active clickdocument
- String The Document for openoriginalPage
- int The page in which the url link is createdpageOfOpenDocument
- int The page of document to be opened
java.lang.Exception
public void createApplicationLink(java.awt.Rectangle rect, java.lang.String application, int originalPage) throws java.lang.Exception
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(130,130,150,150); String document="example1_document.pdf"; editor.createApplicationLink(rect,document,1,2); editor.save("example1_pageofdocument.pdf");
rect
- Rectangle The Rectangle for active clickapplication
- String The application to be launchedoriginalPage
- int The page in which the url link is created
java.lang.Exception
public void createText(java.awt.Rectangle rect, java.lang.String title, java.lang.String contents, boolean open, java.lang.String icon, int page) throws java.io.IOException, PdfKitException
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(50,50,200,200); String document="example1_document.pdf"; editor.createText(rect,"welcome to aspose!","you are welcome!",true,"Key",1); editor.save("example1_application.pdf");
rect
- The annotation rectangle defining the location of the annotation on the pagetitle
- The title of the annotationcontents
- The contents of the annotationopen
- A flag specifying whether the annotation should initially be displayed openicon
- The name of an icon to be used in displaying the annotation,it's value include:Comment,Key,Note,Help,NewParagraph,Paragraph,Insertpage
- The page in which the text annotation is created
java.io.IOException
PdfKitException
public void createFreeText(java.awt.Rectangle rect, java.lang.String contents, int page) throws java.io.IOException, PdfKitException
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(50,50,200,200); String document="example1_document.pdf"; editor.createFreeText(rect,"you are welcome!",1); editor.save("example1_application.pdf");
rect
- The annotation rectangle defining the location of the annotation on the pagecontents
- The contents of the annotationpage
- The page in which the text annotation is created
java.io.IOException
PdfKitException
public void createLine(java.awt.Rectangle rect, java.lang.String contents, float x1, float y1, float x2, float y2, int page, int border, java.lang.String borderStyle, int[] dashArray, java.lang.String[] LEArray, java.awt.Color clr) throws java.io.IOException, PdfKitException
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(50,50,200,200); Color c=new Color(255,125,125); int []dashArray={}; String []LEArray={}; editor.createLine(rect,"",100,100,400,100,1,5,"s",dashArray,LEArray,c); editor.save("example1_Line.pdf");
rect
- The annotation rectangle defining the location of the annotation on the pagecontents
- The contents of the annotationx1
- The starting horizontal coordinates of the liney1
- The starting vertical coordinates of the linex2
- The ending horizontal coordinates of the liney2
- The ending verticalcoordinates of the linepage
- The page in which the text annotation is createdborder
- The border width in points. If this value is 0, no border is drawn. Default value: 1borderStyle
- The border style specifying the width and dash pattern to be used in drawing the line, it's value includes:S,D,B,I,UdashArray
- A dash array defining a pattern of dashes and gaps to be used in drawing a dashed borderLEArray
- An array of two names specifying the line ending styles to be used in drawing the line,it's value includes:Square,Circle,Diamond,OpenArrow,ClosedArrow,etcclr
- The color of line
java.io.IOException
PdfKitException
public void createMarkup(java.awt.Rectangle rect, java.lang.String contents, int type, float[] quadPoints, int page, java.awt.Color clr) throws java.io.IOException, PdfKitException
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(50,50,200,200); String document="example1_document.pdf"; float [] quadPoints={100,115,150,115,150,105,100,105}; Color clr=new Color(255,0,255); editor.createMarkup(rect,"welcome to aspose",3,quadPoints,1,clr); editor.save("example1_application.pdf");
rect
- The annotation rectangle defining the location of the annotation on the pagecontents
- The contents of the annotationtype
- The type of annotation that this dictionary describes; must be Highlight(0), Underline(1), Squiggly(2), or StrikeOut(3)quadPoints
- An array of 8 กม n numbers specifying the coordinates of n quadrilaterals in default user spacepage
- The page in which the text annotation is createdclr
- The color of markup
java.io.IOException
PdfKitException
public void createPopup(java.awt.Rectangle rect, java.lang.String contents, boolean open, int page) throws java.io.IOException, PdfKitException
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(50,50,200,200); String document="example1_document.pdf"; editor.createPopup(rect,"welcome to aspose!",true,1); editor.save("example1_application.pdf");
rect
- The annotation rectangle defining the location of the annotation on the pagecontents
- The contents of the annotationopen
- A flag specifying whether the pop-up annotation should initially be displayed openpage
- The page in which the text annotation is created
java.io.IOException
PdfKitException
public void createFileAttachment(java.awt.Rectangle rect, java.lang.String contents, java.lang.String filePath, int page, java.lang.String name) throws java.io.IOException, PdfKitException
[SampleCode] PdfContentEditor editor = new PdfContentEditor(); editor.bindPdf("example1.pdf"); Rectangle rect=new Rectangle(130,130,150,150); String document="example1_document.pdf"; editor.createFileAttachment(rect,"file attachment",document,1,"Tag"); editor.save("example1_attachment.pdf");
rect
- Rectangle The Rectangle for active clickcontents
- String Text to be displayed for the annotationfilePath
- String The path to the filepage
- int The page in which annotation is createdname
- String The name of an icon to be used in displaying the annotation
java.io.IOException
PdfKitException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |