|
||
| 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.PdfConverter
Represents a class to transform each page to image file from pdf file, support BMP, JPEG, PNG and TIFF now.
| Constructor Summary | |
PdfConverter()
The constructor of the PdfConverter object. |
|
| Method Summary | |
void |
bindPdf(java.io.InputStream inputStream)
Binds a Pdf Stream for converting. |
void |
bindPdf(java.lang.String inputFile)
Binds a Pdf file for converting. |
void |
doConvert()
Begins to transform a Pdf document to image files. |
int |
getEndPage()
Gets endPage value. |
void |
getNextImage(java.io.OutputStream outputStream)
Saves next page's image to stream with default image type - Jpeg. |
void |
getNextImage(java.io.OutputStream outputStream,
ImageType imageType)
Saves next page's image to stream with the given image type. |
void |
getNextImage(java.lang.String outputFile)
Saves next page's image to file with default image type - Jpeg. |
void |
getNextImage(java.lang.String outputFile,
ImageType imageType)
Saves next page's image to file with the given image type. |
java.lang.String |
getPassword()
Gets password. |
int |
getStartPage()
Gets startPage value. |
boolean |
hasNextImage()
Judges if it can get more images or not. |
void |
savaAsTIFF(java.io.OutputStream outputStream)
save each page's image to a single TIFF stream. |
void |
savaAsTIFF(java.lang.String outputFile)
save each page's image to a single TIFF file. |
void |
setEndPage(int endPage)
Sets endPage value. |
void |
setPassword(java.lang.String password)
Sets password, use this password to decrypt the pdf file. |
void |
setStartPage(int startPage)
Sets startPage value. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PdfConverter()
| Method Detail |
public void setStartPage(int startPage)
startPage - start position which you want to convert of the pdf file.public int getStartPage()
public void setEndPage(int endPage)
endPage - end position which you want to convert of the pdf file.public int getEndPage()
public void setPassword(java.lang.String password)
password - the input pdf file's passwordpublic java.lang.String getPassword()
public void bindPdf(java.lang.String inputFile)
throws java.io.FileNotFoundException
inputFile - The pdf file to be convertted.
java.io.FileNotFoundExceptionpublic void bindPdf(java.io.InputStream inputStream)
inputStream - The pdf Stream to be convertted.
java.io.FileNotFoundException
public void doConvert()
throws java.lang.Exception
[SampleCode]
//convert each page to images with the default image format(JPEG)
String path = "./examples/resources/";
PdfConverter converter = new PdfConverter();
converter.bindPdf(path + "text.pdf");
converter.doConvert();
String suffix = ".jpg";
int imageCount = 1;
while (converter.hasNextImage()) {
converter.getNextImage(path + imageCount + suffix);
imageCount++;
}
java.lang.Exception
public void getNextImage(java.lang.String outputFile)
throws java.lang.Exception
outputFile - The file path and name to save the image.
java.lang.Exception
public void getNextImage(java.io.OutputStream outputStream)
throws java.lang.Exception
outputStream - The stream to save the image.
java.lang.Exception
public void getNextImage(java.lang.String outputFile,
ImageType imageType)
throws java.lang.Exception
outputFile - The file path and name to save the image.imageType - The given image type.
java.lang.Exception
public void getNextImage(java.io.OutputStream outputStream,
ImageType imageType)
throws java.lang.Exception
[SampleCode]
//convert each page to images with the givin image format(PNG)
String path = "./examples/resources/";
PdfConverter converter = new PdfConverter();
converter.bindPdf(path + "text.pdf");
converter.doConvert();
String suffix = ".png";
int imageCount = 1;
while (converter.hasNextImage()) {
converter.getNextImage(path + imageCount + suffix, ImageType.PNG);
imageCount++;
}
outputStream - The stream to save the image.imageType - The given image type.
java.lang.Exceptionpublic boolean hasNextImage()
public void savaAsTIFF(java.lang.String outputFile)
throws java.lang.Exception
[SampleCode]
//convert a pdf file to a single TIFF file
String path = "./examples/resources/";
try {
PdfConverter converter = new PdfConverter();
converter.bindPdf(path + "text.pdf");
converter.doConvert();
converter.savaAsTIFF(path + "text.tif");
}
catch (java.io.IOException ioe) {
System.out.println(ioe.getMessage() + ioe.getStackTrace());
}
outputFile - The file path and name to save the image.
java.lang.Exception
public void savaAsTIFF(java.io.OutputStream outputStream)
throws java.lang.Exception
outputStream - The stream to save the tiff image.
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||