Class PDFAttribute

  • All Implemented Interfaces:
    java.lang.Cloneable, Changeable, Debuggable, DebugListener, Derivable, ModelErrorHandler, MoMLExportable, Moveable, Nameable

    public class PDFAttribute
    extends VisibleAttribute

    This is an attribute that renders the first page of a specified PDF file. Its source parameter specifies a file containing the PDF, and its scale attribute specifies a scaling factor, as a percentage.

    This class uses pdf-renderer, obtainable from This is an "an open source, all Java library which renders PDF documents to the screen using Java2D." This attribute can be put into a Vergil diagram and its visual appearance will be be defined by a PDF file. Using this attribute requires that PDFRenderer.jar in the classpath, it is usually found in $PTII/lib/PDFRenderer.jar.

    The pdf-renderer package is licensed under the GNU Lesser General Public License (LGPL).

    Ptolemy II 8.0
    Edward A. Lee
    Red (cxh)
    Yellow (eal)
    • Field Detail

      • scale

        public Parameter scale
        The scale, as a percentage. This is a double that defaults to 100.0.
      • source

        public FileParameter source
        The source image file. This is a file name or URL, where the default is "$CLASSPATH/ptolemy/vergil/pdfrenderer/sample.pdf".
    • Constructor Detail

      • PDFAttribute

        public PDFAttribute​(NamedObj container,
                            java.lang.String name)
                     throws IllegalActionException,
        Construct an attribute with the given name contained by the specified container. The container argument must not be null, or a NullPointerException will be thrown. This attribute will use the workspace of the container for synchronization and version counts. If the name argument is null, then the name is set to the empty string. Increment the version of the workspace.
        container - The container.
        name - The name of this attribute.
        IllegalActionException - If the attribute is not of an acceptable class for the container, or if the name contains a period.
        NameDuplicationException - If the name coincides with an attribute already in the container.
    • Method Detail

      • attributeChanged

        public void attributeChanged​(Attribute attribute)
                              throws IllegalActionException
        React to a change in the source or scale attributes by changing the icon.
        attributeChanged in class NamedObj
        attribute - The attribute that changed.
        IllegalActionException - If the change is not acceptable to this container (should not be thrown).
      • clone

        public java.lang.Object clone​(Workspace workspace)
                               throws java.lang.CloneNotSupportedException
        Clone the object into the specified workspace. The new object is not added to the directory of that workspace (you must do this yourself if you want it there). The result is an object with no container.
        clone in class Attribute
        workspace - The workspace for the cloned object.
        The new Attribute.
        java.lang.CloneNotSupportedException - Not thrown in this base class
        See Also:
        NamedObj.exportMoML(Writer, int, String), NamedObj.setDeferringChangeRequests(boolean)