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.documentinterchange.logicalstructure;
19 import org.apache.pdfbox.cos.COSBase;
20 import org.apache.pdfbox.cos.COSDictionary;
21 import org.apache.pdfbox.cos.COSName;
22 import org.apache.pdfbox.pdmodel.PDPage;
23 import org.apache.pdfbox.pdmodel.common.COSObjectable;
26 * A marked-content reference.
28 * @author <a href="mailto:Johannes%20Koch%20%3Ckoch@apache.org%3E">Johannes Koch</a>
29 * @version $Revision: $
31 public class PDMarkedContentReference implements COSObjectable
34 public static final String TYPE = "MCR";
36 private COSDictionary dictionary;
38 protected COSDictionary getCOSDictionary()
40 return this.dictionary;
46 public PDMarkedContentReference()
48 this.dictionary = new COSDictionary();
49 this.dictionary.setName(COSName.TYPE, TYPE);
53 * Constructor for an existing marked content reference.
55 * @param pageDic the page dictionary
56 * @param mcid the marked content indentifier
58 public PDMarkedContentReference(COSDictionary dictionary)
60 this.dictionary = dictionary;
66 public COSBase getCOSObject()
68 return this.dictionary;
76 public PDPage getPage()
78 COSDictionary pg = (COSDictionary) this.getCOSDictionary()
79 .getDictionaryObject(COSName.PG);
82 return new PDPage(pg);
90 * @param page the page
92 public void setPage(PDPage page)
94 this.getCOSDictionary().setItem(COSName.PG, page);
98 * Gets the marked content identifier.
100 * @return the marked content identifier
104 return this.getCOSDictionary().getInt(COSName.MCID);
108 * Sets the marked content identifier.
110 * @param mcid the marked content identifier
112 public void setMCID(int mcid)
114 this.getCOSDictionary().setInt(COSName.MCID, mcid);
119 public String toString()
121 return new StringBuilder()
122 .append("mcid=").append(this.getMCID()).toString();