Best Print implementation in jsp when javascript fails ............

Hello !!!
I have a requirement where <iframe> html tag is used. So just with window.print() of javascript, print request doesn't work properly. So could you please suggest me another approach probably using SUN technology with which I can have much flexible implementation i.e. where I can customize the page setup before print.
Thanks,
S PAUL

Printing a webpage has absolutely nothing to do with java: its purely javascript and CSS related. If window.print() can't do what you want then you're stuck.
A lot of websites have a "printable view" link or button which shows the same page only printer friendly. Maybe you could do something like that?

Similar Messages

  • I have a new MacBook Pro, and when I try to print, the laptop says, "stopped filter failed 1 page". What can I do?

    I have a new MacBook Pro, and when I try to print, the laptop says, "stopped filter failed 1 page". What can I do?

    Okay, regarding this problem:
    I'm trying to print to an Advent AW10 printer from an Imac running Yosemite 10.10.1 and it's been driving me nuts for the last two months...
    I got on to Advent yesterday and recieved this instruction from their support team this morning and it worked and I'm now printing away merrily:
    Please follow below steps:
    In Spotlight search window type Terminal and then press Enter.
    This should bring up the terminal window/program.
    In the Terminal type:
    sudo sh -c 'echo "Sandboxing Relaxed" >> /etc/cups/cups-files.conf' then press Enter.
    It will ask for your password. Please enter system password.(You will not see password entering)
    After that type following:
    sudo launchctl stop org.cups.cupsd then press Enter.
    Try Printing.
    I don't think this is specific to Advent and is rather simply an 'opening up' of something blocking the 'printer channels' (layman's terms obviously)
    Hope this helps people out!

  • HELP -- javascript failing when enabled

    A few days after upgrading to 10.4.9:
    Safari hangs and then crashes on any site using javacript such as the New York Times. If I disable javascript, then such pages will load. Of course, many pages, such as Fidelity, will not work.
    Hoping to get a new load of javascript, i download and installed Safari 3 beta. It behaves the same way.
    So -- when javascript is screwing-up -- how can it be fixed?
    I downloaded the newest javascript and it claims it can't be installed.
    This exact same problem many others are reporting.
    Message was edited by: Steve Mullen

    Solved. Not java at all. Although I did learn a lot about java by replacing everything.
    Seems CS3 loads a flash plug-in that conflicts with one that was previously installed. I deleted the old one and kept the one that came with CS3.

  • How to write printing function using JSP?

    dear all,
    i want to add a printing function in my project but i do not know how to do it? could anyone teach me how to do it?
    thanks
    eric

    salut eric,
    you can do it this way :
    1 - create a html link in your code to this javascript
    function : (I am using Struts, but you can write it in
    pure html
    <html:link href="#bodyStart"
    onclick="openWindowForPrinting()"
    titleKey="msg.status.print">      <bean:message
    key='app.print' />
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html:link>
    >
    >
    2 - here is the javascript function : it open a window
    with the "print.jsp" page.
    function openWindowForPrinting(){
    window.open('/your_project/pages/common/print.jsp','',
    'left=150, top=150 , status=no, directories=no,
    toolbar=no, menubar=yes, location=no, scrollbars=yes,
    resizable=yes, dependant=yes');
    3 : here is the print.jsp page : You have only to
    create a session variable called
    "currentBodyRelativeLocation", which content the
    relative URL to the page you want to print (for
    example, the boby of the current page).
    <%@ taglib uri='/WEB-INF/tlds/perso.tld'
    prefix='perso' %>
    <html>
    <head>
    <perso:csslink page='${cssRelativeLocation}' />
    </head>
    <body onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; printPage();; window.open = SymTmpWinOpen;">
    <body>
    <jsp:include page="${currentBodyRelativeLocation}"/>
    </body>
    <script language="JavaScript">
    <!--
    window.open = SymRealWinOpen;
    //-->
    </script>
    </html>
    <script language='javascript'>
    function printPage(){
    window.print();
    window.close();
    </script>
    hai,
    i'm not very understand how is your code work. when i write html code, do i need to mind about this code: "msg.status.print" ? what is this code mean?
    i have too much question on this thing. would you mind to be further explain to me? or is it any reference for me to refer? i'm really new to write printing function on JSP.
    i never write this function before. i'm feel so lost.....:(
    thanks again
    eric

  • Printing recipt using jsp

    hi everybody, Happy easter
    i want to print a recipt using jsp.
    i tried using JavaScript but it is printing a full page.
    plz help me.
    thanks in advance

    Printing through the web is very limited. The only way to do it is through window.print(). There are a few ways to control the printed output however:
    - "printer friendly" link. When the user clicks this link you create a page with only the information that needs to be printed.
    - using CSS you can control the printer output.
    http://www.meyerweb.com/eric/articles/webrev/200001.html

  • Best way to design jsp/template structure

    I am trying to create one page comprising of multiple pages without using frames.
    My thought was to create a template.jsp, which has the following includes:
    <jsp:include page="<%=header%>"></jsp:include>
    <jsp:include page="<%=menu%>"></jsp:include>
    <jsp:include page="<%=content%>"></jsp:include>
    <jsp:include page="<%=footer%>"></jsp:include>Here is an example of the question that arises...
    In the HTML code of the 'menu' included page, I have a link to some other page (ex. 'abc.jsp' )
    When clicking on this link, I would like to call the template.jsp with 'abc.jsp' being inserted where the 'content' tag is.
    So, what is the best way to do this without frames?
    Do I have every link call a controller servlet which stores the links in a request. Then the controller servlet calls the template.jsp with the link as a request parameter?
    Is there a built in function in JSP that does this w/o any extra code?
    Any other suggestions/practices that are more common or easier to implement?
    Also, Is there major overhead on including 4 pages each call? Or after it compiles with the included page, the overhead is negligable, until a new page is swapped in place of an existing included page?
    Thank you

    A thought:
    <%
    String content = request.getParameter("content");
    %>
    <jsp:include page="<%=header%>"></jsp:include>
    <jsp:include page="<%=menu%>"></jsp:include>
    <jsp:include page="<%=content%>"></jsp:include>
    <jsp:include page="<%=footer%>"></jsp:include>
    Once everything is compiled, the overhead is in executing the pages. If you pass in a page that hasn't been compiled yet, obviously that would have to be compiled. I haven't tried dynamic includes like that - does it work?

  • Print PDFs from Dreamweaver using Javascript

    I need to print several PDF'S from a coldfusion application.
    I understand that you can use Javascript if you need to print
    several pdfs in sequence. Do you know of a script that will
    print several documents ?

    When you select print from the menu bar a print
    window opens. Verify that the correct printer is
    selected. Adobe will over ride some defaults and put
    in itself. Let me know if this didn't work.
    Thanks Glynn, but the correct printer is indeed selected. This is a weird one!
    FWIW, here is my CUPS error log:
    ===== Wednesday, June 20, 2007 3:51:51 PM US/Eastern =====
    I [20/Jun/2007:15:52:20 -0400] Adding start banner page "none" to job 10.
    I [20/Jun/2007:15:52:20 -0400] Adding end banner page "none" to job 10.
    I [20/Jun/2007:15:52:20 -0400] Job 10 queued on 'MFC_9420CN' by 'dave'.
    I [20/Jun/2007:15:52:20 -0400] Started filter /usr/libexec/cups/filter/pictwpstops (PID 625) for job 10.
    I [20/Jun/2007:15:52:20 -0400] Started filter /usr/libexec/cups/filter/pstocupsraster (PID 626) for job 10.
    I [20/Jun/2007:15:52:20 -0400] Started filter /Library/Printers/Brother/Filter/rastertobrotherSL4C (PID 627) for job 10.
    I [20/Jun/2007:15:52:20 -0400] Started backend /usr/libexec/cups/backend/usb (PID 628) for job 10.
    E [20/Jun/2007:15:52:22 -0400] [Job 10] pstopdffilter/pstocupsraster failed with err number -31000
    E [20/Jun/2007:15:52:22 -0400] PID 627 stopped with status 1!
    I [20/Jun/2007:15:52:22 -0400] Hint: Try setting the LogLevel to "debug" to find out more.
    E [20/Jun/2007:15:52:22 -0400] PID 625 stopped with status 1!
    I [20/Jun/2007:15:52:22 -0400] Hint: Try setting the LogLevel to "debug" to find out more.
    E [20/Jun/2007:15:52:22 -0400] [Job 10] Opening raster file failed!
    E [20/Jun/2007:15:52:22 -0400] [Job 10] error drawing page 1
    E [20/Jun/2007:15:52:22 -0400] [Job 10] pictwpstops - got an error disposing of document = -9783
    E [20/Jun/2007:15:52:22 -0400] PID 626 stopped with status 1!
    I [20/Jun/2007:15:52:22 -0400] Hint: Try setting the LogLevel to "debug" to find out more.

  • Why is Javascript failing on larger Http requests?

    I am developing a web page for mobile use. I am encountering problems while testing on a BB 8900 Edge v5.0.0.822
    When the web page size is larger than 20KB (approx) all javascript on the page stops working. If I remove some content (any content) and bring the size below that amount, the javascript starts working again. This same page works fine all the time on 3 other BB models.
    Javascript is enabled and working fine on other pages (and this page when I remove content). There is no downloading of photos or files involved.
    Can anyone explain what the problem is here and how to get larger web pages to display.
    Even the most basic javascript fails, such as a static alert('hello'); within script tags.

    in case anyone else is curious about this. My best guess so far is that this relates to http://www.w3.org/TR/mobile-bp/#ddc which explains that a mobile site's 'Default Delivery Context' is meant to have a "Maximum Total Page Weight  20 kilobytes". But since most current mobile browsers are allowing larger pages, I am hoping there's a workaround for this for Blackberry. Any suggestions?

  • Printing a PDF via Acrobat Javascript

    Hi -
    I have a need to print a PDF programmatically, via Javascript.  The PDF is embedded in a Web page.  I use postMessage to communicate with the PDF.
    I've created a simple HTML page with an embedded PDF, and a Javascript link to call my "Print" function. Here's a code snippet:
    <body>
             <a href="javascript:doPrint();">Print</a>
             <object id="PDFObj" data="testPDF.pdf" type="application/pdf" width="400" height="400" />     
    </body>
    In the HTML document's HEAD, I've added the following Javascript which posts the message to the PDF:
    <script language="JavaScript">
            function doPrint() {
                pdfObject = document.getElementById("PDFObj");
                alert("Hello from Javascript...");
                pdfObject.postMessage(["Print", "Print"]);
    </script>
    Finally, I've added an Acrobat Javascript function in the PDF document to listen for the postMessage event:
    function myOnMessage(aMessage)
        app.alert("Hello from the PDF");
           // print routines here
    var msgHandlerObject = new Object();
    msgHandlerObject.onMessage = myOnMessage;
    msgHandlerObject.onError = myOnError;
    msgHandlerObject.onDisclose = myOnDisclose;
    function myOnDisclose(cURL,cDocumentURL)
    return true;
    function myOnError(error, aMessage)
    app.alert(error);
    this.hostContainer.messageHandler = msgHandlerObject;
    Here's my problem: when I test this code and click the HREF Javascript link, I see "Hello from Javascript..." and "Hello from the PDF," so I know the postMessage event is working.  However, I've tried every print command I know in the myOnMessage function, and nothing seems to work:
    app.execMenuItem("Print"); // doesn't seem to work
    this.print(); // doesn't seem to work, even when I pass in all the params, etc
    I've also tried getting print params and passing those in, nothing seems to work.  Am I missing something?  Environement is Acrobat 9 Pro, browser's tested include Chrome 2.0, IE6.  I've attached two files, the HTML bit and the PDF I'm trying to print.  Any help is greatly appreciated!

    You have to be careful when using the ActiveX control to communicate with system functions like printing.  Because it can be embedded in anything that supports ActiveX, some functionality is limited from being called from JavaScript as it may interfere with the host application.
    Check out the IAC API Reference (also included with the SDK) and the methods under AxAcroPDFLib.AxAcroPDF.  There are some print functions in there (like PrintAll) that you can call on the ActiveX control directly, as in from your doPrint() method in your HTML page without using the hostContainer.  You would basically just call:
    pdfObject = document.getElementById("PDFObj");
    pdfObject.PrintAll();
    These methods were designed specifically to work with the ActiveX control when embedded in a host application, and can be used to print a PDF embedded in a web page.

  • Pre-Size Your PPI for Best Print - Once Good Advice Still Good?

    In another thread someone mentinoed pre-sizing image data to prepare it for best printing.
    For a long time it's been "standard advice" to resize images so that the ppi is an even division of the printer's dpi, because some years ago occasionally one would run across printers that would produce poor results if you didn't - you might see jaggies in straight edges for example.
    Thing is, computers have (not so) quietly been getting more powerful over time, and printer makers have been competing with one another to try to make their printers produce better results than the other guys.  One way they've done this is by improving the quality of the algorithms in the printer drivers.  Use of mega storage and high accuracy math, which was once taxing on older computer systems, is now standard practice.
    So it's time to question the old rule of thumb.
    Making a few assumptions about the many variables (what printer, what OS, what version of drivers, what application being used to print) , there seem to be several questions here:
    1.  Can the image resolution be too high, causing the printer driver to make bad decisions about what ink dots to lay down where on the paper?
    2.  Does it help or matter if the image PPI is an even division of the printer's DPI?
    As I have done in the past, I set out to do some actual testing, to see if I can actually SEE anything to help answer these questions.
    I created a sharp image to be printed at 3 x 2 inches:  http://Noel.ProDigitalSoftware.com/ForumPosts/Ghirardelli.jpg
    Then I printed it at 6 different resolutions (1000, 720, 567, 300, 200, and 100 ppi) by resampling the image, labeling it, printing from Photoshop CS5, and feeding the same sheet of HP Premium Plus photo paper through my older HP 932c inkjet printer 6 times.  The printer was set to its highest quality settings, including 2400 x 1200 dpi mode.  This was the result:
    I then looked critically and as objectively as I could at the different images.  Here are my observations:
    Naked eye:
    The four highest resolution images (1000, 720, 567, and 300 ppi) all seemed to have an equivalent high level of crisp detail.
    I could not detect the inkjet dots.  Smooth objects look smooth.
    Jeweler's Loupe:
    I could see significant reduction in the finest details in the 300 ppi print vs. the three higher resolution prints, and a slight reduction in the 567 ppi vs. 720.
    At no resolution were any jaggies or evidence of aliasing visible.
    The inkjet dot pattern was plainly visible, and it does differ between the different prints.  But it was not possible to say whether one was "better".
    Things seem to have a little more texture in the 1000 ppi print vs. the 720 and 567 ppi prints.
    Macro Photo:
    Lacking a high resolution scanner, I took photographs of the 6 different prints.  Unfortunately, I didn't have the time to set up with my best lighting and lens combination, so I got some reflections off the glossy paper, and and at this resolution I can't really see the inkject dots in the photos.  I want to repeat this when I can find more time to do it better.  As I did these photos hand-held, I believe the variances between them could be slightly influencing the results.  But I'm going to post them anyway, for you to see.
    I could see ever so slightly more detail in the 720 ppi print vs. the 1000 ppi print, though from the size of the tiny dust/light reflections I think it may have just been the better focused.  Note that this observation is not supported by direct observation through the jeweler's loupe, above.
    The 1000 ppi and 567 ppi prints seems to have slightly more noise or texture than the 720 ppi print.  Again, this might be issues introduced by the photography process, though I did note a possible increase in texture in the 1000 ppi print with the jeweler's loupe as well.
    Beyond just the blurring, I could see some evidence that straight lines are not quite as straight in the lower resolutions (300 ppi and lower).  This seemed more apparent than with the jeweler's loupe examination, and I wonder whether the Photoshop downsampling process could have introduced it.
    Left to right, top to bottom:  1000, 720, 567, 300, 200, 100:
    Conclusions:
    Printing to my HP 932c inkject printer on Windows 7 x64
    300 ppi is not sufficient to coax the best possible detail out of an inkjet printer.  It appears a number in the vicinity of 720 or more is better, and this number could be much higher with modern very high resolution printers (mine's old). 
    Speed was no different in printing any of these - a modern computer can process a huge amount of data in the blink of an eye.
    When a sufficiently high resolution image is printed (in this case 567 ppi or higher) I saw virtually no evidence that a particular ppi value is superior, for example an even division of the printer's dpi, though in hindsight I realize I should have prepared a 600 ppi image (duh).  I will add a 600 ppi image before I re-photograph the results.
    It's possible ever so slightly more texture becomes visible at 1000 ppi than 720 ppi, but it might be just noise.
    Practically speaking, from looking critically at the results I could not see a reason to pre-size the image for a specific ppi value.
    I encourage you to experiment and report your results with your particular combination of gear.
    Your comments are welcome!
    -Noel

    Noel Carboni wrote:
    Jeff Schewe wrote:
    I would never suggest people actually downsample though...why waste the pixels?
    Exactly.  There was a statement in another recent thread that downsampling to be an even fraction of the print dpi was important to do.
    It might have been a misapplied extension of the advice to upsample.  It's not been all that long that we've had big enough high resolution data that even makes downsampling a possibility.
    -Noel
    I believe I was the one to make that statement, which was based on recommendations by an Epson Print expert at a seminar demoing printers. He showed to prints from the same file, one set at an even multiple of 720 and the other some random number. It was subtle but visible the difference. That was probably 5 years ago.
    In the meantime, I have made extensive tests of prints on my Epson 3800 trying many combinations of single pass, hi speed, Super fine print (2880x1440) and down to the basic level.
    Everything evened out at 720 dpi. At 360, which is where I output from ACR, I can make an 8x12 print with no resampling whatsoever. Upping that to 720 and pushing the printer hard (2880x1440, single pass on Canson Platine), I see a discernable difference in the smooth tonalities.
    As I understood you from past conversations, you employ the maximum output size from ACR which in my case, would double the file size by upsampling, and if necessary, downsample from that. I am not comfortable doing that as a default operation, but perhaps Jeff S might step in here and clarify.  After all, ACR does offer that option! But my file size now goes from ~70MP to 143 MP, cutting my storage capability by 1/2. It's not a trivial matter when two of us here can run 600 to 800 images in 1/2 day!

  • 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

  • How to realize print function in JSP

    How to realize print function in JSP? I know use Javascript:window.print() can print,but it will print whole page,it don't fit me;Another method is to write JSP into Excel and then print it in Excel,but it don't fit me too,because it don't print directly. Anybody know how to print it directly?

    Many websites offer a "printer friendly" version of a certain page. That IMO is the only way to solve your problem, next to using CSS to use a different style for printer output. Here is a tutorial that covers this:
    http://www.alistapart.com/stories/goingtoprint/

  • Set jsp from javascript

    I have three "div" tags in index.jsp ,
    <div id='header'></div>
    <div id='body'></div>
    <div id='footer'></div>
    Now when window is loaded i want other jsp page to be set in the "body" div tag of index.jsp from javascript
    My javascript code
    function invokeJSP(){
    document.getElementById('body').innerHTML="<jsp:include page='test.jsp'>'";
    when I am including this code in <head > part of index.jsp its working the problem is if at all
    In test.jsp
    if i try to include this line
    <% = request.getParameter("name")%>
    its giving an error like "unterminated literal string" in javascript console
    Can anyone help me how to set the jsp from javascript
    Sorry for my bad english.This is the first time I am posting the forum
    thanks
    hema

    hi
    Thanks for the response
    but i have closed the tag in my program. Have u ever tried to invoke jsp from javascript in this way if it works plz help me.
    thanks hema

  • Printing colors not correct when using  non printer software

    I am using a new CANON MX882. When I print using the Canon easy photo software the print turn out perfect. However when I print from Aperture or Photoshop Elements the pictures turn out with the colors blown out and overexposed. I have the lates drivers availabe from Canon which they say is compatible works with 10.7. I have tried using the printer manament or the software and it doesn't make any difference. Any thoughts on whats next? I am wasting all sorts of paper trying to figure this out.
    thanks
    Chris

    I don't have Aperture or PSE but I do have Photoshop CS5 and with that application the best settings are to let the printer manage the colours. I have some grabs from the PS5 print dialog for your reference.
    From the PS5 print dialog, from the Color Management menu the Color Handling is set to "Printer Manages Color".
    When you select Print and the normal print dialog appears (or you open Print Settings from the PS5 print dialog) select the Color Matching menu and ensure it is set to Canon Color Matching.
    And the last thing to check is the Quality & Matching menu for the Canon printer. The colour profiles for the printer are based on different paper stocks. So it is important that in the Media Type menu you select the type of paper being used and you also want to select High Quality.

  • Generating error page(in jsp) when session expires....

    hello,
    i want to generate error page(in jsp) when session get expires...
    plz help me out.............

    You could do it according to the line BalusC supplied in another topic:
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=login.jsp">The only thing you gotta change, is the URL, make it:
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=error.jsp">Create 'error.jsp' and have the message 'Session expired, sorry!' or something printed. If you want to use error.jsp for more than just the session expiration, add a parameter to it:
    <meta http-equiv="refresh" content="<%= session.getMaxInactiveInterval() %>;url=error.jsp?error=sessionexpired"> Place the following lines in your error.jsp:
    String errormessage = request.getParameter("error");
    if(errormessage.equals("sessionexpired")){
    out.println("Your session has expired, sorry!");
    }else if(errormessage.equals("whatever")){
    // To do code here.
    }

Maybe you are looking for

  • Third party sales related question

    I am trying to analyze my client SAP system and came across a scenario like this. 1) A 3rd party sales order is created without any subsequent documents like Purchase order etc as in a standard 3rd party flow. A new sales document type (for example Z

  • Why is this happening? This version of iTunes has not been correctly localized for this language. Please run the English version.

    This version of iTunes has not been correctly localized for this language. Please run the English version. have verified and repaired permissions. all downloads are giving me either invalid checksum or "image file corrupted" every other coputer on th

  • MouseEvent on non-editable JTextArea

    Hi folks, I try to add a cut&paste popup menu to JTextArea. What I am doing is to add a mouseListener to it. The problem is that when the JTextArea is non-editable, i.e. setEditable(false), the right mouse click event cannot be trapped and thus the p

  • I had this notification said that i have to turn off my macbook

    thi is the report... Interval Since Last Panic Report:  3092791 sec Panics Since Last Report:          1 Anonymous UUID:                    BD27A925-AB1C-44EE-83B7-7A0808385E84 Fri Jul 19 05:29:21 2013 panic(cpu 0 caller 0x28fc2e): "TLB invalidation

  • Student Discount is gone

    I had student discount, but back in May I started getting charged $10 a month.  When I try to resign up for the student discount, it says that it's unavailable for my account at this time.  What do I need to do to get my student discount back? And is