Adding Print Button With Java Script to Print of Different Pages Differently

Hi,
I am in the process of making a form and most of it is done and now I want to be able to print off two of the pages but to different printers, I have one that needs to be printed off on a regular A4 printer and another that needs to go to a label printer. I have both of the names for the printers and I have tried something but it just doesnt do anything at all (this is suggested by adobe I think?)
var pp = this.getPRintParam();
var printamount = this.getValue("Quantity_Boxes");
pp.printerName = "Zebra Technologies ZTC GK420t";
pp.firstPage = 3;
pp.lastPage = 3;
pp.NumCopies = 2*printamount;
this.print();
I tried it without the first and last page and nothing happens, I am useing a shared printer which works when I do cmd + P which the full printer name is Zebra Technologies ZTC GK420t @ User's iMac. (I have also tried putting the full name in aswell)
This is just to test one page so far but is there any way that one button will be able to print off 2 different pages to 2 different printers?
If someone knows how this would be a great help!
Thanks,
Bruce

Thanks for that, I have it working now but it shows the dialog box with no settings changed should i use:
pp.interactive = pp.constants.interactionLevel.automatic ?
Thanks,
Bruce
EDIT:
It printed but only the first page but it printed on the right amount quantity was 2*3 wich was the result of the Quantity_Box value
I want it to print page 3 through the Zebra Printer and have page 2 printed to a different printer, is this possible through one button?

