Constructor and Description |
---|
PdfViewer()
Initializes new
PdfViewer object. |
PdfViewer(IDocument document)
Initializes new
PdfViewer object. |
Modifier and Type | Method and Description |
---|---|
void |
bindPdf(IDocument srcDoc)
Initializes the facade.
|
void |
bindPdf(com.aspose.ms.System.IO.Stream srcStream)
Initializes the facade.
|
void |
bindPdf(String srcFile)
Initializes the facade.
|
void |
close()
Closes the current Pdf file.
|
void |
closePdfFile()
Deprecated.
|
com.aspose.java.awt.image.BufferedImage[] |
decodeAllPages()
Get pages of current pdf file.
|
com.aspose.java.awt.image.BufferedImage |
decodePage(int pageNumber)
Decodes a page of one Pdf file.
|
com.aspose.java.awt.image.BufferedImage |
decodePageToImage(int pageNumber,
com.aspose.ms.System.Drawing.Imaging.ImageFormat imageFormat)
Decodes page to BufferedImage
|
void |
dispose()
Disposes the facade resources.
|
boolean |
getAutoResize()
Sets a bool value that indicates whether the file be printed with
optimized size.
|
boolean |
getAutoRotate()
Gets a bool value that indicates whether the file be printed with auto
rotation
|
int |
getAutoRotateMode()
Gets an AutoRotateMode value that indicates direction of rotation
|
int |
getCoordinateType()
Gets the page coordinate type (Media/Crop boxes).
|
int |
getCopiesPrinted()
Gets copies printed
|
com.aspose.ms.System.Drawing.Printing.PageSettings |
getDefaultPageSettings()
Gets the default page settings.
|
com.aspose.ms.System.Drawing.Printing.PrinterSettings |
getDefaultPrinterSettings()
Gets the default printer settings.
|
int |
getFormPresentationMode()
Gets form presentation mode.
|
int |
getHorizontalAlignment()
Gets a value that indicates horizontal alignment
|
int |
getPageCount()
Gets page count of the current Pdf file.
|
String |
getPassword()
Sets input document password.
|
boolean |
getPrintAsImage()
Gets a mode for PdfViewer to print as image.
|
String |
getPrinterJobName()
Gets name of document in printer queue when document is printed.
|
boolean |
getPrintPageDialog()
Gets a bool value that indicates whether produce the page number dialog
when printing.
|
Object |
getPrintStatus()
Gets the result of printing job.
|
RenderingOptions |
getRenderingOptions()
Gets rendering options.
|
int |
getResolution()
Gets or sets resolution during viewing and printing.
|
float |
getScaleFactor()
Gets and sets a floating point value that indicates scale factor.
|
boolean |
getShowHiddenAreas()
Deprecated.
|
int |
getVerticalAlignment()
Gets a value that indicates vertical alignment
|
void |
openPdfFile(InputStream inputStream)
Deprecated.
|
void |
openPdfFile(String filePath)
Deprecated.
|
void |
printDocument()
Prints the Pdf document using default printer.
|
void |
printDocumentWithSettings(com.aspose.ms.System.Drawing.Printing.PageSettings pageSettings,
com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Prints the Pdf document with settings.
|
void |
printDocumentWithSettings(com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Prints the Pdf document with printer settings.
|
void |
printLargePdf(InputStream inputStream)
Opens and prints a large Pdf stream.
|
void |
printLargePdf(InputStream inputStream,
com.aspose.ms.System.Drawing.Printing.PageSettings pageSettings,
com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf stream with specified page settings and
printer settings.
|
void |
printLargePdf(InputStream inputStream,
com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf stream with specified printer settings.
|
void |
printLargePdf(String filePath)
Opens and prints a large Pdf file.
|
void |
printLargePdf(String filePath,
com.aspose.ms.System.Drawing.Printing.PageSettings pageSettings,
com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf file with specified page settings and
printer settings.
|
void |
printLargePdf(String filePath,
com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf file with specified printer settings.
|
void |
save(InputStream destStream)
Saves the result PDF document to stream.
|
void |
save(String destFile)
Saves the result PDF document to file.
|
void |
setAutoResize(boolean value)
Sets a bool value that indicates whether the file be printed with
optimized size.
|
void |
setAutoRotate(boolean value)
Sets a bool value that indicates whether the file be printed with auto
rotation
|
void |
setAutoRotateMode(int value)
Sets an AutoRotateMode value that indicates direction of rotation
|
void |
setCoordinateType(int value)
Sets the page coordinate type (Media/Crop boxes).
|
void |
setFormPresentationMode(int value)
Sets form presentation mode.
|
void |
setHorizontalAlignment(int value)
Sets a value that indicates horizontal alignment
|
void |
setPassword(String value)
Sets input document password.
|
void |
setPrintAsImage(boolean value)
Sets a mode for PdfViewer to print as image.
|
void |
setPrinterJobName(String value)
Sets name of document in printer queue when document is printed.
|
void |
setPrintPageDialog(boolean value)
Sets a bool value that indicates whether produce the page number dialog
when printing.
|
void |
setRenderingOptions(RenderingOptions value)
Sets rendering options.
|
void |
setResolution(int value)
Sets resolution during viewing and printing.
|
void |
setScaleFactor(float value) |
void |
setShowHiddenAreas(boolean value)
Deprecated.
|
void |
setVerticalAlignment(int value)
Sets a value that indicates vertical alignment
|
public PdfViewer()
Initializes new PdfViewer
object.
public PdfViewer(IDocument document)
Initializes new PdfViewer
object.
document
- Document object.@Deprecated public boolean getShowHiddenAreas()
Gets or sets flag that controls visibility of hidden areas on the page.
@Deprecated public void setShowHiddenAreas(boolean value)
public Object getPrintStatus()
Gets the result of printing job. If success than null; otherwise, exception object.
public int getCopiesPrinted()
Gets copies printed
public int getCoordinateType()
Gets the page coordinate type (Media/Crop boxes). CropBox value is used by default.
public void setCoordinateType(int value)
Sets the page coordinate type (Media/Crop boxes). CropBox value is used by default.
public boolean getPrintAsImage()
Gets a mode for PdfViewer to print as image.
public void setPrintAsImage(boolean value)
Sets a mode for PdfViewer to print as image.
public int getPageCount()
Gets page count of the current Pdf file.
public String getPassword()
Sets input document password.
public void setPassword(String value)
Sets input document password.
public boolean getPrintPageDialog()
Gets a bool value that indicates whether produce the page number dialog when printing.
public void setPrintPageDialog(boolean value)
Sets a bool value that indicates whether produce the page number dialog when printing.
public String getPrinterJobName()
Gets name of document in printer queue when document is printed. Default value is file name.
public void setPrinterJobName(String value)
Sets name of document in printer queue when document is printed. Default value is file name.
public int getFormPresentationMode()
Gets form presentation mode.
public void setFormPresentationMode(int value)
Sets form presentation mode.
public RenderingOptions getRenderingOptions()
Gets rendering options.
public void setRenderingOptions(RenderingOptions value)
Sets rendering options.
public int getVerticalAlignment()
Gets a value that indicates vertical alignment
public void setVerticalAlignment(int value)
Sets a value that indicates vertical alignment
public int getHorizontalAlignment()
Gets a value that indicates horizontal alignment
public void setHorizontalAlignment(int value)
Sets a value that indicates horizontal alignment
public boolean getAutoResize()
Sets a bool value that indicates whether the file be printed with optimized size.
Value: If false print page without page scaling. If true print page with scaling to fit to printable area.public void setAutoResize(boolean value)
Sets a bool value that indicates whether the file be printed with optimized size.
Value: If false print page without page scaling. If true print page with scaling to fit to printable area.public boolean getAutoRotate()
Gets a bool value that indicates whether the file be printed with auto rotation
public void setAutoRotate(boolean value)
Sets a bool value that indicates whether the file be printed with auto rotation
public int getAutoRotateMode()
Gets an AutoRotateMode value that indicates direction of rotation
public void setAutoRotateMode(int value)
Sets an AutoRotateMode value that indicates direction of rotation
public int getResolution()
Gets or sets resolution during viewing and printing. The higher resolution, the slower speed. The default value is 150.
public void setResolution(int value)
Sets resolution during viewing and printing. The higher resolution, the slower speed. The default value is 150.
public void printLargePdf(String filePath)
Opens and prints a large Pdf file. If your Pdf file has hundreds of pages or more or its size is more than 3 MB, this method is recommended to get better performance.
PdfViewer viewer = new PdfViewer(); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false);// do not produce the page number dialog when // printing viewer.setPrintLargePdf("d:\test.pdf");
filePath
- The path of Pdf file.
public void printLargePdf(InputStream inputStream)
Opens and prints a large Pdf stream. If your Pdf file has hundreds of pages or more or its size is more than 3 MB, this method is recommended to get better performance.
PdfViewer viewer = new PdfViewer(); viewer.setAutoResize ( true); //print the file with adjusted size viewer.setAutoRotate ( true); //print the file with adjusted rotation viewer.printPageDialog=false;//do not produce the page number dialog when printing viewer.printLargePdf(new MemoryStream(File.ReadAllBytes(@"d:\test.pdf"))); viewer.closePdfFile();
inputStream
- The pdf stream to be opened and printed..
public void printLargePdf(String filePath, com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf file with specified printer settings. If your Pdf file has hundreds of pages or more or its size is more than 3 MB, this method is recommended to get better performance.
PdfViewer viewer = new PdfViewer(); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false);// do not produce the page number dialog when // printing PrinterSettings ps = new PrinterSettings(); PrintDocument prtdoc = new PrintDocument(); ps.setPrinterName(prtdoc.getPrinterSettings().getPrinterName()); viewer.printLargePdf("d:\\test.pdf", ps); viewer.closePdfFile();
filePath
- The path of Pdf file.printerSettings
- The printer settings.
public void printLargePdf(InputStream inputStream, com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf stream with specified printer settings. If your Pdf file has hundreds of pages or more or its size is more than 3 MB, this method is recommended to get better performance.
PdfViewer viewer = new PdfViewer(); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false); // do not produce the page number dialog when // printing PrinterSettings ps = new PrinterSettings(); PrintDocument prtdoc = new PrintDocument(); ps.setPrinterName(prtdoc.getPrinterSettings().getPrinterName()); viewer.printLargePdf(new FileInputStream("d:\\middleware.pdf"), ps); viewer.closePdfFile();
inputStream
- The pdf stream to be opened and printed..printerSettings
- The printer settings.
public void printLargePdf(String filePath, com.aspose.ms.System.Drawing.Printing.PageSettings pageSettings, com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf file with specified page settings and printer settings. If your Pdf file has hundreds of pages or more or its size is more than 3 MB, this method is recommended to get better performance.
PdfViewer viewer = new PdfViewer(); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false); // do not produce the page number dialog when // printing PrinterSettings ps = new PrinterSettings(); PrintDocument prtdoc = new PrintDocument(); ps.setPrinterName(prtdoc.getPrinterSettings().getPrinterName()); PageSettings pgs = new PageSettings(); pgs.setPaperSize(new PaperSize("A4", 827, 1169)); pgs.setMargins(new Margins(0, 0, 0, 0)); viewer.printLargePdf("d:\\test.pdf", pgs, ps); viewer.closePdfFile();
filePath
- The path of Pdf file.pageSettings
- The page settings.printerSettings
- The printer settings.
public void printLargePdf(InputStream inputStream, com.aspose.ms.System.Drawing.Printing.PageSettings pageSettings, com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Opens and prints a large Pdf stream with specified page settings and printer settings. If your Pdf file has hundreds of pages or more or its size is more than 3 MB, this method is recommended to get better performance.
PdfViewer viewer = new PdfViewer(); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false);// do not produce the page number dialog when // printing PrinterSettings ps = new PrinterSettings(); PrintDocument prtdoc = new PrintDocument(); ps.setPrinterName(prtdoc.getPrinterSettings().getPrinterName()); PageSettings pgs = new PageSettings(); pgs.setPaperSize(new PaperSize("A4", 827, 1169)); pgs.setMargins(new Margins(0, 0, 0, 0)); viewer.printLargePdf(new FileInputStream("d:\\middleware.pdf"), pgs, ps); viewer.closePdfFile();
inputStream
- The pdf stream to be opened and printed.pageSettings
- The page settings.printerSettings
- The printer settings.
public com.aspose.java.awt.image.BufferedImage[] decodeAllPages()
Get pages of current pdf file.
public com.aspose.java.awt.image.BufferedImage decodePage(int pageNumber)
Decodes a page of one Pdf file.
pageNumber
- The page number of one Pdf file which must be between 1 and
PageCount.public void printDocumentWithSettings(com.aspose.ms.System.Drawing.Printing.PageSettings pageSettings, com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Prints the Pdf document with settings. If the document size is not complatible to page size, pdf.kit will extend it to fit page size.
pageSettings
- The page setting of the printing document.printerSettings
- The printer setting of the printing document.
public void printDocumentWithSettings(com.aspose.ms.System.Drawing.Printing.PrinterSettings printerSettings)
Prints the Pdf document with printer settings. The output page size will fit the the document first page size.
PdfViewer viewer = new PdfViewer(); viewer.openPdfFile("d:\\test.pdf"); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false); // do not produce the page number dialog when // printing PrinterSettings ps = new PrinterSettings(); PrintDocument prtdoc = new PrintDocument(); ps.setPrinterName(prtdoc.getPrinterSettings().PrinterName()); viewer.printDocumentWithSettings(ps); viewer.closePdfFile();
printerSettings
- The printer setting of the printing document.public void printDocument()
Prints the Pdf document using default printer.
PdfViewer viewer = new PdfViewer(); viewer.openPdfFile("d:\\test.pdf"); viewer.setAutoResize(true); // print the file with adjusted size viewer.setAutoRotate(true); // print the file with adjusted rotation viewer.setPrintPageDialog(false); // do not produce the page number dialog when // printing viewer.printDocument(ps); viewer.closePdfFile();
public com.aspose.ms.System.Drawing.Printing.PageSettings getDefaultPageSettings()
Gets the default page settings.
public com.aspose.ms.System.Drawing.Printing.PrinterSettings getDefaultPrinterSettings()
Gets the default printer settings.
@Deprecated public void openPdfFile(String filePath)
Opens a Pdf file, but does not actually decode the pages of the Pdf file.
PdfViewer viewer = new PdfViewer(); viewer.openPdfFile("d:\\test.pdf"); viewer.closePdfFile();
filePath
- The path of Pdf file.@Deprecated public void openPdfFile(InputStream inputStream)
Opens a Pdf file stream. But does not actually decode the pages of the Pdf file.
PdfViewer viewer = new PdfViewer(); viewer.openPdfFile(new FileInputStream("d:\\test.pdf"))); viewer.closePdfFile();
inputStream
- The pdf stream to be opened.@Deprecated public void closePdfFile()
Closes the current Pdf file.
public com.aspose.java.awt.image.BufferedImage decodePageToImage(int pageNumber, com.aspose.ms.System.Drawing.Imaging.ImageFormat imageFormat)
Decodes page to BufferedImage
pageNumber
- imageFormat
- public float getScaleFactor()
Gets and sets a floating point value that indicates scale factor. The default value is 1.0.
public void setScaleFactor(float value)
public void bindPdf(String srcFile)
Initializes the facade.
public void bindPdf(com.aspose.ms.System.IO.Stream srcStream)
Initializes the facade.
public void bindPdf(IDocument srcDoc)
Initializes the facade.
public void save(String destFile)
Saves the result PDF document to file.
destFile
- The path of output PDF document.public void save(InputStream destStream)
Saves the result PDF document to stream.
destStream
- The stream of output PDF document.public void dispose()
Disposes the facade resources.
Copyright © 2017 Aspose. All Rights Reserved.