All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openpdf.renderer.annotation.StampAnnotation Maven / Gradle / Ivy

The newest version!
package org.openpdf.renderer.annotation;

import java.io.IOException;
import java.util.List;

import org.openpdf.renderer.PDFCmd;
import org.openpdf.renderer.PDFObject;

/*****************************************************************************
 * PDF annotation describing a stamp
 *
 * @author Katja Sondermann
 * @since 26.03.2012
 ****************************************************************************/
public class StampAnnotation extends MarkupAnnotation {

	private String iconName;
	private List iconCommands;
	
	/*************************************************************************
	 * Constructor
	 * @param annotObject
	 * @throws IOException 
	 ************************************************************************/
	public StampAnnotation(PDFObject annotObject) throws IOException {
		super(annotObject, AnnotationType.STAMP);
		this.iconName = annotObject.getDictRefAsString("Name");
		
		// No AP so use the icon name
		if (iconName != null && annotObject.getDictRef("AP") == null) {
			parseIconCommands();
		}
		
	}
	
	/**
	 * If the stamp is represented by one of the predefined icons 
	 * this will parse it and create PDFCommands for them.
	 */
	private void parseIconCommands() {
		// TODO Add code for the different icon constants.
		// fill iconCommands
		
		// These command names exist.
		
		// Approved, Experimental, NotApproved, AsIs, Expired , 
		// NotForPublicRelease, Confidential, Final, Sold, 
		// Departmental, ForComment, TopSecret, Draft, ForPublicRelease
	}
	
	/**
	 * @return the iconName
	 */
	public String getIconName() {
		return iconName;
	}
	
	/**
	 *@return the PDF commands to render this annotation
	 */
	@Override
	public List getCurrentCommand() {
		List apCommand = super.getCurrentCommand();
		if (apCommand != null) {
			return apCommand;
		}
		return this.iconCommands;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy