2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 package org.apache.pdfbox.pdmodel.interactive.action;
19 import org.apache.pdfbox.cos.COSBase;
20 import org.apache.pdfbox.cos.COSDictionary;
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;
23 import org.apache.pdfbox.pdmodel.interactive.action.type.PDAction;
26 * This class represents a document catalog's dictionary of actions
27 * that occur due to events.
29 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
30 * @author Panagiotis Toumasis (ptoumasis@mail.gr)
31 * @version $Revision: 1.2 $
33 public class PDDocumentCatalogAdditionalActions implements COSObjectable
35 private COSDictionary actions;
38 * Default constructor.
40 public PDDocumentCatalogAdditionalActions()
42 actions = new COSDictionary();
48 * @param a The action dictionary.
50 public PDDocumentCatalogAdditionalActions( COSDictionary a )
56 * Convert this standard java object to a COS object.
58 * @return The cos object that matches this Java object.
60 public COSBase getCOSObject()
66 * Convert this standard java object to a COS object.
68 * @return The cos object that matches this Java object.
70 public COSDictionary getCOSDictionary()
76 * This will get a JavaScript action to be performed
77 * before closing a document.
78 * The name WC stands for "will close".
80 * @return The WC entry of document catalog's additional actions dictionary.
82 public PDAction getWC()
84 COSDictionary wc = (COSDictionary)actions.getDictionaryObject( "WC" );
85 PDAction retval = null;
88 retval = PDActionFactory.createAction( wc );
94 * This will set a JavaScript action to be performed
95 * before closing a document.
96 * The name WC stands for "will close".
98 * @param wc The action to be performed.
100 public void setWC( PDAction wc )
102 actions.setItem( "WC", wc );
106 * This will get a JavaScript action to be performed
107 * before saving a document.
108 * The name WS stands for "will save".
110 * @return The WS entry of document catalog's additional actions dictionary.
112 public PDAction getWS()
114 COSDictionary ws = (COSDictionary)actions.getDictionaryObject( "WS" );
115 PDAction retval = null;
118 retval = PDActionFactory.createAction( ws );
124 * This will set a JavaScript action to be performed
125 * before saving a document.
126 * The name WS stands for "will save".
128 * @param ws The action to be performed.
130 public void setWS( PDAction ws )
132 actions.setItem( "WS", ws );
136 * This will get a JavaScript action to be performed
137 * after saving a document.
138 * The name DS stands for "did save".
140 * @return The DS entry of document catalog's additional actions dictionary.
142 public PDAction getDS()
144 COSDictionary ds = (COSDictionary)actions.getDictionaryObject( "DS" );
145 PDAction retval = null;
148 retval = PDActionFactory.createAction( ds );
154 * This will set a JavaScript action to be performed
155 * after saving a document.
156 * The name DS stands for "did save".
158 * @param ds The action to be performed.
160 public void setDS( PDAction ds )
162 actions.setItem( "DS", ds );
166 * This will get a JavaScript action to be performed
167 * before printing a document.
168 * The name WP stands for "will print".
170 * @return The WP entry of document catalog's additional actions dictionary.
172 public PDAction getWP()
174 COSDictionary wp = (COSDictionary)actions.getDictionaryObject( "WP" );
175 PDAction retval = null;
178 retval = PDActionFactory.createAction( wp );
184 * This will set a JavaScript action to be performed
185 * before printing a document.
186 * The name WP stands for "will print".
188 * @param wp The action to be performed.
190 public void setWP( PDAction wp )
192 actions.setItem( "WP", wp );
196 * This will get a JavaScript action to be performed
197 * after printing a document.
198 * The name DP stands for "did print".
200 * @return The DP entry of document catalog's additional actions dictionary.
202 public PDAction getDP()
204 COSDictionary dp = (COSDictionary)actions.getDictionaryObject( "DP" );
205 PDAction retval = null;
208 retval = PDActionFactory.createAction( dp );
214 * This will set a JavaScript action to be performed
215 * after printing a document.
216 * The name DP stands for "did print".
218 * @param dp The action to be performed.
220 public void setDP( PDAction dp )
222 actions.setItem( "DP", dp );