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

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


                position.setUpperRightX(72 + textWidth);
                position.setUpperRightY(ph-(float)(1.5*inch));
                txtLink.setRectangle(position);

                // add an action
                PDActionURI action = new PDActionURI();
                action.setURI("http://www.pdfbox.org");
                txtLink.setAction(action);

                annotations.add(txtLink);


View Full Code Here


                        {
                            PDAnnotationLink link = (PDAnnotationLink)annot;
                            PDAction action = link.getAction();
                            if( action instanceof PDActionURI )
                            {
                                PDActionURI uri = (PDActionURI)action;
                                String oldURI = uri.getURI();
                                String newURI = "http://www.pdfbox.org";
                                System.out.println( "Page " + pageNum +": Replacing " + oldURI + " with " + newURI );
                                uri.setURI( newURI );
                            }
                        }
                    }
                }
                doc.save( args[1] );
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

                            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 " + pageNum +":'" + urlText + "'=" + uri.getURI() );
                            }
                        }
                    }
                }
            }
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

TOP

Related Classes of org.apache.pdfbox.pdmodel.interactive.action.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.