Package com.openhtmltopdf.java2d.api
Class Java2DRendererBuilder
java.lang.Object
com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder<Java2DRendererBuilder,Java2DRendererBuilderState>
com.openhtmltopdf.java2d.api.Java2DRendererBuilder
public class Java2DRendererBuilder
extends BaseRendererBuilder<Java2DRendererBuilder,Java2DRendererBuilderState>
Build a Java2D renderer for a given HTML. The renderer allows to get a
BufferedImage of the HTML and to render it in components (using Graphics2D).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
This class is internal to this library, please do not use or override it!Nested classes/interfaces inherited from class com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder
BaseRendererBuilder.BaseRendererBuilderState, BaseRendererBuilder.FontStyle, BaseRendererBuilder.FSFontUseCase, BaseRendererBuilder.PageSizeUnits, BaseRendererBuilder.TextDirection
-
Field Summary
Fields inherited from class com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder
PAGE_SIZE_LETTER_HEIGHT, PAGE_SIZE_LETTER_UNITS, PAGE_SIZE_LETTER_WIDTH, state
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildJava2DRenderer
(Closeable diagnosticConsumer) void
useLayoutGraphics
andtoPageProcessor
MUST have been called.void
runPaged()
useLayoutGraphics
andtoPageProcessor
MUST have been called.toPageProcessor
(FSPageProcessor pageProcessor) Output the document in paged format.toSinglePage
(FSPageProcessor pageProcessor) Render everything to a single page.useEnvironmentFonts
(boolean useEnvironmentFonts) Whether to use fonts available in the environment.Compulsory method.Methods inherited from class com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder
addDOMMutator, applyDiagnosticConsumer, defaultTextDirection, testMode, useDefaultPageSize, useDocumentBuilderFactoryImplementationClass, useExternalResourceAccessControl, useFastMode, useFont, useFont, useFont, useFont, useFont, useFont, useHttpStreamImplementation, useInitialPageNumber, useMathMLDrawer, useObjectDrawerFactory, useProtocolsStreamImplementation, useProtocolsStreamImplementation, useReplacementText, useSVGDrawer, useTransformerFactoryImplementationClass, useUnicodeBidiReorderer, useUnicodeBidiSplitter, useUnicodeCharacterBreaker, useUnicodeLineBreaker, useUnicodeToLowerTransformer, useUnicodeToTitleTransformer, useUnicodeToUpperTransformer, useUriResolver, withDiagnosticConsumer, withFile, withHtmlContent, withUri, withW3cDocument
-
Constructor Details
-
Java2DRendererBuilder
public Java2DRendererBuilder()
-
-
Method Details
-
useLayoutGraphics
Compulsory method. The layout graphics are used to measure text and should be from an image or device with the same characteristics as the output graphicsw provided by the page processor.- Parameters:
g2d
-- Returns:
- this for method chaining
-
useEnvironmentFonts
Whether to use fonts available in the environment. Enabling environment fonts may mean different text rendering behavior across different environments. The default is not to use environment fonts. -
toSinglePage
Render everything to a single page. I.e. only one big page is genereated, no pagebreak will be done. The page is only as height as needed. -
toPageProcessor
Output the document in paged format. The user can use the DefaultPageProcessor or use its source as a reference to code their own page processor for advanced usage.- Parameters:
pageProcessor
-- Returns:
- this for method chaining
-
runPaged
useLayoutGraphics
andtoPageProcessor
MUST have been called. Also a document MUST have been set with one of the with* methods. This will build the renderer and output each page of the document to the specified page processor.- Throws:
Exception
IOException
-
runFirstPage
useLayoutGraphics
andtoPageProcessor
MUST have been called. Also a document MUST have been set with one of the with* methods. This will build the renderer and output the first page of the document to the specified page processor.- Throws:
Exception
IOException
-
buildJava2DRenderer
-
buildJava2DRenderer
-