Print button in JSP

Is it possible to create a PRINT button in JSP which will also "shrink-to-fit" the page too when printing?
i'm new to JSP as some people know... thank you

the system im making is for people with very small knowledge of computers and wouldnt know how to shrink to fit a page in print preview... so i want to create a button on the website which will do this for them

Similar Messages

  • Print Button on JSP page prints title,time etc

    Hi I have aprint Button on my jsp page which prints whatever I want selectively using the <style tags>
    <style type="text/css" media=print>
    .noprint { display: none}
    .noscreen { color: black }
    </style>
    <style type="text/css" media=screen>
    .noscreen { display: none}
    .noprint { color: blue }
    </style>
    <SCRIPT Language="Javascript">
    function printit(){
    window.print();
    </SCRIPT>
    My print Button calls the JavaScript and prints everything that does not have a class=noprint in it... When I print however it also prints on the page
    -The Title on the Left Top corner
    - Page 1 of 1 on RIGHT TOP
    - 2/13/03 on Left bottom
    - 4:06 thats the time on the RIGHT BOTTOM
    Is there anyway I can prevent it from printing this?

    These probably come from the browser. Check if your browser is configured to print these on every page that is printed. If so, you can turn these of from the browser's Page Setup dialog.

  • Can we add custom print button to crystal report launched using jsp

    Hi,
    I need to add a print icon in crystal report. My requirement states that I should not use the print button given in the taskbar of crystal report. Can this be done?
    Thanks

    Are you using Crystal Reports for Eclipse?  If so, there is a new version out that suports Excel exporting:
    /people/blair.wheadon/blog/2009/01/16/announcing-crystal-reports-for-eclipse-20

  • Cannot keep print button on toolbar

    Since upgrading firefox I cannot keep the print button the toolbar. I can open customize and pull the print icon button onto the toolbar but it is not there when I open a new session. Ii have to drag it again. How can I keep it in place. This just happens on one desktop. I run another desktop and a laptop without this problem
    Thanks

    Print the report where? On what printer? The server's printer?
    Java code runs on the server. You can't affect the client's computer from JSP.
    You can write javascript code which can call window.print() but that is working through the browser to display the print dialog box (as if the user selected file:print)

  • Print Dialog in JSP

    Dear All,
    This my problem. From JSP on clicking a Button , a Print Dialog Box has to appear. On Clicking Print it has to print a Dynamically Generated HTML Page. My Architecture Goes LIke this. Jsp --> Servlet --> In servlet a HTML is generated.
    When Clicking the Button in JSP, The page should not refresh again. It has to straight away display the Print Dialog Button. I can do this for displaying open-dialog box. now the requirement is to display the print dialog box.
    this is the snap shot code i used in servlet to open the html. But Now Requirement is to Open a Print Dialog Box Instead of Open Dialog Box.
    Can any one help me out in this regard.
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
    PrintWriter pw = response.getWriter();
    response.setContentType("text/html");
    response.setHeader("Content-disposition","attachment;filename=report.html");
    pw.print(generateHTMLContent());
    pw.close();
    Post reply here / mail me @ [email protected]

    If you don't mind restricting yourself to the newer browsers you can use the LINK tag to designate the servlet as an alternate html page that will be printed when a JavaScript function does a document.print.
    Here is a link that may help:
    http://www.htmlhelp.com/reference/html40/head/link.html
    I have used this for intranet applications where I knew that all users would be using IE 5+ but I don't have an example readily available.

  • Calling function by clicking a button in JSP?

    Can I call specific function (present in my JSP page) by clicking a button?
    Regards,
    sumit

    I am using TimerTask in my JSP page to print some message:
    <%
                      Timer timer = new Timer();
                      TimerTask monitorTimerTask = new Monitor();
                      timer.schedule(monitorTimerTask,1000,1000);
    %>
    <%!
         private class Monitor extends TimerTask{
              int i = 0;
              public void run(){
                       System.out.println("TimerTask ["+i+"]");
                       ++i;
    %>And to stop the TimerTask daemon, I created the following function:
    <%!
         public void stopTimerTask(){
              if(monitorTimerTask != null){
                   System.out.println("Stopping the Timer Task");
                   monitorTimerTask.cancel();
    %>Now, I am trying to call funtion "stopTimerTask()" by click of a button in JSP page. The function is being called BUT the daemon keeps on printing the text message to the console. It means the above function is not able to stop the TimerTask.
    What to do?
    Please help!
    Thanks,
    sumit

  • How to know  when it pushed browser print button

    Hi anyone knows how to get the print browser button event ?
    I mean I have a jsp and I want to know when then IE 5 print button is pushed.
    How to get the event?

    It's possible there's something in JavaScript you can do to catch the event, but I've never seen it done. There's no way to do this with JSP.
    Another possibility is to disable the print button in the browser and then make you're own (may only be able to do this with an applet, not sure) so you can get the callback.

  • Print from a jsp in linux

    Hi all,
    I've got a problem with a web application... :(
    I have deployed that application on a Tomcat 5 server, jre 1.4.2, the same version I used to build the war file.
    When I tested the application on a Windows Server everything was ok.
    the application list from a directory all tiff files present, display the one chosen by the user on the scrren. and, pushing the proper button, print the document.
    I used java.awt.print package in order to do this.
    well, when I run the application on linux I have
    java.awt.HeadlessException
         sun.print.PSPrinterJob.printDialog(PSPrinterJob.java:465)
    after I give thefilename to print to the printer class.
    the structure is:
    jsp page which contains the commands and the viewer area, in which I display the image (the src of the image is a displayingservlet).
    pushing the "print" button, the filename & path of the image displayed is given to the printTheDocument() method.
    my print class:
    import java.awt.Image;
    import java.awt.Toolkit;
    import java.awt.Component;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Color;
    import java.awt.BasicStroke;
    import java.awt.MediaTracker;
    import java.awt.HeadlessException;
    import java.awt.image.BufferedImage;
    import java.awt.image.RenderedImage;
    import java.awt.geom.Rectangle2D;
    import java.awt.print.PrinterJob;
    import java.awt.print.Book;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.io.IOException;
    import javax.media.jai.PlanarImage;
    import com.sun.media.jai.codec.SeekableStream;
    import com.sun.media.jai.codec.FileSeekableStream;
    import com.sun.media.jai.codec.ImageDecoder;
    import com.sun.media.jai.codec.ImageCodec;
    public class PrintDocument {
        public static final int POINTS=72;
        static String fileName="";
        /** Creates a new instance of PrintDocument */
        public void printTheDocument(String filename) {
            fileName=filename;
            int numPages=getNumberOfPages();
            PrinterJob pj=PrinterJob.getPrinterJob();
            Book book=new Book();
            PageFormat pf=new PageFormat();
            pf.setOrientation(PageFormat.PORTRAIT);
            book.append(new Document(),pf,numPages);
            pj.setPageable(book);
            if(pj.printDialog()){
                try{
                    pj.print();
                }catch(HeadlessException ex){ex.printStackTrace();}
                catch(PrinterException ex){ex.printStackTrace();}
        public int getNumberOfPages(){
            int numPages=0;
            try{
                SeekableStream ss=new FileSeekableStream(fileName);
                ImageDecoder id=ImageCodec.createImageDecoder("tiff",ss,null);
                numPages=id.getNumPages();
                ss.close();
            }catch(IOException ex){ex.printStackTrace();}
            return numPages;
        private class Document extends Component implements Printable{
            public int print(Graphics g,PageFormat pf,int page){
                Graphics2D g2=(Graphics2D)g;
                g2.translate(pf.getImageableX(),
                        pf.getImageableY());
                g2.setPaint(Color.BLACK);
                g2.setStroke(new BasicStroke(1));
                Rectangle2D.Double border=new Rectangle2D.Double(
                        0,0,pf.getImageableWidth(),
                        pf.getImageableHeight());
                g2.draw(border);
                MediaTracker mt=new MediaTracker(this);
                String imageURL=fileName;
                try{
                    SeekableStream ss=new FileSeekableStream(imageURL);
                    ImageDecoder decoder=ImageCodec.createImageDecoder("tiff",ss,null);
                    int number=decoder.getNumPages();
                    RenderedImage[] image=new RenderedImage[number];
                    for(int i=0;i<number;i++){
                        image=decoder.decodeAsRenderedImage(i);
    PlanarImage image2=PlanarImage.wrapRenderedImage(image[page]);
    BufferedImage image3=image2.getAsBufferedImage();
    mt.addImage(image3,0);
    try{
    mt.waitForID(0);
    }catch(InterruptedException ex){ex.printStackTrace();}
    g2.drawImage(image3,
    (int)(0.25 * POINTS),
    (int)(0.25 * POINTS),
    (int)(6 * POINTS),
    (int)(8.5 * POINTS),
    this);
    ss.close();
    }catch(IOException ex){ex.printStackTrace();}
    return (Printable.PAGE_EXISTS);
    in windows it works properly.
    any idea???
    thanks, Camilla

    You need to set CATALINA_OPTS -Djava.awt.headless= true in your setenv.sh
    Cheers,
    Shravana.

  • Print button on WAD template

    Hi,
    Presently we are in BW 3.5 version with support pack 22. We enhanced the html code based on ' How to ... Web printing with MS Excel' document. We imported the transport file which contains package and ABAP Classes.
    After click on the print button on Web report, it was giving the same result area in the same page instead of giving the excel open or save options.
    How to debug the enhanced html code in the WAD template? How to check the ABAP class('ZCL_RSR_XLS_HELP_WINDOW_PRINT') which i used in the
    code?
    Or is there any way to print the result area of Web report?
    Please help me.
    Thanks in advance.

    This question has been answered

  • The Add Printer button on the eprintcenter website on my screen is not working.

    I just registerd on the eprintcenter.com site and now I am trying to click on the +Add Printer button/icon to add my printer and it is not working. I have tried it in all different web browsers and it doesn't take me anywhere on any of the browsers. Sometimes I get the "javascript&colon;void(0)" message down in the left hand bottom portion of my screen when my mouse goes over that button. What is wrong? Is it your site or my computer?

    I'm having same problem

  • Creating a print button to call a Report Query and pass filters

    If i use the REPORT QUERY option in APEX 4 to create an statement that is the same one used in an interactive report, can I create a link or button to the REPORT QUERY and pass all the session and filter information from the interactive report to the report query?
    This way I can have the interactive report screen where the user can do all sorts of modifications and such and then pass those to the REPORT QUERY so I can call that from a custom link or button.
    You may ask "why does he need another print button?"
    Answer: I am using a view that has some embedded HTML tags to format the output really nicely. The HTML download version created by the interactive reports works beautifully. The customer also wants a PDF version (meh) which does not render the HTML tags and actually echos them as part of the text. I found that I can create another view that uses the CHR function to create all the breaks and such I was doing with HTML and these do render properly in PDF. So, I figured just have 2 reports: 1 Interactive and 1 using a REPORT QUERY. I just want to call the REPORT QUERY version but use the Interactive Search form to set all the parameters.
    Or, am I over thinking this and there is an easier method?
    I made a previous post where I showed how I got the APEX printing to work and i hoped that helped someone out - fixing this issue would put the whole thing to rest.
    Thanks

    Is BI Publisher desktop (MS Word add-in) a possibility? This would allow you to use MS Word to create your output template (RTF) that would result in a properly formatted PDF. Of course, you'd have to right an updated version of the query without HTML embedded. Just thinking outside of the box.

  • Print Button Derived From a Select List Is Not Working

    Hello,
    I followed the instructions "Creating a PDF Report from Derived Output Format" http://www.oracle.com/technology/obe/apex/apex31nf/apex31rpt.htm#t2
    Steps
    In order to derive the output format, you need to create an item that contains the list of formats to select from. Perform the following steps:
    1. Under Items, click the Create icon.
    2. Click Select List.
    3. Make sure Select List is selected for Select List Control Type and click Next.
    4. Change the Name to P<#>OUTPUTLIST and click Next.
    5. You need to specify the list of output types for the report and the bottom of the page. Select the Create or edit static List of Values
    6. Enter the following values and click Apply.
    Display Value Return Value
    PDF PDF
    Word RTF
    Excel XLS
    HTML HTM
    XML XML
    7. Select No for Display Null Option and Click Next.
    8. Change the Label to Output Format and click Next.
    9. Enter PDF for the Default and click Create Item.
    10. Now that the list of output formats is created, you need to change the Output Format when the Print link is selected. Under Regions, select the Print link.
    11. Under Printing, select Derive from Item for Output Format and select the item you just created P<#>OUTPUTLIST for Item and click Apply Changes.
    12. Click Run Page.
    13. When the report is displayed, select Excel from the list of Output Formats. Note: In Oracle Application Express 3.1, the XML format was added
    14. At the bottom of the report, select the Print link.
    15. A window appears asking you which program you want to open the Excel file with. Click OK (or Open depending on what browser you have) . Excel is open and the report is displayed. Close the Excel window.
    16. You can also create a button to produce the report based on the output format rather than clicking the Print link at the bottom of the report. Click Edit Page.
    17. Under Buttons, click the Create icon.
    18. Accept the default and click Next
    19. Select Create a button displayed among this region's items and click Next
    20. Enter P<#>_Print for the Button Name, enter Print for the Label and Request and select HTML Button for Button Style. Then click Create Button
    21. The region printing link contains the id of the region. Since you want to invoke the print from a button instead of the link you need to create a branch and specify the FLOW_XMLP_OUTPUT_R### parameter in the Request field for the Action so the application knows what to do when the Print button is pressed. Under Regions, select the Print link.
    22. Ctrl-C the FLOW_XMLP_OUTPUT_R### section of the Print URL field. Since you are going to invoke the print from the button, you can remove the Print in the Label Link field and click Apply Changes.
    23. Under Branches, select the Create icon.
    24. Accept the default and click Next
    25. Enter the current page for the Page and paste the FLOW_XMLP_OUTPUT_R### parameter that you copied into the Request field and click Next.
    26. Select P<#>_PRINT for When Button Pressed and click Create Branch
    27. Click Run Page
    28. Select XML for the Output Format and click Print.
    If I use the link at the bottom of the report region when I set the print options on the print tab of a report, it will print out in both pdf and rtf formats. I get an error with the Excel format. The print button isn't even working. When I select the button, nothing happens.
    Any help is appreciated.

    Hello Andy,
    I ended up putting in a ticket with Metalink. It is a known bug it seems. This is what the rep said:
    UPDATE
    =======
    These bugs are fixed in the next ApEx patch 3.1.2. Patch 3.1.2 is expected (tentatively) in 2 weeks at the
    earliest.
    The bug fixes for these bugs have been backported to 3.1.1 and the one-off patches (patch 7202883 & 7156139) can be downloaded from metalink. One-of
    f patches do not undergo the normal full regression testing, as is done for the
    full APEX 3.1.2 patch set.
    Once 7202883 and 7156139 were applied, I was able to download in all formats.
    Kelly

  • Print button on Web report.

    Hi gurus,
    We were trying to add a print button on Web report for printing the result area on the Web report.
    We followed the steps which has given in the How-to-guide How To Web Printing with Microsoft
    Excel document.
    In the document it has mentioned that
    1. Support package should be above 19 for BW 3.5 version
    2. Add HTML code in the WAD Template
    3. Import Transport file into the System.
    4. Apply OSS notes 736568 and 737082 to BW
    We upgraded the support package to 22, added the html code in the WAD template, imported the transport file into the BW system and applied the OSS notes as per the mentioned in the document.
    The transport file contains the Package u201CZPK_WEB_PRINTING_WITH_EXCELu201D and ABAP Classes u201CZCL_RSR_XLS_GRIDu201D,
    u201CZCL_RSR_XLS_HELP_WINDOW_PRINTu201D,
    u201CZCL_RSR_XLS_ITEM_CONDITIONu201D,
    u201CZCL_RSR_XLS_ITEM_EXCEPTIONu201D,
    u201CZCL_RSR_XLS_ITEM_GRIDu201D,
    u201CZCL_RSR_XLS_ITEM_TEMPLATEu201D,
    u201CZCL_RSR_XLS_ITEM_TEXT_ELEMENTSu201D,
    u201CZCL_RSR_XLS_TABLEu201D
    After import the transport file into BW, some of the objects in the ABAP Classes were not activated. I was trying to activate manually but those were not activating.
    Please guide me how to resolve the above issue or is there any way to get the printing the web report?
    Thanks in advance.
    Venkata.

    Hi
    If you want to print the web page directly then you can define a button using Java script and you can do it.
    Define java script code to print the page
    for ex define a button and call function for print.
    i cannot attach the code. but you can solve with java script
    Regards
    M.A
    Edited by: M.A on Jul 24, 2008 4:22 PM

  • Print presentasion without Print button on printout

    We want print presentation and eliminate Pint button from printout.
    We tried many ways:
    1) We put in presentation initialization method a statement setVisible: false and print.this. Unfortunately a button still visible on printout.
    2) We wrote a new method for a Print button: setVisible:false, print.this. Again a button is visible in the printout.
    3) We make a presentation without buttons at all and tried to put print statement in initialization method. Now we lose a control of the buttons and cannot terminate a presentation.
    4) We make a presentation without buttons at all and tried to put print statement in initialization method and immediately cancel a presentation with submit(). Again we lose a control of the presentation.
    May be some of you can give us a helping hand.
    Thanks in advance.
    Igor

    If you got any update please send it to me.
    my email id is [email protected]
    Thanks,
    Brijesh Kumar Singh

  • Using the print button to print then close a document

    I use Live Cycle Designer to create my Adobe documents.  I am working on a kiosk project and one of the menus navigates to a document page that has PDF documents and forms for users to print out.  The way the kiosk is designed, I would like for my pdf file to close after the print button is selected.  I recieved a solution in the general Adobe forum, but later found out the script does not work if the document was made using Live Cycle.  Any suggestions???  Is it possible??? Thanks.

    Open your PDF file in adobe livecycle designer, select print button on PDF.
    Go to windows(in adobe designer menu bar) and select Script Editor - In Show dropdown list select postPrint event and copy paste the code below-
    app.execMenuItem("Close");
    Regards-
    Chalukya.

Maybe you are looking for

  • Business Components Exception

    Hi, Version: JDeveloper 10.1.3.3 Problem: Trying to "Apply" changes to a Data Model component. Expected Behaviour: Views added or removed from a Data Model module should be accepted and saved. Actual Behaviour: Dialog appears with the following error

  • IPhone Backup Corrupt

    Hey guys, I am having a backup/restore NIGHTMARE right now. I have a 16gb iPhone 4s and the original backup was done in iTunes10 on Windows Vista. Since then I have updated to iTunes 11 hoping that would help. Here is what I have done so far step by

  • Aperture and Photoshop

    I am trying to get up and running with Aperture. But I am perplexed at how to put photoshop in my workflow and to have aperture keep track of my versions of images that are processed in PS and "saved as" .jpegs, or websized resolutions etc. Also, whe

  • MacBook Pro Chargers

    I was searching for mac book pro chargers and some say on the side "Replacement Ac Adapter."  Does this mean anything?  Will it still work?

  • HT4623 Je ne peux plus synchroniser mon Iphone 4 depuis une restauration

    J'ai un Iphone 4 et depuis que je l'ai restauré , je ne peux plus le synchroniser avec I tunes.J'ai fait les recommandations d'Apple c.a.d. de désinstaller I tunes et ses composantes et de le ré-installer. J'ai vérifié mes fils de connection USB et I