public class PdfLayer extends PdfObjectWrapper<PdfDictionary> implements IPdfOCG
PdfObjectWrapper
the PdfObject
must be indirect.
Modifier and Type | Field and Description |
---|---|
protected List<PdfLayer> |
children |
protected boolean |
locked |
protected boolean |
on |
protected boolean |
onPanel |
protected PdfLayer |
parent |
protected String |
title
Used for titling group of objects but not actually grouping them.
|
Constructor and Description |
---|
PdfLayer(PdfDictionary layerDictionary)
Creates a new layer by existing dictionary, which must be an indirect object.
|
PdfLayer(String name, PdfDocument document)
Creates a new layer by its name and document.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(PdfLayer childLayer)
Adds a child layer.
|
static void |
addOCGRadioGroup(PdfDocument document, List<PdfLayer> group)
Use this method to set a collection of optional content groups whose states are intended to follow a "radio button" paradigm.
|
static PdfLayer |
createTitle(String title, PdfDocument document)
Creates a title layer.
|
protected static PdfLayer |
createTitleSilent(String title, PdfDocument document)
Creates a title layer without registering it in PdfOCProperties.
|
List<PdfLayer> |
getChildren()
Gets the list of the current child layers of the layer.
|
protected PdfDocument |
getDocument() |
PdfIndirectReference |
getIndirectReference()
Gets the indirect reference to the current layer object, making it indirect first if necessary.
|
Collection<PdfName> |
getIntents()
Gets a collection of current intents specified for this layer.
|
PdfLayer |
getParent()
Gets the parent of this layer, be it a title layer, or a usual one.
|
String |
getTitle()
Gets the title of the layer if it is a title layer, or null if it is a usual layer.
|
protected PdfDictionary |
getUsage()
Gets the /Usage dictionary, creating a new one if necessary.
|
boolean |
isLocked()
Gets whether the layer is currently locked or not.
|
boolean |
isOn()
Gets the initial visibility of the layer when the document is opened.
|
boolean |
isOnPanel()
Gets the layer visibility in Acrobat's layer panel
|
protected boolean |
isWrappedObjectMustBeIndirect()
Defines if the object behind this wrapper must be an indirect object in the resultant document.
|
void |
setCreatorInfo(String creator, String subtype)
Used by the creating application to store application-specific data associated with this optional content group.
|
void |
setExport(boolean export)
Specifies the recommended state for content in this group when the document (or part of it) is saved by a viewer application to a format that does not support optional content (for example, an earlier version of PDF or a raster image format).
|
void |
setIntents(List<PdfName> intents)
Sets the intents of the layer.
|
void |
setLanguage(String lang, boolean preferred)
Specifies the language of the content controlled by this optional content group
|
void |
setLocked(boolean locked)
Use this method to lock an optional content group.
|
void |
setName(String name)
Sets the name of the layer to be displayed in the Layers panel.
|
void |
setOn(boolean on)
Sets the initial visibility of the layer when the document is opened.
|
void |
setOnPanel(boolean onPanel)
Sets the visibility of the layer in Acrobat's layer panel.
|
void |
setPageElement(String pe)
Indicates that the group contains a pagination artifact.
|
void |
setPrint(String subtype, boolean printState)
Specifies that the content in this group is intended for use in printing
|
void |
setUser(String type, String... names)
Specifies one or more users for whom this optional content group is primarily intended.
|
void |
setView(boolean view)
Indicates that the group should be set to that state when the document is opened in a viewer application.
|
void |
setZoom(float min, float max)
Specifies a range of magnifications at which the content in this optional content group is best viewed.
|
ensureObjectIsAddedToDocument, flush, getPdfObject, isFlushed, makeIndirect, makeIndirect, markObjectAsIndirect, setForbidRelease, setModified, setPdfObject, unsetForbidRelease
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getPdfObject
protected String title
protected boolean on
protected boolean onPanel
protected boolean locked
protected PdfLayer parent
public PdfLayer(PdfDictionary layerDictionary)
layerDictionary
- the layer dictionary, must have an indirect reference.
public PdfLayer(String name, PdfDocument document)
name
- the layer name
document
- the PdfDocument which the layer belongs to
public static PdfLayer createTitle(String title, PdfDocument document)
title
- the title text
document
- the PdfDocument
public static void addOCGRadioGroup(PdfDocument document, List<PdfLayer> group)
document
- the PdfDocument
group
- the radio group
public void addChild(PdfLayer childLayer)
childLayer
- the child layer
public PdfLayer getParent()
public void setName(String name)
name
- the name of the layer.
public boolean isOn()
public void setOn(boolean on)
on
- the initial visibility of the layer
public boolean isLocked()
public void setLocked(boolean locked)
public boolean isOnPanel()
public void setOnPanel(boolean onPanel)
false
the layer cannot be directly manipulated by the user. Note that any children layers will also be absent from the panel.
onPanel
- the visibility of the layer in Acrobat's layer panel
public Collection<PdfName> getIntents()
public void setIntents(List<PdfName> intents)
intents
- the list of intents.
public void setCreatorInfo(String creator, String subtype)
creator
- a text string specifying the application that created the group
subtype
- a string defining the type of content controlled by the group. Suggested values include but are not limited to Artwork, for graphic-design or publishing applications, and Technical, for technical designs such as building plans or schematics
public void setLanguage(String lang, boolean preferred)
lang
- a language string which specifies a language and possibly a locale (for example, es-MX represents Mexican Spanish)
preferred
- used by viewer applications when there is a partial match but no exact match between the system language and the language strings in all usage dictionaries
public void setExport(boolean export)
export
- the export state
public void setZoom(float min, float max)
min
- the minimum recommended magnification factors at which the group should be ON. A negative value will set the default to 0
max
- the maximum recommended magnification factor at which the group should be ON. A negative value will set the largest possible magnification supported by the viewer application
public void setPrint(String subtype, boolean printState)
subtype
- a name specifying the kind of content controlled by the group; for example, Trapping, PrintersMarks and Watermark
printState
- indicates that the group should be set to that state when the document is printed from a viewer application
public void setView(boolean view)
view
- the view state
public void setUser(String type, String... names)
type
- a name that can be Ind (individual), Ttl (title), or Org (organization).
names
- one or more text strings representing the name(s) of the individual, position or organization
public void setPageElement(String pe)
pe
- one of the following names: "HF" (Header Footer), "FG" (Foreground), "BG" (Background), or "L" (Logo).
public PdfIndirectReference getIndirectReference()
getIndirectReference
in interface IPdfOCG
public String getTitle()
public List<PdfLayer> getChildren()
protected boolean isWrappedObjectMustBeIndirect()
PdfObjectWrapper
isWrappedObjectMustBeIndirect
in class PdfObjectWrapper<PdfDictionary>
protected PdfDocument getDocument()
protected static PdfLayer createTitleSilent(String title, PdfDocument document)
title
- the title of the layer
document
- the document this title layer belongs to
protected PdfDictionary getUsage()
Copyright © 1998–2016 iText Group NV. All rights reserved.