Package org.faceless.pdf2
Class OutputProfiler.RasterizingAction
- java.lang.Object
-
- org.faceless.pdf2.OutputProfiler.RasterizingAction
-
- Enclosing class:
- OutputProfiler
public static class OutputProfiler.RasterizingAction extends Object
An action that will rasterize a page to a bitmap if required.- Since:
- 2.26
- See Also:
OutputProfiler.setRasterizingAction(org.faceless.pdf2.OutputProfiler.RasterizingAction)
-
-
Constructor Summary
Constructors Constructor Description RasterizingAction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ColorModel
getColorModel()
Return the ColorModel, as set bysetColorModel(java.awt.image.ColorModel)
float
getDPI()
Get the preferred resolution for any images generated by this class, as set bysetDPI(float)
.long
getMaxPixels()
Return the maximum number of pixels for images generated by this class, as set bysetMaxPixels(long)
.void
rasterize(OutputProfiler profiler, PDFPage page, OutputProfile pageProfile, ProfileComplianceException ei)
Rasterize the page, converting its content to a bitmapvoid
setColorModel(ColorModel colorModel)
Set the ColorModel for rasterizing.void
setCompressionOptions(String options)
Set the options to be used for image compression.void
setDPI(float dpi)
Set the preferred resolution for any images generated by this class.void
setMaxPixels(long max)
Set the maximum number of pixels for any image generated by this class.
-
-
-
Method Detail
-
getDPI
public float getDPI()
Get the preferred resolution for any images generated by this class, as set bysetDPI(float)
. The default is 200- Returns:
- the dpi
-
setDPI
public void setDPI(float dpi)
Set the preferred resolution for any images generated by this class.- Parameters:
dpi
- the dots per inch. Any value greater than one, typically between 150-300.
-
setMaxPixels
public void setMaxPixels(long max)
Set the maximum number of pixels for any image generated by this class. If the number of pixels at the chosen DPI would be greater than this value, the resolution will be reduced. This is safety check to ensure rendering pages with a very large physical size (eg A0) does not cause out-of-memory.- Parameters:
max
- the maximum number of pixels. Usually a very large number, we'll accept anything above 16384
-
setCompressionOptions
public void setCompressionOptions(String options)
Set the options to be used for image compression. This is intentionally vague, but at this point the valid parameters are the same that can be passed into thePDFImage(Image,String)
constructor.- Since:
- 2.26.2
-
getMaxPixels
public long getMaxPixels()
Return the maximum number of pixels for images generated by this class, as set bysetMaxPixels(long)
. The default is 9287256, which is the equivalent of an A4 page rendered at 310dpi.- Returns:
- the maximum number of pixels
-
getColorModel
public ColorModel getColorModel()
Return the ColorModel, as set bysetColorModel(java.awt.image.ColorModel)
- Returns:
- the ColorModel
-
setColorModel
public void setColorModel(ColorModel colorModel)
Set the ColorModel for rasterizing. The default isColorModel.getRGBdefault()
and this is usually the best option. If the page to be rasterized contains no color content, it will be automatically converted to an 8-bit grayscale model if the model passed into this method is not already grayscale.- Parameters:
colorModel
- the color modell
-
rasterize
public void rasterize(OutputProfiler profiler, PDFPage page, OutputProfile pageProfile, ProfileComplianceException ei)
Rasterize the page, converting its content to a bitmap- Parameters:
profiler
- the profiler that is running this operationpage
- the pagepageProfile
- the profile which should be populated by any features on the resulting pageei
- the exception that triggered the need to rasterize. May be null.
-
-