|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.zefer.pd4ml.PD4Constants org.zefer.pd4ml.PD4ML
public class PD4ML
Nested Class Summary | |
---|---|
static class |
PD4ML.StatusMessage
|
Field Summary | |
---|---|
boolean |
adjustHtmlWidthFlag
|
boolean |
debug
|
boolean |
disableHyperlinksFlag
|
static java.lang.String |
FILE_ENCODING
|
boolean |
fitPageVertically
|
static java.lang.String |
ISO8859_1
|
Constructor Summary | |
---|---|
PD4ML()
PD4ML Constructor Creates and initializes an instance of the rendering engine |
Method Summary | |
---|---|
void |
addDocumentActionHandler(java.lang.String actionType,
java.lang.String javaScript)
method defines JavaScript action handler for generated document. |
void |
addMetadata(java.lang.String key,
java.lang.String value,
boolean hide)
The method defines custom properties for PDF document meta data. |
void |
addStyle(java.lang.String stylesheet,
boolean overrideDocumentStyles)
Apply additional stylesheet to the document |
void |
addStyle(java.net.URL stylesheet,
boolean overrideDocumentStyles)
Apply additional stylesheet to the document |
void |
adjustHtmlWidth()
sets htmlWidth to the most right margin of the HTML block content. |
java.awt.Dimension |
changePageOrientation(java.awt.Dimension d)
rotates given page format by 90 degrees. |
void |
clearCache()
removes all objects (images, CSS, etc) from internal caches. |
static void |
debug(java.lang.String str)
debug() utility method |
void |
disableHyperlinks()
if triggered, PD4ML does not generate active hyperlinks in resulting PDF. |
void |
enableDebugInfo()
enables an output of debug messages. |
void |
enableImgSplit(boolean split)
allows to disable image splitting by page breaks. |
void |
enableRenderingPatch(boolean patch)
Deprecated. no patching is needed |
void |
enableSmartTableBreaks(boolean enable)
The method switches on/off the experimental table break feature. |
void |
enableTableBreaks(boolean enable)
Deprecated. |
void |
fitPageVertically()
forces PD4ML to downscale entire HTML layout to fit a single PDF page vertically. |
void |
generateMulticolumn(int columns,
int span,
boolean millimeters)
switches PD4ML into multicolumn mode. |
void |
generateOutlines(boolean fromHeadings)
if triggered, than PD4ML generates PDF bookmarks (aka outlines). |
void |
generatePdfa(boolean enable)
Forces PD4ML to output PDF compliant with PDF/A specification. |
void |
generatePdfForms(boolean enable,
java.lang.String useTtfFont)
forces PD4ML to convert HTML forms into PDF forms (Acroforms). |
PD4Cache |
getCache()
|
java.lang.Object |
getLastRenderInfo(java.lang.String key)
returns statistics for the last render() call |
static java.lang.String |
getVersion()
getVersion() returns current version number |
protected int |
inlineHtmlHeaderHeight(PageHeaderElement header,
java.lang.String title,
int pageNumber,
java.util.Map data,
int maxHeight,
int htmlWidth,
int generation)
Measures height of header or footer (defined inline). |
void |
interpolateImages(boolean mode)
enables or disables image interpolation |
static boolean |
isDemoMode()
returns true if the library is used in evaluation mode |
static boolean |
isPro()
returns true if it is Pro version of the library |
void |
merge(java.io.InputStream input,
int fromPage,
int toPage,
boolean append)
Merges conversion result with an already existing PDF document |
void |
merge(java.io.Reader input,
int fromPage,
int toPage,
boolean append)
Merges conversion result with an already existing PDF document |
void |
monitorProgress(PD4ProgressListener listener)
conversion progress callback support |
void |
outputFormat(java.lang.String format)
|
void |
outputFormat(java.lang.String format,
int width,
int height)
|
void |
outputRange(java.lang.String description)
|
void |
overrideDocumentEncoding(java.lang.String encoding)
sets default encoding for URL-addressed HTML documents |
static int |
predictPageHeight(java.awt.Insets pageInsets,
java.awt.Dimension pageSize,
int userSpace)
|
static float |
predictScale(java.awt.Insets pageInsets,
java.awt.Dimension pageSize,
int userSpace)
|
protected void |
printBackground(PD4Device gd,
PD4PageMark header,
PD4PageMark footer,
java.net.URL base,
int pageNumber,
ResourceCache cache)
|
protected void |
printHtmlHeaderAndFooter(PD4Device gd,
PD4PageMark header,
PD4PageMark footer,
java.lang.String title,
java.net.URL base,
int userSpaceWidth,
int totalPages,
int pageNumber,
java.lang.String encoding,
ResourceCache cache,
double scaleFactor)
|
protected void |
printInlineHtmlHeaderOrFooter(PD4Device gd,
boolean isFooter,
PageHeaderElement inlineHeader,
java.lang.String title,
int totalPages,
int pageNumber,
java.util.Map data,
int maxHeight,
int htmlWidth,
int generation,
java.util.Vector footnotes)
Prints header or footer (defined inline) whose height can vary from page to page. |
protected void |
printInlineRtfHeaderOrFooter(PD4RtfDevice gd,
PageHeaderElement inlineHeader,
java.lang.String title,
java.util.Map data,
int htmlWidth,
int generation)
Prints header or footer (defined inline) whose height can vary from page to page. |
protected void |
printRtfHeaderOrFooter(PD4RtfDevice gd,
PD4PageMark header,
java.lang.String title,
java.net.URL base,
int userSpaceWidth,
java.lang.String encoding,
ResourceCache cache,
double scaleFactor,
boolean firstPage)
|
void |
protectPhysicalUnitDimensions()
makes PD4ML to output PDF objects respecting dimensions/font sizes given in "in", "pt", "cm" etc. |
void |
render(java.io.InputStreamReader isr,
java.io.OutputStream os)
converts input data to PDF |
void |
render(java.io.InputStreamReader isr,
java.io.OutputStream os,
java.net.URL base)
converts input data to PDF. |
void |
render(java.lang.String textUrl,
java.io.OutputStream os)
input data referred by URL to PDF |
void |
render(java.io.StringReader[] isrs,
java.io.OutputStream os,
java.net.URL base)
converts input data to PDF |
void |
render(java.io.StringReader isr,
java.io.OutputStream os)
converts input data to PDF |
void |
render(java.io.StringReader isr,
java.io.OutputStream os,
java.net.URL base)
converts input data to PDF |
void |
render(java.io.StringReader isr,
java.io.OutputStream os,
java.net.URL base,
java.lang.String encoding)
converts input data to PDF |
void |
render(java.net.URL[] urls,
java.io.OutputStream os)
converts input data referred by URLs to PDF |
void |
render(java.net.URL url,
java.io.OutputStream os)
converts input data referred by URL to PDF |
java.awt.image.BufferedImage[] |
renderAsImages(java.io.StringReader isr,
java.net.URL base,
int width,
int height)
|
java.awt.image.BufferedImage[] |
renderAsImages(java.net.URL url,
int width,
int height)
converts URL to image object(s) |
void |
resetAddedStyles()
Reset all styles added with PD4ML.addStyle() |
void |
setAuthorName(java.lang.String name)
sets an author name for the document |
void |
setCache(PD4Cache cacheWrapper)
lets PD4ML to reuse data, cached by another PD4ML instance. |
void |
setCookie(java.lang.String name,
java.lang.String value)
makes PD4ML to add a cookie with given name and value to each URL connection request |
void |
setDefaultTTFs(java.lang.String serif,
java.lang.String sansserif,
java.lang.String monospace)
defines deafult TTF font faces to be used as substritutions for unknown fonts. |
void |
setDocumentTitle(java.lang.String title)
forces to override HTML title |
void |
setDynamicParams(java.util.Map dynamicParams)
|
void |
setHtmlWidth(int width)
defines desired HTML page width in screen pixels. |
void |
setPageFooter(PD4PageMark mark)
defines page footer area |
void |
setPageHeader(PD4PageMark mark)
defines page header area |
void |
setPageInsets(java.awt.Insets ii)
specifies page insets in points |
void |
setPageInsetsMM(java.awt.Insets ii)
specifies page insets in millimeters. |
void |
setPageSize(java.awt.Dimension d)
defines page size in points. |
void |
setPageSizeMM(java.awt.Dimension d)
defines page size in milimeters. |
void |
setPermissions(java.lang.String password,
int permissions,
boolean isStrong)
forces the resulting document to be encrypted with the given password |
void |
setSessionID(java.lang.String sessionID)
the method informs PD4ML about current session ID (in web application environments). |
static int |
translate(int i)
converts from millimeters to points |
void |
useAdobeFontMetrics(boolean use)
Deprecated. always uses AFM |
void |
useHttpRequest(HttpServletRequest httpRequest,
HttpServletResponse httpResponse)
method allows to inform PD4ML about actual HTTP request context (if any). |
void |
useServletContext(ServletContext ctx)
method allows to inform PD4ML about actual servlet context (if any). |
void |
useTTF(java.lang.String pathToFontDirs,
boolean embed)
enables TTF font embedding subsystem. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String ISO8859_1
public static final java.lang.String FILE_ENCODING
public boolean adjustHtmlWidthFlag
public boolean fitPageVertically
public boolean debug
public boolean disableHyperlinksFlag
Constructor Detail |
---|
public PD4ML()
Method Detail |
---|
public static final boolean isDemoMode()
public static final boolean isPro()
public static java.lang.String getVersion()
public void merge(java.io.InputStream input, int fromPage, int toPage, boolean append)
input
- PDF document input streamfromPage
- start page of the existing document (1 or greater)toPage
- end page of the existing document (-1 means all pages)append
- 'true' forces to append the existing PDF to the conversion result. Otherwise the existing document will lead the conversion result.public void merge(java.io.Reader input, int fromPage, int toPage, boolean append)
input
- PDF document readerfromPage
- start page of the existing document (1 or greater)toPage
- end page of the existing document (-1 means all pages)append
- 'true' forces to append the existing PDF to the conversion result. Otherwise the existing document will lead the conversion result.public void render(java.io.InputStreamReader isr, java.io.OutputStream os) throws java.security.InvalidParameterException, java.io.IOException
isr
- input stream reader of formatted data. Relies to properly specified
encoding.os
- output stream to generate PDF to
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.io.StringReader isr, java.io.OutputStream os) throws java.security.InvalidParameterException, java.io.IOException
isr
- string reader of formatted data. Relies to properly specified
encoding.os
- output stream to generate PDF to
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.io.InputStreamReader isr, java.io.OutputStream os, java.net.URL base) throws java.security.InvalidParameterException, java.io.IOException
isr
- input stream reader of formatted data. Relies to properly specified
encoding.os
- output stream to generate PDF tobase
- base URL to lookup referred resources like images or CSS. Can be specified
in HTML body with <base href="..."> tag
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.io.StringReader isr, java.io.OutputStream os, java.net.URL base, java.lang.String encoding) throws java.security.InvalidParameterException, java.io.IOException
isr
- string reader of formatted data. Take care for proper encodingos
- output stream to generate PDF tobase
- base URL to lookup referred resources like images or CSS. Can be specified
in HTML body with <base href="..."> tagencoding
- content encoding
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.io.StringReader isr, java.io.OutputStream os, java.net.URL base) throws java.security.InvalidParameterException, java.io.IOException
isr
- string reader of formatted data. Take care for proper encodingos
- output stream to generate PDF tobase
- base URL to lookup referred resources like images or CSS. Can be specified
in HTML body with <base href="..."> tag
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.io.StringReader[] isrs, java.io.OutputStream os, java.net.URL base) throws java.security.InvalidParameterException, java.io.IOException
isrs
- array of string readers wrap formatted data. Take care for proper encodingos
- output stream to generate PDF tobase
- base URL to lookup referred resources like images or CSS. Can be specified
in HTML body with <base href="..."> tag
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.lang.String textUrl, java.io.OutputStream os) throws java.net.MalformedURLException, java.security.InvalidParameterException, java.io.IOException
textUrl
- text representation of the input data URLos
- output stream to generate PDF to
java.net.MalformedURLException
- invalid URL
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.net.URL url, java.io.OutputStream os) throws java.security.InvalidParameterException, java.io.IOException
url
- input data URLos
- output stream to generate PDF to
java.net.MalformedURLException
- invalid URL
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void render(java.net.URL[] urls, java.io.OutputStream os) throws java.security.InvalidParameterException, java.io.IOException
urls
- input data URLsos
- output stream to generate PDF to
java.net.MalformedURLException
- invalid URL
java.security.InvalidParameterException
- the input or output stream is null
java.io.IOException
- input/output problemspublic void enableDebugInfo()
public void useTTF(java.lang.String pathToFontDirs, boolean embed) throws java.io.FileNotFoundException
embed
- if true forces PD4ML to include used font glyphs to the resulting PDFpathToFontDirs
- URL of a font directory.
The font directory should contain pd4fonts.properties mapping file. The file records have the following format:In order to support J2EE deployments a PD4ML-specific protocol "java:" is supported to load font resources via ClassLoader.
font_name=file_name
- font_name - font name used in the source HTML.
- file_name - font file name (should exist in the font directory)
Example:
Book\ Antiqua=BKANT.TTF
To generate the file automatically you may use the command line call:
java -jar pd4ml.jar -configure.fonts <fontdir>
After the generation, please edit the file and remove manually all references to the fonts, that are not allowed to be redistributed. Contact your TTF fonts provider for the info.
Example: useTTF( "java:myfonts", true );
In that case the runtime looks for a fonts folder named "/myfonts" in all JAR files available for the application class loaders. The content of the folder should correspond to the rules described above: pd4fonts.properties + *.ttf
Example: useTTF( "java:", true );
The simpliest case. The runtime looks for a JAR file which contains pd4fonts.properties + *.ttf in the root directory.
java.io.FileNotFoundException
- if pd4fonts.properties file is not found or the file
refers to missing font filespublic void generatePdfForms(boolean enable, java.lang.String useTtfFont)
useTtfFont
- (not implemented yet) - UNICODE TTF font name to be used for form input. The name must appear in pd4fonts.propertiesenable
- enables or disables the featureuseTTF(String, boolean)
public void generateMulticolumn(int columns, int span, boolean millimeters)
columns
- - number of columns per pagespan
- - space between the columnsmillimeters
- - if 'true' the gap is in millimeters, otherwise in pointspublic void useServletContext(ServletContext ctx)
ctx
- servlet contextpublic void useHttpRequest(HttpServletRequest httpRequest, HttpServletResponse httpResponse)
httpRequest
- actual HTTP requesthttpResponse
- actual HTTP responsepublic void setDefaultTTFs(java.lang.String serif, java.lang.String sansserif, java.lang.String monospace)
serif
- - plain font face for serif fonts (like Times New Roman)sansserif
- - plain font face for sansserif fonts (like Helvetica or Arial)monospace
- - plain font face for monospace fonts (like Courier New)public void enableRenderingPatch(boolean patch)
patch
- boolean switchpublic void useAdobeFontMetrics(boolean use)
use
- boolean switchpublic void generateOutlines(boolean fromHeadings)
fromHeadings
- if set to false, PD4ML creates PDF bookmarks taken from
<a name="destination">Label</a> tags. If a label is not defined, it uses
destination string as visible label.public void setSessionID(java.lang.String sessionID)
sessionID
- actual session IDpublic void overrideDocumentEncoding(java.lang.String encoding)
encoding
- namepublic void disableHyperlinks()
public void enableImgSplit(boolean split)
split
- boolean switchsetHtmlWidth(int)
public void enableTableBreaks(boolean enable)
enableSmartTableBreaks(boolean)
instead
public void enableSmartTableBreaks(boolean enable)
public void setPageHeader(PD4PageMark mark) throws java.security.InvalidParameterException
mark
- header configuration object
java.security.InvalidParameterException
- when the config is nullpublic void setPageFooter(PD4PageMark mark) throws java.security.InvalidParameterException
mark
- footer configuration object
java.security.InvalidParameterException
- when the config is null
or contains invalid datapublic void setPageSizeMM(java.awt.Dimension d) throws java.security.InvalidParameterException
d
- page dimensions in mm
InvalidParameterException,
- when the specified page format is null or
does not fit to already defined page insets
java.security.InvalidParameterException
setPageSize(Dimension)
public void setPermissions(java.lang.String password, int permissions, boolean isStrong)
password
- password. If is set to "empty", than no password assigned to document, only permissions.permissions
- an integer value according to PDF encryption specificationisStrong
- selects between two type of PDF encryption: type2 (false) and type3 (true)public void setCookie(java.lang.String name, java.lang.String value)
name
- namevalue
- valuepublic void addDocumentActionHandler(java.lang.String actionType, java.lang.String javaScript)
actionType
- "OpenAction", "DC" (document close), "WS" (will save), "DS" (did save), "WP" (will print) or "DP" (did print)javaScript
- handler codepublic void setPageSize(java.awt.Dimension d) throws java.security.InvalidParameterException
d
- page dimensions in points
InvalidParameterException,
- when the specified page format is null or
does not fit to already defined page insets
java.security.InvalidParameterException
changePageOrientation(Dimension)
public void setPageInsetsMM(java.awt.Insets ii) throws java.security.InvalidParameterException
ii
- page insets in millimeters
InvalidParameterException,
- when the specified page insets object is null
or when it does not fit to already defined page size
java.security.InvalidParameterException
setPageInsets(Insets)
public void setPageInsets(java.awt.Insets ii) throws java.security.InvalidParameterException
ii
- page insets in points
InvalidParameterException,
- when the specified page insets object is null
or when it does not fit to already defined page size
java.security.InvalidParameterException
public void setHtmlWidth(int width) throws java.security.InvalidParameterException
width
- HTML width in screen pixels
java.security.InvalidParameterException
- when the width is not a positive value great that 0.public void adjustHtmlWidth()
public void fitPageVertically()
public final void generatePdfa(boolean enable)
PD4Constants.PD4ML_PDFA_STATUS
,
getLastRenderInfo(String)
public void protectPhysicalUnitDimensions()
public final void interpolateImages(boolean mode)
mode
- true - enables interpolation. default is falsepublic final void setAuthorName(java.lang.String name)
name
- author's namepublic final void setDocumentTitle(java.lang.String title)
title
- document titlepublic final void addStyle(java.net.URL stylesheet, boolean overrideDocumentStyles) throws java.security.InvalidParameterException
stylesheet
- of css stylesheetoverrideDocumentStyles
- if true, applies the stylesheet after styles defined in the document header.
java.security.InvalidParameterException
- too many styles addedpublic final void addStyle(java.lang.String stylesheet, boolean overrideDocumentStyles) throws java.security.InvalidParameterException
stylesheet
- stylesheet contentoverrideDocumentStyles
- if true, applies the stylesheet after styles defined in the document header.
java.security.InvalidParameterException
- too many styles addedpublic final void resetAddedStyles()
protected void printInlineRtfHeaderOrFooter(PD4RtfDevice gd, PageHeaderElement inlineHeader, java.lang.String title, java.util.Map data, int htmlWidth, int generation)
gd
- RTF deviceinlineHeader
- header elementtitle
- document title (cab be overriden by API)data
- dynamic data for placeholders substitutiongeneration
- dynamic data generation idprotected void printRtfHeaderOrFooter(PD4RtfDevice gd, PD4PageMark header, java.lang.String title, java.net.URL base, int userSpaceWidth, java.lang.String encoding, ResourceCache cache, double scaleFactor, boolean firstPage)
protected void printInlineHtmlHeaderOrFooter(PD4Device gd, boolean isFooter, PageHeaderElement inlineHeader, java.lang.String title, int totalPages, int pageNumber, java.util.Map data, int maxHeight, int htmlWidth, int generation, java.util.Vector footnotes)
gd
- deviceisFooter
- boolean mode: "header or footer"inlineHeader
- header elementtitle
- document title (cab be overriden by API)totalPages
- total number of pagespageNumber
- current page numberdata
- dynamic data for placeholders substitutionmaxHeight
- height limithtmlWidth
- actual setHtmlWidth(int)
parametergeneration
- dynamic data generation idfootnotes
- page footnotes (if any)protected int inlineHtmlHeaderHeight(PageHeaderElement header, java.lang.String title, int pageNumber, java.util.Map data, int maxHeight, int htmlWidth, int generation)
header
- header elementtitle
- document title (cab be overriden by API)pageNumber
- current page numberdata
- dynamic data for placeholders substitutionmaxHeight
- height limithtmlWidth
- actual setHtmlWidth(int)
parametergeneration
- dynamic data generation id
protected void printBackground(PD4Device gd, PD4PageMark header, PD4PageMark footer, java.net.URL base, int pageNumber, ResourceCache cache)
protected void printHtmlHeaderAndFooter(PD4Device gd, PD4PageMark header, PD4PageMark footer, java.lang.String title, java.net.URL base, int userSpaceWidth, int totalPages, int pageNumber, java.lang.String encoding, ResourceCache cache, double scaleFactor)
public java.awt.image.BufferedImage[] renderAsImages(java.net.URL url, int width, int height) throws java.io.IOException
width
- target image widthheight
- target image height
java.io.IOException
public java.awt.image.BufferedImage[] renderAsImages(java.io.StringReader isr, java.net.URL base, int width, int height) throws java.io.IOException
isr
- string reader of formatted data. Take care for proper encodingbase
- base URL to lookup referred resources like images or CSS. Can be specified
in HTML body with <base href="..."> tagwidth
- target image widthheight
- target image height
java.io.IOException
public static void debug(java.lang.String str)
str
- debug messagepublic static final int translate(int i)
i
- value in millimeterspublic java.awt.Dimension changePageOrientation(java.awt.Dimension d)
d
- original page dimension
public static final float predictScale(java.awt.Insets pageInsets, java.awt.Dimension pageSize, int userSpace)
public static final int predictPageHeight(java.awt.Insets pageInsets, java.awt.Dimension pageSize, int userSpace)
public void setDynamicParams(java.util.Map dynamicParams)
dynamicParams
- a set of key/value (String/String) pairs to dynamically substitute placeholders in HTML template (like "$[key]").
Key names "page", "total" and "title" are reserved for PDF headers and footers.public java.lang.Object getLastRenderInfo(java.lang.String key)
key
- - one of the currently supported keys: "pd4ml.document.height.px", "pd4ml.right.edge.px" or "pd4ml.total.pages".
PD4Constants
public void outputRange(java.lang.String description)
description
- a string with output rules. Currently allows to limit a scope of generated pages. Examples: "2+" - skip the first page,
"1-2" - output only the first and the second pages, "even" or "odd" - it is obvious. The rules may
be combined: "3-7,odd"public void outputFormat(java.lang.String format)
format
- file format to output. PD4Constants.PDF - default.public void outputFormat(java.lang.String format, int width, int height)
format
- file format to output. PD4Constants.PDF - default.height
- - limits resulting document simentions by height. relevant for HTML-to-image conversions onlywidth
- - limits resulting document simentions by width. relevant for HTML-to-image conversions onlypublic void addMetadata(java.lang.String key, java.lang.String value, boolean hide)
key
- a unique name, which must not be one of the standard property names Title, Author, Subject,
Keywords, Creator, Producer, CreationDate, ModDate and Trappedvalue
- data itselfhide
- makes the metadata not appear in the PDF document properties dialog of Acroreadpublic void clearCache()
public PD4Cache getCache()
setCache(PD4Cache)
public void setCache(PD4Cache cacheWrapper)
getCache()
public void monitorProgress(PD4ProgressListener listener)
listener
- receiver of progress update messages
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |