Top Description Inners Fields Constructors Methods
com.openhtmltopdf.outputdevice.helper

public abstract Class BaseRendererBuilder<TFinalClass extends BaseRendererBuilder, TBaseRendererBuilderState extends BaseRendererBuilder.BaseRendererBuilderState>

extends Object
Class Inheritance
Annotations
@SuppressWarnings:unchecked, rawtypes
Imports
com.openhtmltopdf.bidi.BidiReorderer, .BidiSplitterFactory, com.openhtmltopdf.extend.*, com.openhtmltopdf.layout.Layer, com.openhtmltopdf.swing.NaiveUserAgent, com.openhtmltopdf.util.Diagnostic, .ThreadCtx, org.w3c.dom.Document, java.io.Closeable, .File, .InputStream, java.util.ArrayList, .EnumSet, .HashMap, .List, .Map, .Set, java.util.function.BiPredicate, .Consumer

Baseclass for all RendererBuilders (PDF and Java2D), has all common settings

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
BaseRendererBuilder.BaseRendererBuilderState

This class is an internal implementation detail.

public static enum
public static enum
public static enum
public static enum

Field Summary

Modifier and TypeField and Description
public static final float
public static final BaseRendererBuilder.PageSizeUnits
public static final float
protected final TBaseRendererBuilderState

Constructor Summary

AccessConstructor and Description
protected
BaseRendererBuilder(TBaseRendererBuilderState state)

Method Summary

Modifier and TypeMethod and Description
public TFinalClass

Returns:

this for method chaining
addDOMMutator
(FSDOMMutator
the DOM Mutator
domMutator
)

Add a DOM mutator to this builder.

protected Closeable
public final TFinalClass

Returns:

this for method chaining
defaultTextDirection
(BaseRendererBuilder.TextDirection textDirection)

The default text direction of the document.

public final TFinalClass

Returns:

this for method chaining
testMode
(boolean mode)

Whether to use test mode and output the PDF uncompressed.

public final TFinalClass

Returns:

this for method chaining
useDefaultPageSize
(float
the new default width
pageWidth
,
float
the new default height
pageHeight
,
BaseRendererBuilder.PageSizeUnits
either mm or inches.
units
)

Specifies the default page size to use if none is specified in CSS.

public final TFinalClass

Returns:

this for method chaining
useDocumentBuilderFactoryImplementationClass
(String documentBuilderFactoryClass)

This method should be considered advanced and is not required for most setups.

public TFinalClass
useExternalResourceAccessControl(BiPredicate<String, ExternalResourceType> allowExternalResource, ExternalResourceControlPriority priority)

Allows to set one external access controller to run before the uri resolver and one to run after the uri resolver.

public final TFinalClass

Returns:

this for method chaining
useFastMode
()

Use the new (May 2018) fast renderer.

public TFinalClass
useFont(File fontFile, String fontFamily, Integer fontWeight, BaseRendererBuilder.FontStyle fontStyle, boolean subset)

Allows the user to provide a font file for use by the main document only (not SVGs).

public TFinalClass

Returns:

this for method chaining
useFont
(File
A file system font file in true-type format. Beware of using resources as they will not be separate files in the final jar.
fontFile
,
String
Font family name. If using a font in Java2D, SVG or MathML this should match Font.createFont(Font.TRUETYPE_FONT, fontFile).getFamily().
fontFamily
,
Integer
Font boldness, usually 400 for regular fonts and 700 for bold fonts.
fontWeight
,
BaseRendererBuilder.FontStyle
Normal, italic or oblique.
fontStyle
,
boolean
For PDF use whether the font is subset, usually true unless the font is being used by form controls.
subset
,
Set<BaseRendererBuilder.FSFontUseCase>
Which components use the font such as main document, SVG, etc. Example: EnumSet.of(FSFontUseCase.DOCUMENT, FSFontUseCase.SVG)
fontUsedFor
)

Allows the user to provide a font file for use any or all of the use cases listed in FSFontUseCase such as main document, SVGs, etc.

For gotchas related to font handling please see: Wiki: Fonts

public TFinalClass

Returns:

this for method chaining
useFont
(File fontFile, String fontFamily)

Simpler overload for useFont(File, String, Integer, FontStyle, boolean)

public TFinalClass

Returns:

this for method chaining
useFont
(FSSupplier<InputStream> supplier, String fontFamily, Integer fontWeight, BaseRendererBuilder.FontStyle fontStyle, boolean subset)

Add a font programmatically.

public TFinalClass

Returns:

this for method chaining
useFont
(FSSupplier<InputStream> supplier, String fontFamily, Integer fontWeight, BaseRendererBuilder.FontStyle fontStyle, boolean subset, Set<BaseRendererBuilder.FSFontUseCase> useFontFlags)

