How to get silent printing in java

Hi
In my swing application, i am taking printing out of the screen. Whenever i am using print, a window print dialog is displayed.
And i dont want to have print dialog displayed. Should take printouts silently.
And i want to change page orientation through programming.
I used setOrientation method of PageFormat class to change page orientation, but doesnt change orientation of page.
please help...

I [googled print no dialog|http://www.lmgtfy.com/?q=print+java+no+dialog] which led to an example

Similar Messages

  • How to get stylesheet object from JAVA RESOURCE stored in DB

    Hi,
    I stored a xslt file in the database and have a JAVA RESOURCE file now. How can i get a stylesheet object from this resource file?
    I took the following class to get an impression how to get the contents of the resource but -although the name of the resource was spelled correctly- i got a file not found exception.
    Whats wrong?
    public class PrintRessource {
    public static void print (String p_ressource){
    try {
    Class c = PrintRessource.class;
    System.out.println(c.toString());
    InputStream file = c.getResourceAsStream(p_ressource);
    if (file == null)
    throw new FileNotFoundException("XSLT file not in DB");
    byte[] buffer = new byte[4096];
    int bytes_read;
    while ((bytes_read = file.read(buffer)) != -1)
    System.out.println(new String(buffer, 0 , buffer.length));
    catch (Exception exp) {
    System.out.println(exp);
    Thanks

    The code works as is. I just forgot to add the slash in front of the Resource file name.

  • How to get php content with java ??

    i have made a php file what will display a number,
    here's a example
    <?php
    if ($action == "answer"){
    echo "18274926";
    ?>
    no i want to get the number with java
    so here's my java code
    import java.io.*;
    import java.net.*;
    import java.util.Date;
    class URLConnecties
        public static void main(String args[]) throws Exception
            int teken;
            URL url = new URL("http://www.gamer.mineurwar.nl/net/javachallenge.php?command=DaTe");
            URLConnection urlconnection = url.openConnection();
            System.out.println("Type inhoud: " +
                urlconnection.getContentType());
            System.out.println("Datum document: " +
                new Date(urlconnection.getDate()));
            System.out.println("Laatst gewijzigd: " +
                new Date(urlconnection.getLastModified()));
            System.out.println("Document vervalt: " +
                urlconnection.getExpiration());
            int lengteinhoud = urlconnection.getContentLength();
            System.out.println("Lengte inhoud: " + lengteinhoud);
            if (lengteinhoud > 0) {
                InputStream in = urlconnection.getInputStream();
                while ((teken = in.read()) != -1) {
                    System.out.print((char) teken);
                in.close();
    }if you change the url ro a .html file it displays the code correctly(source),
    but when trying to get the content of a php file (the number)
    it says that there is no content from the php file
    yhe source of the original php file what's in the code can be found at
    www.gamer.mineurwar.nl/net/javachallenge.txt

    The 'content' is generated dynamically by a PHP script so the "content lenght" can't be known in advance by the server. For this reason connection.getContentLenght() returns -1; it doesn't mean that there is no content, only that it can't be known how much there will be.
    To solve the issue, remove the if statement from around the while-loop:// if (lengteinhoud > 0) { DELETE THIS LINE
    InputStream in = urlconnection.getInputStream();
    while ((teken = in.read()) != -1) {
        System.out.print((char) teken);
    // } and this too

  • How to get return value from Java runtime.getRuntime.exec?

    I'm running shell commands from an Oracle db (11gr2) on aix.
    But, I would like to get a return value from a shell comand... like you get with "echo $?"
    I use a code like
    CREATE OR REPLACE JAVA SOURCE NAMED common."Host" AS
    import java.io.*;
    public class Host {
      public static int executeCommand(String command) {
        int retval=0;
        try {
            String[] finalCommand;
            finalCommand = new String[3];
            finalCommand[0] = "/bin/sh";
            finalCommand[1] = "-c";
            finalCommand[2] = command;
          final Process pr = Runtime.getRuntime().exec(finalCommand);
          pr.waitFor();
       catch (Exception ex) {
          System.out.println(ex.getLocalizedMessage());
          retval=-1;
        return retval;
    /but I do not get a return value... because I don't know how to get return value..
    Edited by: user9158455 on 22-Sep-2010 07:33

    Hi,
    Have your tried pr.exitValue() ?
    I think you also need a finally block that destroys the subprocess
    Regards
    Peter

  • How to get the parameter from Java Script into the Parameter crystal Report

    Hi All,
    Crystal Report is integrated with Oracle 10g. I created the base SQL query for col1, col2, col3 and col4. Java Script pass parameter value (185) to Col1.
    My question is how to create crystal report to make Col1 as parameter and how to get the parameter value 185(Col1) from Java Script. Is there any additional code I need to include in the crystal report?
    FYI.
    Java script sends the right parameter value.There is no issue in java script.
    This is an automatic scheduled process when batch runs, Java script should pass the parameter value and the crystal report should get the value and produce the output report.

    Not sure if this is an application question or if you are trying to hook into Crystal Reports parameter UI? If the later then no option other than report design. If an application then I can move this to the Java Forums.
    If you are asking how to alter the parameters I suggest you remove the Java reference and post a new question so it's not confusing the issue.
    Please clarify?

  • How to Get the Print of General Ledger with Opening balances

    Hi Friends.
    How can I get the print out of G.Ledger with all line item transactions and opening balances in a company code?
    Please explain.
    Regards.
    Srini

    hi
    for line item-
    goto s_alr_87012282 and select menu bar "list">print
    for g/l statement
    goto s_alr_87012332 same step above
    rgs

  • How to get rid of the java update virus?

    Everytime i go on a web page something pops up saying to install Java Runtime Environment in order to web content and it gives me the option to click more info (to go to the page to download the Java Runtime Environment) OR ok. Before i clicked ok until it continued to pop and and began to annoy me so i decided to install it. It still pops up and won't go away. I found out it is a virus and i don't know how to get rid of it.
    PLEASE HELP!

    Most likely, you have a web plugin that depends on the Java runtime distributed by Apple, such as the Facebook video calling plugin or the "NexDef" plugin for watching baseball streams. If you no longer need the plugin, remove it. Otherwise, install Java.

  • How to get rid of the java icon on the window

    There is a java icon(top right habd corner) on every window panel.
    How to get rid of it?

    What r u using, AWT r JAVA Swing? would please explain
    ur problem clearlyLOL. No offense, but you might consider phrasing your responses clearly as well...
    r == "are" || r == "or" || r == "argh" :o)
    &#167;

  • HT3669 Hi I have a Konica Minolta PagePro 1300W printer. This works with my Windows-based Toshiba laptop but not with my i-Mac. Can someone please advise me how I get the printer to work with my i-Mac? I have installed it but documents don't print. Thanks

    Hi I have a Konica Minolta PagePro 1300W printer. This works with my Windows-based Toshiba laptop but not with my i-Mac. I have the latest (Mountain Lion 10.8.2) OS-X software.
    I have installed the printer using 'System Preferences' on my i-Mac and it appears on the list of available printers but documents that I create just don't print.
    Can someone please advise me how I get the Konica Minolta PagePro 1300W printer to work with my i-Mac?
    Thanks, John Lee

    Looking at the Konica web site for the PagePro 1300W, I saw the following note.
    Please note: This printer is designed to be used in computer operating systems running MS Windows only. Operating systems such as UNIX, Macintosh, or Linux are not supported nor do we have workaround drivers available. Older MS Windows versions, such as Windows 3.1/95/98[pre-SE] and NT 3.51/4.0, are not supported.
    So KM are not going to help you. But the LinuxFoundation does provide a workaround that should allow you to print. Have a look at this web page. You will need to install all three packages as per the instructions from that page.

  • How to get the printer button to appear

    The buttons on my printer should say scan, copy & print.
    They are now saying scan, copy & copy.   how do I get the print button back, as I cannot print

    Hi,
    What is the exact printer model? is it the HP Photosmart C4385?
    The following model does not provide any fax capabilities as you may find by its datasheet below:
    http://cdn.cnetcontent.com/b6/14/b6144c8e-0a16-4ce3-a66d-2eb03e86f4d9.pdf
    If I misunderstood your pritner model, please clarify the exact model.
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • af:chooseDate - how to get selected month in java class

    <af:chooseDate id="choose_date_ID"
    binding="#{EventsBackingBean.choose_date_ID}">
    </af:chooseDate>
    in adf ,how to get the selected month value in the component.
    and if we change the the month from the drop down,then again new value should be reflected in java class.

    Hi Hoque,
    As per the documentation of af:choose at http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e12419/tagdoc/af_chooseDate.html
    "In order to indicate that a particular inputDate should be updated in response to chooseDate selection changes, the the inputDate's "chooseId" attribute must be set to the id of the associated chooseDate component.ts mentioned that the the af:choose "
    So, i believe that if you can create a binding to the af:inputDate component in your backing bean, you can extract the newly selected date in a ValueChangedListener using the getValue() function on the bound component.
    private RichInputDate chooseDateInput;
        public void setChooseDateInput(RichInputDate chooseDateInput) {
            this.chooseDateInput = chooseDateInput;
        public RichInputDate getChooseDateInput() {
            return chooseDateInput;
        public void chooseDateInput(ValueChangeEvent valueChangeEvent) {
          Date selectedDate = (Date)chooseDateInput.getValue();
        }Regards,
    Ryan

  • How to get SEO url in java

    Hi
    My requirement is to generate a product feed which has its product url as one of the fields.
    Now does anybody know how to get the SEO url of a product in a java file.
    I know form front end we generate it via ItemLinkDroplet.
    But is there a way i can generate it in my java class?
    Thanks

    Assuming you have used ATG SEO Repository and ATG DirectUrlTemplate and IndirectUrlTemplate etc..for SEO URL generation.
    Now, create a standalone jsp, example, seolinkbuilder.jsp.
    Let it take following parameters,
    productId
    categoryId
    brandId
    siteId
    and any other ids as needed by your application.
    Suppose you just needed SEO url for a given product id.
    /contextpath/seolinkbuilder.jsp?productId=12345
    The JSP would contain a droplet which would construct a SEO url and set it as oparam which can be written to JSP.
    Finally, from an independent JAVA program, using Apache HTTPClient API, call seolunkbuilder.jsp by passing productId. Read the response for SEO url.
    Let me know if you have further questions.

  • How to get applets running with Java Plug-in on Win but also on Mac OS X???

    I've converted to the use of Java Plug-in for my applets, but I need to have those same applets executable from browsers on Mac OS X platform. Surely this has been done, but I don't see how. The browsers I've tried on Mac OS X (Netscape, IE) don't seem to recognize the <OBJECT> tag used for the java plug-in. I've seen no news about the Java plug-in being ported to Macs. How can one get the same applet to run with the Java plug-in on Windows browsers, and also to run with at least one of the common browsers on Mac OS X? Any help would be SO much appreciated!

    Those ten dukes look good to me. But the passing of fifteen months has me thinking you've probably moved on. In any case, here's my effort.
    I've been through a trial trying to get my applet, developed with 1.4.1_03, to run on my Mac OS X v.10.2.6 in multiple browsers. I'm posting my results here. Comments and feedback are welcome.
    JVM support for 1.4.1 is limited to the Safari browser. All other browsers running in Mac OS X that I've tried ( Camino, Opera, Internet Explorer, Mozilla ) are using the 1.3.1 plugin. According to a bug report by Mozilla on this topic ( see Bugzilla Bug # 197813 http://bugzilla.mozilla.org/show_bug.cgi?id=197813 )
    with the release of Apple's version of Sun's Java 1.4.1 the applet programming model has changed, and only Safari has adapted with this change. Other browsers, according to the report, could not because of a lack of documentation. The use of the MRJCarbon plugin offered by Mozilla (here - http://www.mozilla.org/oji/MRJPluginCarbon.html) only allows Mozilla to use the J 1.3.1. And I have not found any information on the Microsoft site about how to get IE 5.2 to recognize the newer version of Java.
    Regarding the use of the OBJECT tag in Safari, it is a matter of debate. A current post on this topic exists in the Applet Development forum:
    http://forum.java.sun.com/thread.jsp?forum=421&thread=441002
    In my experience, I have not been able to determine that Safari v1.0 recognizes the OBJECT tag. My experience is that the APPLET tag is required to run applets in Safari. The Bugzilla report echoes the problem with the BadMagicNumber error that can arise in Safari. Nonetheless, I enjoy Safari and I enjoy Mac OS X.

  • How to get rid Print Dialog in Smartforms

    Hi,
    We are using ECC 6.0. I have the following code for calling smartforms:
    DATA: ltp_control_parameters TYPE ssfctrlop,
            ltp_output_options TYPE ssfcompop.
      ltp_control_parameters-no_dialog = 'X'.
      ltp_control_parameters-preview = 'X'.
      ltp_control_parameters-preview = 'LOCL'.
      ltp_output_options-tddest = 'LOCL'.
    The problem is that the print dialog appears and asking for output device. How to get rid this?
    thanks,
    sid

    hi all,
    thank you for replying. i got rid of the print dialog box by filling in defaults->spool control->output device in the user profile->own data. And i just set the following in my code:
      ltp_control_parameters-no_dialog = 'X'.
      ltp_control_parameters-preview = 'X'.
    And also previously i mistakenly reset ltp_control_parameters-preview to 'LOCL' (refer to my previous post).
    regards,
    sid

  • How i get hardware info with Java Applet

    Hello Everybody.
    first I am sorry for my english. This my first topic. I am a php developer and learning Java. I am developing a Java Applet.
    Can i get client hardware info with Java Applet
    Ýf i can How i do get hardware info with Java Applet.
    I need sample code or documentation.
    Thanx.

    TrojanMyth wrote:
    Hello;
    Can i get hardware info with Java ?? Have not a know people ?Applets are restricted, unless, as already noted, they are signed and accepted by the user. See
    http://java.sun.com/docs/books/tutorial/deployment/applet/security.html
    http://java.sun.com/docs/books/tutorial/deployment/applet/properties.html
    In general, since Java is designed to run on multiple operating systems and machine architectures it does not provide much access to the underlying hardware. As mentioned, you can access the os via methods in the java.lang.ProcessBuilder and Runtime classes.

Maybe you are looking for

  • CS3 'freezed' installation problem on Windows Vista Home Premium.

    Hi! I searched everywhere for answer that installation of my PS CS3 is freezed in moment on the screen. I installed Acrobat Reader, Dreamweaver cs3 only. Both in English language. I tried to uninstall, then install, using cs3clean, but it`s nothing c

  • Have .png images in indexed mode - how to edit?

    Hello - I have some images in indexed mode and my Photoshop CS 4 won't let me edit them - how can I get them out of indexed mode? here's a screenshot of my work area:

  • Cannot open colleague's files

    I installed InDesign CS6 today, but I still can't open my colleague's files.

  • JList TransferHandler Drag and Drop -- w/Autoscroll?

    Hi everyone, Just wondering if anyone has written a TransferHandler for a JList that permits drag and drop reordering, that will also autoscroll its parent JScrollPane if dragging to a boundary? Don't want to reinvent the wheel! Thanks. Alex

  • Why do you always have to hold onto MENU AND PAUSE??

    Every single problem takes menu and pause... but in the instruction everything that relates to a problem in the ipod is just simple answer not like go to your local apple store and return it becasue menu and pause things never seems to work...