Package org.apache.pdfbox.pdmodel.interactive.action.type

Examples of org.apache.pdfbox.pdmodel.interactive.action.type.PDActionURI


                    if( o instanceof PDAnnotationLink ) {
                        PDAnnotationLink annotationlink = (PDAnnotationLink) o;
                        if (annotationlink.getAction()  != null) {
                            PDAction action = annotationlink.getAction();
                            if( action instanceof PDActionURI ) {
                                PDActionURI uri = (PDActionURI) action;
                                String link = uri.getURI();
                                if (link != null) {
                                    handler.startElement("div", "class", "annotation");
                                    handler.startElement("a", "href", link);
                                    handler.endElement("a");
                                    handler.endElement("div");
View Full Code Here


public class TestUriAction extends AbstractTestAction
{

    protected PDActionURI createAction()
    {
        PDActionURI action = new PDActionURI();
        action.setURI("http://www.apache.org");
        return action;
    }
View Full Code Here

    }

    @Test
    public void testMissingURI() throws Exception
    {
        PDActionURI action = new PDActionURI();
        valid(action, false, PreflightConstants.ERROR_ACTION_MISING_KEY);
    }
View Full Code Here

    }

    @Test
    public void testInvalidURI() throws Exception
    {
        PDActionURI action = new PDActionURI();
        action.getCOSDictionary().setBoolean(COSName.URI, true);
        valid(action, false, PreflightConstants.ERROR_ACTION_INVALID_TYPE);
    }
View Full Code Here

    }

    @Test
    public void testNextValid() throws Exception
    {
        PDActionURI action = createAction();
        action.setNext(Arrays.asList(createAction()));
        valid(action, true);
    }
View Full Code Here

    }

    @Test
    public void testNextInvalid() throws Exception
    {
        PDActionURI action = createAction();
        action.setNext(Arrays.asList(new PDActionJavaScript()));
        valid(action, false, PreflightConstants.ERROR_ACTION_FORBIDDEN_ACTIONS_EXPLICITLY_FORBIDDEN);
    }
View Full Code Here

        PDDocument document = null;
        try {
            document = PDDocument.load(url);
            for (Map.Entry<String, PDAction> entry : extractLinks(document).entrySet()) {
                if (entry.getValue() instanceof PDActionURI) {
                    PDActionURI uri = (PDActionURI) entry.getValue();
                    urls.put(entry.getKey(), uri.getURI());
                }
            }
        } finally {
            if (document != null) {
                document.close();
View Full Code Here

    public PDActionURI getPreviousURI()
    {
        COSDictionary pa = (COSDictionary) getDictionary().getDictionaryObject("PA");
        if ( pa != null )
        {
            return new PDActionURI( pa );
        }
        else
        {
            return null;
        }
View Full Code Here

                    if( o instanceof PDAnnotationLink ) {
                        PDAnnotationLink annotationlink = (PDAnnotationLink) o;
                        if (annotationlink.getAction()  != null) {
                            PDAction action = annotationlink.getAction();
                            if( action instanceof PDActionURI ) {
                                PDActionURI uri = (PDActionURI) action;
                                String link = uri.getURI();
                                if (link != null) {
                                    handler.startElement("div", "class", "annotation");
                                    handler.startElement("a", "href", link);
                                    handler.endElement("a");
                                    handler.endElement("div");
View Full Code Here

                            PDAnnotationLink link = (PDAnnotationLink)annot;
                            PDAction action = link.getAction();
                            String urlText = stripper.getTextForRegion( "" + j );
                            if( action instanceof PDActionURI )
                            {
                                PDActionURI uri = (PDActionURI)action;
                                System.out.println( "Page " + (i+1) +":'" + urlText + "'=" + uri.getURI() );
                            }
                        }
                    }
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.interactive.action.type.PDActionURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.