/** Creates a JavaScript action. If the JavaScript is smaller than * 50 characters it will be place as a string, otherwise it will * be placed as a compressed stream. * @param code the JavaScript code * @param writer the writer for this action * @return the JavaScript action */ public static PdfAction javaScript(String code, PdfWriter writer) { return javaScript(code, writer, false); }
/** Creates a JavaScript action. If the JavaScript is smaller than * 50 characters it will be place as a string, otherwise it will * be placed as a compressed stream. * @param code the JavaScript code * @param writer the writer for this action * @return the JavaScript action */ public static PdfAction javaScript(String code, PdfWriter writer) { return javaScript(code, writer, false); }
/** Creates a JavaScript action. If the JavaScript is smaller than * 50 characters it will be place as a string, otherwise it will * be placed as a compressed stream. * @param code the JavaScript code * @param writer the writer for this action * @return the JavaScript action */ public static PdfAction javaScript(String code, PdfWriter writer) { return javaScript(code, writer, false); }
/** * Use this method to add a JavaScript action at the document level. * When the document opens, all this JavaScript runs. * @param code the JavaScript code * @param unicode select JavaScript unicode. Note that the internal * Acrobat JavaScript engine does not support unicode, * so this may or may not work for you */ public void addJavaScript(String code, boolean unicode) { addJavaScript(PdfAction.javaScript(code, this, unicode)); }
/** * Use this method to add a JavaScript action at the document level. * When the document opens, all this JavaScript runs. * @param code the JavaScript code * @param unicode select JavaScript unicode. Note that the internal * Acrobat JavaScript engine does not support unicode, * so this may or may not work for you */ public void addJavaScript(String code, boolean unicode) { addJavaScript(PdfAction.javaScript(code, this, unicode)); }
/** * Use this method to add a JavaScript action at the document level. * When the document opens, all this JavaScript runs. * @param name The name of the JS Action in the name tree * @param code the JavaScript code * @param unicode select JavaScript unicode. Note that the internal * Acrobat JavaScript engine does not support unicode, * so this may or may not work for you */ public void addJavaScript(String name, String code, boolean unicode) { addJavaScript(name, PdfAction.javaScript(code, this, unicode)); }
/** * Use this method to add a JavaScript action at the document level. * When the document opens, all this JavaScript runs. * @param name The name of the JS Action in the name tree * @param code the JavaScript code * @param unicode select JavaScript unicode. Note that the internal * Acrobat JavaScript engine does not support unicode, * so this may or may not work for you */ public void addJavaScript(String name, String code, boolean unicode) { addJavaScript(name, PdfAction.javaScript(code, this, unicode)); }
/** * Use this method to add a JavaScript action at the document level. * When the document opens, all this JavaScript runs. * @param name The name of the JS Action in the name tree * @param code the JavaScript code * @param unicode select JavaScript unicode. Note that the internal * Acrobat JavaScript engine does not support unicode, * so this may or may not work for you */ public void addJavaScript(String name, String code, boolean unicode) { addJavaScript(name, PdfAction.javaScript(code, this, unicode)); }
/** * Use this method to add a JavaScript action at the document level. * When the document opens, all this JavaScript runs. * @param code the JavaScript code * @param unicode select JavaScript unicode. Note that the internal * Acrobat JavaScript engine does not support unicode, * so this may or may not work for you */ public void addJavaScript(String code, boolean unicode) { addJavaScript(PdfAction.javaScript(code, this, unicode)); }
protected boolean drawPdfScript( final RenderNode box ) { final Object attribute = box.getAttributes().getAttribute( AttributeNames.Pdf.NAMESPACE, AttributeNames.Pdf.SCRIPT_ACTION ); if ( attribute == null ) { return false; } final String attributeText = String.valueOf( attribute ); final PdfAction action = PdfAction.javaScript( attributeText, writer, false ); final AffineTransform affineTransform = getGraphics().getTransform(); final float translateX = (float) affineTransform.getTranslateX(); final float leftX = translateX + (float) ( StrictGeomUtility.toExternalValue( box.getX() ) ); final float rightX = translateX + (float) ( StrictGeomUtility.toExternalValue( box.getX() + box.getWidth() ) ); final float lowerY = (float) ( globalHeight - StrictGeomUtility.toExternalValue( box.getY() + box.getHeight() ) ); final float upperY = (float) ( globalHeight - StrictGeomUtility.toExternalValue( box.getY() ) ); final PdfAnnotation annotation = new PdfAnnotation( writer, leftX, lowerY, rightX, upperY, action ); writer.addAnnotation( annotation ); return true; }
action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer); } else { action.put(PdfName.S, PdfName.GOTO);
action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer); } else { action.put(PdfName.S, PdfName.GOTO);
action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer); } else { action.put(PdfName.S, PdfName.GOTO);
PdfAction action = new PdfAction(); if (!"".equals(handler.getAttributeValue(elem, "onclick"))) { action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer); } else { action.put(PdfName.S, PdfName.GOTO);
PdfAction action = new PdfAction(); if (!"".equals(handler.getAttributeValue(elem, "onclick"))) { action = PdfAction.javaScript(handler.getAttributeValue(elem, "onclick"), _writer); } else { action.put(PdfName.S, PdfName.GOTO);
PdfAction.javaScript( "if (app.viewerVersion < 7)" + "{this.getURL(\"" + link.getHyperlinkReference() + "\");}" PdfAction.javaScript( "if (app.viewerVersion < 7)" + "{this.getURL(\"" + hyperlink + "\");}"
formField.setAction( PdfAction.javaScript( jsAction, writer ) ); formField.setAdditionalActions( PdfName.BL, PdfAction.javaScript( "if(event.value == '') app.alert('Please enter org unit identifier');", writer ) );