Class OutputIntent
- java.lang.Object
-
- org.faceless.pdf2.OutputIntent
-
- All Implemented Interfaces:
Cloneable
public class OutputIntent extends Object
The OutputIntent class represents an intended output device for PDF. It's used with PDF/A and PDF/X to "anchor" device-dependent color to a particular
ICCColorSpace
. Typically only one OutputIntent is present, and although some variants of PDF/A and PDF/X allow more than one it's recommended that every OutputIntent refers to the sameColorSpace
. PDF/A requires an Output Intent with a type of "GTS_PDFA1". PDF/X uses "GTS_PDFX" and PDF/E uses "ISO_PDFE1". Other types are posssible but won't typically be useful.Prior to version 2.26 OutputIntents were managed through the
OutputProfile
class with the following methods, now all deprecated;OutputProfile.setOutputIntent(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.awt.color.ICC_Profile)
OutputProfile.getOutputIntentDestinationProfile(java.lang.String)
OutputProfile.getOutputConditionIdentifier(java.lang.String)
OutputProfile.getOutputCondition(java.lang.String)
OutputProfile.getOutputIntentInfo(java.lang.String)
OutputProfile.getOutputConditionRegistry(java.lang.String)
The end result was a mess, but this class finally allows the API to reflect the underlying object model: A PDF may zero or more than one Output Intents, so a PDF
So, for example, PDF/A typically requires an OutputIntent with type "GTS_PDFA1". Here's how you'd add one to a target OutputProfile, which you'd apply withOutputProfile
may have zero or moreOutputIntent
objects, managed through theOutputProfile.getOutputIntents()
collection. Each should have a unique type, which is enforced when the PDF is saved.OutputProfiler.apply(org.faceless.pdf2.OutputProfile)
:OutputIntent intent = new OutputIntent("GTS_PDFA1", "sRGB", ColorSpace.getColorSpace(ColorSpace.CS_sRGB)); targetProfile.getOutputIntents().add(intent);
The PDF API ships with a list of "known" OutputIntents, which is the list from http://www.color.org/chardata/drsection1.xalter. Typically the value for "identifier" passed into the constructor will be one of the values from the "Reference name" column on that page - if it is, we'll auto-populate the description, info and registry fields for you.
- Since:
- 2.26
-
-
Constructor Summary
Constructors Constructor Description OutputIntent(String type, String identifier, ColorSpace colorspace)
Create a new OutputIntentOutputIntent(String type, String identifier, ColorSpace colorspace, String description, String info, String registry)
Create a new OutputIntentOutputIntent(String type, OutputIntent source)
Create a new OutputIntent which is a copy of the supplied Intent, but with a new TypeOutputIntent(OutputIntent source)
Create a duplicate of the supplied OutputIntent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
clone()
ICCColorSpace
getColorSpace()
Get the embeddedICCColorSpace
of the Output Intent, if one is included, or null if it is invalid or missing.String
getDescription()
Get the description of the Output Condition, if specified.String
getIdentifier()
Get the Output Condition Identifier, eg.String
getInfo()
Get the Info field of the Output Intent, if specified.String
getRegistry()
Get the registry of the Output Condition if specified, eg.String
getType()
Get the Output Condition Identifier, eg.OutputProfile.Feature[]
isCompatibleWith(OutputProfile target)
Return the list of features of this OutputIntent that are incompatible with the supplied target OutputProfile, or null if this OutputIntent is compatiblevoid
putLiteral(String key, String tokens)
Put a literal token sequnce.void
setDescription(String description)
Set the Description field of the Output Condition.void
setInfo(String info)
Set the Info field of the Output Condition.void
setRegistry(String registry)
Set the RegistryName field of the Output Condition.String
toString()
-
-
-
Constructor Detail
-
OutputIntent
public OutputIntent(String type, String identifier, ColorSpace colorspace)
Create a new OutputIntent- Parameters:
type
- the type of OutputIntent - usually one of "GTS_PDFA1", "GTS_PDX" or "ISO_PDFE1". Required.identifier
- the name of the Output Condition, eg "FOGRA39" or "CGATS TR 001". If null, we will try to use the description from theICCColorSpace
if available, but if this is empty or null we'll throw an Exception.colorspace
- the ColorSpace, which must be aICCColorSpace
orICC_ColorSpace
, and must be GrayScale, RGB or CMYK. If null and the identifier is "sRGB" this will be auto-populated, otherwise a null value leaves the ColorSpace unset.
-
OutputIntent
public OutputIntent(String type, String identifier, ColorSpace colorspace, String description, String info, String registry)
Create a new OutputIntent- Parameters:
type
- the type of OutputIntent - usually one of "GTS_PDFA1", "GTS_PDX" or "ISO_PDFE1". Required.identifier
- the name of the Output Condition, eg "FOGRA39" or "CGATS TR 001". If null, we will try to use the description from theICCColorSpace
if available, but if this is empty or null we'll throw an Exception.colorspace
- the ColorSpace, which must be aICCColorSpace
orICC_ColorSpace
, and must be GrayScale, RGB or CMYK. If null and the identifier is "sRGB" this will be auto-populated, otherwise a null value leaves the ColorSpace unset.description
- if not null, the value to pass tosetDescription(java.lang.String)
info
- if not null, the value to pass tosetInfo(java.lang.String)
registry
- if not null, the value to pass tosetRegistry(java.lang.String)
-
OutputIntent
public OutputIntent(String type, OutputIntent source)
Create a new OutputIntent which is a copy of the supplied Intent, but with a new Type- Parameters:
type
- the type of OutputIntent - usually one of "GTS_PDFA1", "GTS_PDX" or "ISO_PDFE1"source
- the OutputIntent to duplicate
-
OutputIntent
public OutputIntent(OutputIntent source)
Create a duplicate of the supplied OutputIntent. Callsthis(source.getType(), source)
-
-
Method Detail
-
getType
public String getType()
Get the Output Condition Identifier, eg. "GTS_PDFX"
-
getIdentifier
public String getIdentifier()
Get the Output Condition Identifier, eg. "CGATS TR 001"
-
getDescription
public String getDescription()
Get the description of the Output Condition, if specified.
-
getRegistry
public String getRegistry()
Get the registry of the Output Condition if specified, eg. "http://www.color.org"
-
getInfo
public String getInfo()
Get the Info field of the Output Intent, if specified.
-
setDescription
public void setDescription(String description)
Set the Description field of the Output Condition.
-
setInfo
public void setInfo(String info)
Set the Info field of the Output Condition.
-
setRegistry
public void setRegistry(String registry)
Set the RegistryName field of the Output Condition.
-
getColorSpace
public ICCColorSpace getColorSpace()
Get the embeddedICCColorSpace
of the Output Intent, if one is included, or null if it is invalid or missing.
-
isCompatibleWith
public OutputProfile.Feature[] isCompatibleWith(OutputProfile target)
Return the list of features of this OutputIntent that are incompatible with the supplied target OutputProfile, or null if this OutputIntent is compatible
-
toString
public String toString()
-
putLiteral
public void putLiteral(String key, String tokens)
Put a literal token sequnce. For debugging- Parameters:
key
- the keytokens
- the token sequence, eg "true" or "/foo" or "[/Foo/Bar]". No refs, just direct objects.
-
-