public class PdfLayer extends PdfDictionary implements PdfOCG
Modifier and Type | Field and Description |
---|---|
protected ArrayList<PdfLayer> |
children |
protected PdfLayer |
parent |
protected PdfIndirectReference |
ref |
protected String |
title |
Constructor and Description |
---|
PdfLayer(String name, PdfWriter writer)
Creates a new layer.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(PdfLayer child)
Adds a child layer.
|
static PdfLayer |
createTitle(String title, PdfWriter writer)
Creates a title layer.
|
ArrayList<PdfLayer> |
getChildren()
Gets the children layers.
|
PdfLayer |
getParent()
Gets the parent layer.
|
PdfObject |
getPdfObject()
Gets the dictionary representing the layer.
|
PdfIndirectReference |
getRef()
Gets the PdfIndirectReference that represents this layer.
|
boolean |
isOn()
Gets the initial visibility of the layer.
|
boolean |
isOnPanel()
Gets the layer visibility in Acrobat's layer panel
|
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 |
setLanguage(String lang, boolean preferred)
Specifies the language of the content controlled by this optional content group
|
void |
setName(String name)
Sets the name of this layer.
|
void |
setOn(boolean on)
Sets the initial visibility of the layer.
|
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)
One of 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.
|
checkType, clear, contains, get, getAsArray, getAsBoolean, getAsDict, getAsIndirectObject, getAsName, getAsNumber, getAsStream, getAsString, getDirectObject, getKeys, isCatalog, isFont, isOutlineTree, isPage, isPages, merge, mergeDifferent, put, putAll, putEx, remove, size, toPdf, toString
canBeInObjStm, getBytes, getIndRef, isArray, isBoolean, isDictionary, isIndirect, isName, isNull, isNumber, isStream, isString, length, setContent, setIndRef, type
protected PdfIndirectReference ref
protected PdfLayer parent
protected String title
public PdfLayer(String name, PdfWriter writer) throws IOException
name
- the name of the layer
writer
- the writer
IOException
public static PdfLayer createTitle(String title, PdfWriter writer)
title
- the title text
writer
- the PdfWriter
public void addChild(PdfLayer child)
child
- the child layer
public PdfLayer getParent()
null
if the layer has no parent
public ArrayList<PdfLayer> getChildren()
null
if the layer has no children
public PdfIndirectReference getRef()
PdfIndirectReference
that represents this layer.
public void setName(String name)
name
- the name of this layer
public PdfObject getPdfObject()
this
.
getPdfObject
in interface PdfOCG
public boolean isOn()
public void setOn(boolean on)
on
- the initial visibility of the layer
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 setPageElement(String pe)
pe
- one of the following names: "HF" (Header Footer), "FG" (Foreground), "BG" (Background), or "L" (Logo).
public void setUser(String type, String... names)
type
- should be "Ind" (Individual), "Ttl" (Title), or "Org" (Organization).
names
- one or more names
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
Copyright © 1998–2016. All rights reserved.