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

org.openpdf.renderer.action.GoToAction Maven / Gradle / Ivy

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

import java.io.IOException;

import org.openpdf.renderer.PDFObject;
import org.openpdf.renderer.PDFDestination;
import org.openpdf.renderer.PDFParseException;

/**
 * An action which specifies going to a particular destination
 */
public class GoToAction extends PDFAction {
    /** the destination to go to */
    private PDFDestination dest;
    
    /** 
     * Creates a new instance of GoToAction from an object
     *
     * @param obj the PDFObject with the action information
     */
    public GoToAction(PDFObject obj, PDFObject root) throws IOException {
        super("GoTo");
        
        // find the destination
        PDFObject destObj = obj.getDictRef("D");
        if (destObj == null) {
            throw new PDFParseException("No destination in GoTo action " + obj);
        }
        
        // parse it
        this.dest = PDFDestination.getDestination(destObj, root);
    }
    
    /**
     * Create a new GoToAction from a destination
     */
    public GoToAction(PDFDestination dest) {
        super("GoTo");
    
        this.dest = dest;
    }
      
    /**
     * Get the destination this action refers to
     */
    public PDFDestination getDestination() {
        return this.dest;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy