1 /* 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 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 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. 16 */ 17 18 /* $Id: PDFXObject.java 1305467 2012-03-26 17:39:20Z vhennebert $ */ 19 20 package org.apache.fop.pdf; 21 22 // Java 23 import java.io.IOException; 24 25 /** 26 * Abstract base class of PDF XObjects. 27 * 28 * A derivative of the PDF Object, is a PDF Stream that has not only a 29 * dictionary but a stream of image data. 30 * The dictionary just provides information like the stream length. 31 * This outputs the image dictionary and the image data. 32 * This is used as a reference for inserting the same image in the 33 * document in another place. 34 */ 35 public abstract class PDFXObject extends AbstractPDFStream { 36 37 /** 38 * Create an XObject with the given number. 39 */ PDFXObject()40 public PDFXObject() { 41 super(); 42 } 43 PDFXObject(PDFDictionary dictionary)44 protected PDFXObject(PDFDictionary dictionary) { 45 super(dictionary); 46 } 47 48 /** 49 * Returns the XObject's name. 50 * @return the name of the XObject 51 */ getName()52 public PDFName getName() { 53 return (PDFName)get("Name"); 54 } 55 56 /** {@inheritDoc} */ populateStreamDict(Object lengthEntry)57 protected void populateStreamDict(Object lengthEntry) { 58 put("Type", new PDFName("XObject")); 59 super.populateStreamDict(lengthEntry); 60 } 61 62 /** {@inheritDoc} */ getSizeHint()63 protected int getSizeHint() throws IOException { 64 return 0; 65 } 66 67 } 68