Similar Messages

  • SAVE AS BUTTON WITH JAVA SCRIPT FOR MOUSE UP EVENT

    Please any one help with complete code for "SAVE AS" button to auto save the acrobat form in a user specified path
    with unique name or incremental name.Please post only full script for MOUSE UP event.

    Thanks George but i need an example.my actual need is
    i have created a SAVE INVOICE button.i have set the action"Mouse up" to run a Java script.
    Now i need a scriprt for the same.
    If i press that SAVE INVOICE button.the fie should save on "C:\Users\MUNNA\Desktop" automatically
    with unique name and the name should not remain same for next Save.because it overwrites the previous
    file so please post an example pdf with same.

  • Problems with Java Scripting API

    Hello Everyone!
    Guys, I need help with Java scripting API. A problem is that I cannot understand how can I operate Java Object's fields and methods from the script language. I have chosen embedded javascript to work with. And I can get the fields and methods of in-box java classes (such as ArrayList for example), but I cannot work with methods and fields from my own classes!
    Here is an example:
    public class ScriptingExample {  
        class MyClass {  
            int myfield = 5;  
            int getInt() {return 7;}  
        public void runExample() {  
            ScriptEngineManager mgr = new ScriptEngineManager();  
            List<ScriptEngineFactory> factories = mgr.getEngineFactories();  
            ScriptEngineManager factory = new ScriptEngineManager();  
            ScriptEngine engine = factory.getEngineByName("JavaScript");  
            MyClass mc = new MyClass();  
            try{  
                engine.put("mc", mc);  
                engine.eval("print(mc.myfield); print(mc.getInt())"); // or engine.eval("print(mc.myfield)");
            } catch (Exception e) {e.printStackTrace();}  
    }  If I run the code with the commented part it prints "undefined" instead of "5".
    If I run the code as it is it prints error instead of "7":
    undefinedjavax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot find function getInt. (<Unknown source>#1) in <Unknown source> at line number 1
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
    at javax.script.AbstractScriptEngine.eval(Unknown Source)
    at solutiondatabase.ScriptingExample.runExample(ScriptingExample.java:26)
    at solutiondatabase.Main.main(Main.java:49)
    How can I fix it?

    Guys,
    please let me raise this topic because several new questions emerged.
    (1) How can I get all the variables created inside my engine?
    There are two kinds of variables: first kind is Java obejcts put inside the engine and second kind is the variables created in my script, such as 'var a = 4;'. How can I list all the variables of that two kinds?
    (2) Is there is a way to make 'import static' to the engine? I dont want to write MyClass.MyEnum.MyEnumItem every time. Also, I cannot put the whole enum into the engine with engine.put("MyEnum", MyEnum); I can put only enum items separately: engine.put("MyEnum", MyEnum.EnumItemA);. Thats why I ask about static import.
    (3) How can I cast engine variables back to java variables inside my java code?
    Here is my example:
    package mypackage;
    import java.util.ArrayList;
    import java.util.List;
    import javax.script.ScriptEngine;
    import javax.script.ScriptEngineFactory;
    import javax.script.ScriptEngineManager;
    public class Main
         public static void main(String[] args) throws Exception 
              ScriptEngineManager mgr = new ScriptEngineManager();
              List<ScriptEngineFactory> factories = mgr.getEngineFactories();
              ScriptEngineManager factory = new ScriptEngineManager();
              ScriptEngine engine = factory.getEngineByName("JavaScript");
              ArrayList<Double> myList = new ArrayList<Double>();
              myList.add(5.0);                    
              engine.put("MyList", myList);     
              engine.eval("MyVar = MyList.get(0);");
              System.out.println((Double)engine.get("MyVar"));
    }The result is:
    Exception in thread "main" java.lang.ClassCastException: sun.org.mozilla.javascript.internal.NativeJavaObject cannot be cast to java.lang.Double
    +     at mypackage.Main.main(Main.java:28)+
    Is it possible to retrieve my Double java object from the engine?
    Edited by: Dmitry_MSK on Aug 6, 2010 1:56 AM

  • Separator page prints out with wrong name when printing from Outlook 2010

    Working with Windows 7 Enterprise, Outlook 2010.  We've set up our desk printers to print a separator page with the user's name, as several people use the same printers in our building.  Printing from IE, Word, etc. all work fine, and it'll print
    out the correct username on the separator page.
    When anyone attempts to print an Outlook email, it instead prints out my username.  We've found that it doesn't happen if they click on the "quick print" button, but it happens every time if they do "file > Print" or Ctrl+P.

    Hi
    As per the information and details provided by you that separator page prints out with wrong name when printing from Outlook 2010, please follow these steps: -
    To create a custom separator page file, use a text editor such as
    Notepad. On the very first line, type one single character, and then press
    Enter. The character on this line defines the character used as an escape character. For example, the following list assumes that this character is the at sign (@).
    Enter the escape codes for the functions you want, and then save the file with an .sep extension in the Windows System32 subfolder.
    In the Print Manager, select the printer that you want to use the separator page file with, and then click
    Choose Properties on the Printer menu.
    Click
    Details, specify the name of the desired separator page file in the
    Separator File box, and then click OK.
    Note:
    Put the custom separator page file in one of the following locations:
    In the %Windir%System32 folder.
    In a folder whose path contains a SepFiles folder. For example:
    Drive:\Folder\SepFiles\Subfolder
    I hope this information will be helpful for you.
    Thanks and regards
    Shweta@G 

  • Clicking a htmlb:button via Java Script

    Hi all!
    I would like to 'click' a htmlb:button via Java Script.
    Example with a html-button:
    <htmlb:button id="b1" onClientClick="javascript:document.form_id['b2'].click()" text="Call Button 2"/>
    <input id="b2" type="button" onclick="alert('2')">
    Does anybody have an idea how it works with a htmlb:button?
    Thanks!
    Stefan
    Message was edited by: Stefan Kittsteiner

    Hi Stefan,
    Use this
    <script>
    function submit()
      return htmlbSL(this,2,'b2:b2Click');
    </script>
    <htmlb:button id="b1" onClientClick="javascript:submit()" text="Call Button 2" />
    <htmlb:button id="b2" onClientClick="alert('I am clicked')" text="Button 2" />
    b2Click is server event for button 'b2'.
    You can also use <bsp:htmlbEvent> for more details see weblog  <a href="/people/brian.mckellar/blog/2004/07/18/bsp-in-depth-using-the-htmlb-event-system In-Depth: Using the HTMLB Event System</a>
    Regards,
    Narinder Hartala

  • Problem with Java Script after upgrade from BW 3.5 to BI7

    Dear Colleagues,
    We're facing the issue with Java Script after upgrade of BW 3.5 to BI7.
    Just after update we checked the basic functionality and it occured that some of web templates that use Java Script don't work. They generate seelction screen, but after selection the screen becomes blank without any error messages.
    We're currently stucked since web templates weren't converted to BI7 version so they should work exactly as before the upgrade.
    We compared the Java code with other environment that was not upgraded - it's perfectly the same.
    The only explanation that comes to my mind is that some Java Script settings on the server level were changed during the upgrade but I have no idea where I can check that.
    Thanks in advance for any suggestions,
    Andrzej Bobula

    Hi Deepu,
    Thanks, it was great to read your reply and then few minutes later talk to you live on SDN Day!
    Unfortunately, http cache clean-up did not help. But there is another funny thing I found - for exactly the same 3.5 webtemplate html code returned from WebAS 3.5 was different then from 7.0.
    Unfortunately, this editor does not allow to paste complete code, even in CODE brackets, but here are main differences:
    <b>3.5</b>
       if (navigator.appName == "Microsoft Internet Explorer")
    <frame src="/sap/bw/BEx?SAP-LANGUAGE=E&PAGENO=1&REQUEST_NO=1&CMD=GET_TEMPLATE"
    name="Content">
    and
    <b>7.0</b>
       if (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1)
    <frame src="/sap/bw/BEx?SAP-LANGUAGE=E&PAGENO=8&REQUEST_NO=0&CMD=GET_TEMPLATE"
    name="Content" 0nLoad="javascript:loadTitle()">
    (I intentionaly put 0 i/o o in 0nLoad, otherwise Forum's editor does not accept the text.
    How about SAP's claim that technical upgrade from 3.x to 7.0 changes nothing?
    Regards,
    Vitaliy

  • Web site with Java Scripts ( on iphone4)

    try to open a web site with Java scripts , but it just show empty on the scripts section , anyone can help ? (on iphone 4 with iOS 4.1)

    Hi, welcome to Apple Discussions.
    Web pages that make use of Javascript should work just fine. Those that have embedded Java applications won't. Java & Javascript are two different animals despite the similarity in the names. Like Flash, Java is not supported on iOS.
    tt2

  • Adobe Reader prints PDFs with magenta hue when printing is set to B&W

    Adobe Reader prints PDFs with magenta hue when printing is set to B&W

    BTW... Asking the SAME thing THREE TIMES WON'T change the answer.

  • Reader Adobe Reader prints PDFs with magenta hue when printing is set to B&W

    Adobe Reader prints PDFs with magenta hue when printing is set to B&W

    BTW... Asking the SAME thing THREE TIMES WON'T change the answer.

  • I want to read and assign value of ADF Table rows  with Java Script

    Hi,
    I want to read and assign value of ADF Table rows with Java Script, but I cant true index of current row , so I assign wrong value to anathor column of ADF Table.
    My Code;
    ADF Table items
    <af:column sortProperty="Adet" sortable="false"
    headerText="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.labels.Adet}"
    binding="#{backing_ucret.column2}" id="column2">
    <af:inputText value="#{row.Adet}"
    required="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.attrDefs.Adet.mandatory}"
    columns="10"
    binding="#{backing_ucret.inputText2}"
    id="inputText2" onchange="getTutar('#{bindings.voHarcamaOdeme1Iterator.rangeStart + bindings.voHarcamaOdeme1Iterator.currentRowIndexInRange + 1}','#{bindings.voHarcamaOdeme1Iterator.estimatedRowCount}','#{row.index}')">
    <f:convertNumber groupingUsed="false"
    pattern="#{bindings.RezervasyonWithParams1voHarcamaOdeme1.formats.Adet}"/>
    </af:inputText>
    </af:column>
    MY JAVA SCRIPT CODE
    <f:verbatim>
    <script language="javascript" type="text/javascript">
    function getTutar(rowkey,totalrow,currentRow){
    alert('rowkey--totalRow--currentRow-->'+rowkey+'--'+totalrow+'--'+currentRow);
    if (currentRow==0) {
    rowkey=totalrow-1;
    }else{
    var rw=totalrow-currentRow-1;
    rowkey=rw;
    alert(document.getElementById('form1:table1:'+rowkey+':inputText8').value);
    alert(document.getElementById('form1:table1:'+currentRow+':inputText8').value);
    var birim_ucret=document.getElementById('form1:table1:'+rowkey+':inputText8').value;
    var adet=document.getElementById('form1:table1:'+rowkey+':inputText2').value;
    document.getElementById('form1:table1:'+rowkey+':inputText3').value=birim_ucret*adet;
    document.getElementById('form1:inputText6').value=0;
    var t;
    var toplam=0;
    alert('before Sum');
    for (var i=0;i!=totalrow-1;i++){
    t = document.getElementById('form1:table1:'+i+':inputText3');
    toplam+=t.value*1;
    document.getElementById('form1:inputText6').value=toplam;
    </script>
    </f:verbatim>

    You can achieve the use case you describe with partial page rendering (PPR), a feature of the ADF Faces framework. Here are a few posts that achieve an interactive behavior using PPR. Off the top of my head I do not know of an exact example, but this should be a good starting point:
    http://thepeninsulasedge.com/blog/2006/09/12/adf-faces-aftableselectmany/
    http://thepeninsulasedge.com/blog/2006/08/31/adf-faces-working-with-aftableselectone-and-the-dialog-framework/
    --RiC                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Coding to send mail but body with java script

    Hi,
    here my requirement is send mail in action but body with java script just tell me how i include java script in coding of mail sending.
    regards,
    ss

    self

  • Best practice for java script placement on a BC page?

    Hi guys just a general ask about where the best place for java script is on a BC page.
    I just watched the this very good video on optimization http://bcgurus.com/tutorials/how-to-do-website-performance-optimization and in it it says how you should try and load the scripts at the bottom of the page so that it loads quicker.
    now I want to do this but with it being a BC site i dont know if certain scripts have to be in the head of the doc. For instance the validate script I have? Does anyone know what I can and cant move from the head?
    I was going to do what kiyuco like to practice and add all my scripts to a content holder and then add that to my pages/templates. Will BC like me adding this to the bottom of the page and not the head?
    Thanks
    Dave

    http://forums.adobe.com/docs/DOC-2964

  • Forms 10gR2 printing issue with Java Plug-in 1.6.0_21

    Hi All,
    I replaced Jinitiator by Java Plug-in 1.6.0_21. I’m using forms 10gR2. I modified formsweb.cfg file and most of the other functionality work fine. I overwrote the default functionality of the menu item ‘Print Button’ by the following java script
    *'File name :- print.html'*
    <html>
    <head>
    <title>Print</title>
    <style type="text/css">
    font-family:"arial";
    color: #303030;
    </style>
    </head>
    <body onload="printsetup();">
    <div style="border: 1px solid; padding:10px">
    <div style="font-size:larger;text-decoration:bold;padding-bottom:10px;text-align:center">Print capture beginning. Please wait...</div>
    <div style="text-align:center">(This window will close automatically.)</div>
    </div>
    <script>
    function printform()
    window.opener.print();
    window.close();
    function printsetup()
    window.resizeTo(600,250);
    var t=setTimeout("printform()",1000);
    </script>
    </body>
    </html>
    It was working fine with Jinitiator since I installed java sun I always receive the following error message
    Line: 19
    Char: 1
    Error: 'window.opener' is null or not an object
    Code: 0
    URL: http://localhost.domain:port/forms/webutil/start/print.html.
    Thanks & Regards,
    Walid

    The problem you are both reporting is unclear. If I understand at all what you are doing, it would seem that you are calling window.opener, but the window has no name. In newer browser versions (I believe IE 7 and newer) what I think you are trying to do won't work anymore. Take a look at this:
    http://msmvps.com/blogs/paulomorgado/archive/2007/11/02/how-to-close-browser-windows-in-windows-internet-explorer-7.aspx
    Also check out MyOracleSupport Note 865745.1
    The example in the note has been tested with Forms 10.1.2.3 and 11.1.1.4 using 1.6.0_23 in IE8 and FF3.6 and appears to work correctly.

  • Looking for java script to print slide

    Hey everyone,
    The print widget and playbar print don't always work too well. Does anyone have a java script they are willing to share with me that will print a single slide and/or a set of slides?
    Thanks!
      Lori

    Hi Lori
    I think it may depend on your browser. If the browser is Microsoft Internet Explorer, sometimes you have make adjustments to coax something like a Flash file to print. You might try clicking File > Page setup... and see if you have the option for printing Background Colors and Images.
    Cheers... Rick

  • Printing Buttons with Images

    In my application, I am attempting to print a document that has both buttons with text and buttons with images, along with plain text.
    When I print, the buttons with the images are larger than they ought to be (i.e. they don't fit within the area they were suppose to be drawn within (btw, for this application, I am using absolute positioning)).
    However, this does NOT occur with the buttons that have only text and no image.
    Can anybody tell me why this might be? It seems that to printing a JButton comes from the functionallity of JComponent.print, which simply sets a few printing flags and calls JComponent.paint.
    So whatever changes those flags make, I would think they ought to effect all buttons the same?
    Has anybody else run into this problem, and possibly found a solution for it?

    myJButton.setSize(new java.awt.Dimension(<width>,<height>));
    that line should do it. keep in mind that that will not resize your image. since you are using absolute positioning I will assume your button is of constant size. you should manually resize your images to be of the proper size for your buttons.

Maybe you are looking for

  • Applications didn't transfer from old hard drive to new hard drive

    My MacBook Pro recently got water damage but I managed to save the hard drive.  After purchasing a new MacBook Pro I used Migration Assistant to move the contents from my old hard drive to my new one.  Everything transferred except for a few of my ap

  • HOW TO REVIEW STATSPACK REPORT

    dear all i have sucessfully done with statspack i know how to analyse with 1.Instance Efficiency Percentages (Target 100%) 2.Top 5 Timed Events 3. Buffer Gets Executions Gets per Exec %Total Time 4.tablespace but i want to explore more on statspack p

  • New apple tv worth upgrade

    I own the original Apple TV and am wondering if there is anything about the new one that makes it worth upgrading?

  • Why can't show result in JSTL?

    I use Tomcat5.0 . The resulting output of the preceding code fragment is $9,000 ,but it show nothing in IE. Why? <%@ taglib uri='http://java.sun.com/jstl/fmt' prefix='fmt'%> <c:set var='originalMonetaryAmount' value='$10,000'/> <fmt:parseNumber value

  • Standby Database with Oracle Standard Edition

    Hi, my customer wants to create a standby database for his production database (Oracle Standard Edition 11g R2 @ Windows 2008 R2 64 Bit). Now has somebody a proof-of-concept which explains shortly the concept and how to achieve it. Many thanks in adv