Add a font programmatically.

public TFinalClass

Returns:

this for method chaining
useFont
(FSSupplier<InputStream> supplier, String fontFamily)

Simpler overload for useFont(FSSupplier, String, Integer, FontStyle, boolean)

public final TFinalClass

Returns:

this for method chaining
useHttpStreamImplementation
(FSStreamFactory
the factory to use for HTTP/HTTPS
factory
)

Provides an HttpStreamFactory implementation if the user desires to use an external HTTP/HTTPS implementation.

public TFinalClass

Returns:

this for method chaining.
useInitialPageNumber
(int initialPageNumber)

Allows the setting of the initial page number to use with the page and pages CSS counters.

public final TFinalClass

Returns:

this for method chaining
useMathMLDrawer
(SVGDrawer
the MathML implementation
mathMlImpl
)

Use the specified MathML implementation.

public final TFinalClass

Returns:

this for method chaining
useObjectDrawerFactory
(FSObjectDrawerFactory
Object Drawer Factory
objectDrawerFactory
)

Set a factory for <object> drawers

public final TFinalClass

Returns:

this for method chaining
useProtocolsStreamImplementation
(FSStreamFactory
the stream factory to use
factory
,
Set<String>
the list of protocols the factory should be used for
protocols
)

Provides an com.openhtmltopdf.extend.FSStreamFactory implementation if the user desires to use an external stream provider for a particular set of protocols.

public final TFinalClass

Returns:

this for method chaining
useProtocolsStreamImplementation
(FSStreamFactory
the stream factory to use
factory
,
String...
the list of protocols the stream factory should be used for
protocols
)

Provides an com.openhtmltopdf.extend.FSStreamFactory implementation if the user desires to use an external stream provider for a particular list of protocols.

public final TFinalClass

Returns:

this for method chaining
useReplacementText
(String
the default replacement text
replacement
)

The replacement text to use if a character is cannot be renderered by any of the specified fonts.

public final TFinalClass

Returns:

this for method chaining
useSVGDrawer
(SVGDrawer
the SVG implementation
svgImpl
)

Uses the specified SVG drawer implementation.

public final TFinalClass

Returns:

this for method chaining
useTransformerFactoryImplementationClass
(String transformerFactoryClass)

This method should be considered advanced and is not required for most setups.

public final TFinalClass

Returns:

this for method chaining
useUnicodeBidiReorderer
(BidiReorderer
the unicode bidi reorderer to use.
reorderer
)

Provides a reorderer to properly reverse RTL text.

public final TFinalClass

Returns:

this for method chaining
useUnicodeBidiSplitter
(BidiSplitterFactory
the unicode bidi splitter to use.
splitter
)

Provides a text splitter to split text into directional runs.

public final TFinalClass

Returns:

this for method chaining
useUnicodeCharacterBreaker
(FSTextBreaker
the character breaker to use
breaker
)

Specify the character breaker.

public final TFinalClass

Returns:

this for method chaining
useUnicodeLineBreaker
(FSTextBreaker
the text breaker to use
breaker
)

Specify the line breaker.

public final TFinalClass

Returns:

this for method chaining
useUnicodeToLowerTransformer
(FSTextTransformer
the text transformer to use.
tr
)

Specify a transformer to use to lower case strings.

public final TFinalClass

Returns:

this for method chaining
useUnicodeToTitleTransformer
(FSTextTransformer
the text transformer to use
tr
)

Specify a transformer to title case strings.

public final TFinalClass

Returns:

this for method chaining
useUnicodeToUpperTransformer
(FSTextTransformer
the text transformer to use
tr
)

Specify a transformer to use to upper case strings.

public final TFinalClass

Returns:

this for method chaining
useUriResolver
(FSUriResolver
the URI resolver used to resolve any kind of private URIs/protocolls
resolver
)

Provides a uri resolver to resolve relative uris or private uri schemes.

public TFinalClass
public final TFinalClass

Returns:

this for method chaining
withFile
(File
the file with the HTML source to convert
file
)

Provides a file to convert to PDF.

public final TFinalClass

Returns:

this for method chaining
withHtmlContent
(String
the HTML text to use.
html
,
String
the base document URI to resolve future relative resources (e.g. images)
baseDocumentUri
)

Provides a string containing XHTML/XML to convert to PDF.

public final TFinalClass

Returns:

this for method chaining
withUri
(String
the URI of the HTML source to convert.
uri
)

Provides a URI to convert to PDF.

public final TFinalClass

Returns:

this for method chaining
withW3cDocument
(Document
the DOM of the HTML document
doc
,
String
the base URI, it will be used to resolve future resources (images, etc.
baseUri
)

Provides a w3c DOM Document acquired from an external source.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait