Printing document in jsp

Hello,
I'm developing a web app which deals with invoices, delivery notes and that sort
of things and i need to print the documents i create and show in the screen but
just a part of the jsp page as i don't want the menu of the app to appear in the
document to be printed. what can i do to print just a part of the jsp?
so i have to send the information to pdf? what do u recommend?
Thanks for your help

You could implement a "printer friendly" version of your invoices which opens in a popup and then you can use window.print() to initiate the print dialog. This way you don't have to put any HTML controls on the page to be printed. You should advise users to turn off any headers in the browser which will also get printed, such as filename and pagenumber, this cannot be disabled automatically.

Similar Messages

  • Printing document from jsp

    Hi All,
    I am trying to print a document(For example .doc file) from local system using JSP/Servlet. Please note that I dont want to print the current window and I dont want to use applet also. My requirement is that I have to use only JSP/Servlet or javascript for printing the document at client system.
    Please help me with how to do this. Thanks in advance.
    Regards
    Utpal

    That´s not possible. It´s up to the application in which the client is opening the doc file. Which is usually MS Word. That application (un?)fortunately doesn´t understand HTML/Javascript.
    If you have a hard head in this, then you need to create a Java application which does the desired task at the local machine and then embed it as an applet or webstart application in your JSP page. Which is fairly cumbersome imho. Not worth the effort.

  • Prolem with usage of Document in jsp

    Hi Ppl,
    Following is a part of my code in jsp..
    <%
    try{
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    String filename = "D:\\integral\\1.0\\Resources\\ApacheTomcat4.0\\webapps\\examples\\jsp\\cal\\input1.xml";
    Document doc = factory.newDocumentBuilder().parse(new File(filename));
    out.println(doc);
    %>
    The problem is doc is getting null after this expression. The file is present in that location. I have imported org.w3c.dom.* as well. Is there any other configuration required...
    Thanks in advance.
    -- Ashish

    Hi,
    After executing your code I get the following output:
    [#document: null]
    I guess it does not mean that document object is null because when I
    add the following statement to your code it gives the expected output.
    Element element = doc.getDocumentElement();
    System.out.print("Document elelment = " +element);
    Just add the above lines and check if you get the document element.
    -Amol

  • FI-CA document type when a print document is created

    Hello everybody,
    We have been searching events (e.g. 0061)/user-exit to change the FI-CA document type when a print document (based on our own logic) is created with transaction EASIBI without success. Maybe you have enhanced something in another project. Can you share you experiences?
    Thanks in advance.
    Fernando.

    We have enhanced event R999.

  • Major problem saving and printing documents on two computers

    This is a bizarre problem that seems to have been transferred from my old MDD to my new Mini when I migrated all my old data and it has me baffled. My apologies if this explanation seems long and complicated but I want to be pretty thorough.
    About a month ago I started experiencing a problem with printing. I noticed when printing a sheet of business cards that the page was getting compressed, for lack of a better word, vertically. This was very noticeable because the trim marks on the side of the page were not lining up with the perforations and each row of cards was getting progressively closer to the top as each row was printed. In other words, the first row of cards was okay but then the next row was a little too far "north", the next row a little more, the next row a little more, etc. The bottom of the page was not cut off, it was just squeezed up a bit but not enough that you could tell that the proportions were off. Now I see that many of my documents are like that no matter what application I've use to create them – Pages, Illustrator, Avery DesignPro. What's even worse, I've used Pages to create a sheet of business cards for a friend and Illustrator to make packaging labels and she's having the same problem printing the PDFs of the labels on a different computer. What this seems to tell me is that something has been corrupted and the computer is saving messed up files.
    So, about ten days ago I got a Mini and migrated my data using Migration Assistant. And the problem has now been transferred to the Mini. So I now have two Macs connected to two different HP printers that are both incapable of printing (and apparently saving) documents in the proper proportions.
    Now, a truly weird thing is that I printed a test sheet of business cards from the Mini on the printer connected to the MDD (via printer sharing) and it appeared that the document printed at the correct length. However, another document, a sheet of labels created in Illustrator, printed at the right length but one edge was slightly cropped off. Grrr.
    Anyway, as I said, until about a month ago everything worked fine so something got messed up at that time to cause this problem with saving and printing documents. I need to get this resolved for business reasons – I'm an aspiring designer – but the only thing I can think of doing is wiping out my Mini and reloading everything except my account settings from Time Machine unless someone has advice on what to do. Help! (And yes, I've checked to see that page scaling was always set at 100%.)

    Well, I've just about had it. I erased the disk, reinstalled the OS, Adobe CS4, and iWork. I did not use Migration Assistant this time to restore my settings but still my Mac prints documents in the wrong dimensions. Could this be a sudden HP problem? It seems to me some system setting somewhere is making my computer save and print documents in the wrong size. I now have a computer that is almost useless for designing. Lucky me.

  • Problem Printing Documents - No Doc Flavors Supported

    Hello everybody. I've been trying to implement a print feature in my applications and I've had absolutely zero luck. Basically, I'm trying to print the contents of an html file. However, there are no PrintServices that show up on my machine that support DocFlavors text/html, or even text/plain.
    I searched all over the Internet, but the only tutorials I found involved printing GUI components. I tried putting everything in a JEditorPane and then printing it, but the table is so large horizontally, it runs off the side, so I don't think that route will work.
    I checked IRC, scanned through all of Sun's tutorials and print service API documentation, and even searched around for open source Java word processors so I could check how their print features are implemented, but I can't find anything to help me figure this out. I know there has to be a way, though... or stuff like EIOffice and ThinkFree.com wouldn't be able to work. Can somebody please point me in the right direction?
    Here's the current code I have:
              //display print dialog
              DocFlavor df=new DocFlavor("text/html; charset="+DocFlavor.hostEncoding,"java.io.InputStream");
              PrintRequestAttributeSet attributes=new HashPrintRequestAttributeSet();
              attributes.add(new javax.print.attribute.standard.JobName("NutraSmart Menu",null));
              PrintService[] services=PrintServiceLookup.lookupPrintServices(df,attributes);
              PrintService service=null;
              if(services.length>0)
                   service=ServiceUI.printDialog(this.getGraphicsConfiguration(), this.getX()+50, this.getY()+50, services, services[0], null, attributes);
              else
                   JOptionPane.showMessageDialog(getContentPane(),"No print services could be found to print this menu.","Error printing menu",JOptionPane.ERROR_MESSAGE);
                   nutrasmart.debug(nutrasmart.ERROR,"Could not find any services to print menu");
              //print menu
              if(service!=null)
                   try
                        //create temporary HTML file to print from
                        File tmpfile=File.createTempFile("nsmenu",".html");
                        tmpfile.deleteOnExit();
                        String tmpfilestr=tmpfile.getPath();
                        export_HTML(tmpfilestr);
                        FileInputStream tmpfilestream;
                        try
                             tmpfilestream=new FileInputStream(tmpfilestr);
                        catch(FileNotFoundException e)
                             JOptionPane.showMessageDialog(getContentPane(),"A problem was encountered while preparing the menu to print.","Error printing menu",JOptionPane.ERROR_MESSAGE);
                             return;
                        //print document
                        DocPrintJob pj=service.createPrintJob();
                        Doc doc=new SimpleDoc(tmpfilestream,df,new HashDocAttributeSet());
                        pj.print(doc,attributes);
                   catch(Exception e)
                        JOptionPane.showMessageDialog(getContentPane(),"There was a problem with printing the menu.","Error printing menu",JOptionPane.ERROR_MESSAGE);
                        nutrasmart.debug(nutrasmart.ERROR,"Error printing file",e.getMessage());
              }

    Really we have a crazy font management.
    We have more than 9000 fonts in the /Library/Fonts
    To avoid conficts between the the installed system fonts and the Document font folder, we don't use the document font folder, so that we use always the /Library/Fonts/ fonts installed. Anyway some time ago we also used the Document Font folder and we got the same problem.
    I think that your idea about closing the document before the printing process has been finished is very interesting. What I do is :
    doc.print(print_preset);
    doc.close();
    But I don't how can I test if the document is being closed before finishing the printing process.
    Regards

  • Open/save word document in jsp

    I can open a word document in jsp but i don't know how to save and close it to where i want again inside same jsp.
    I find a code that do thing i want to do but it was written in vb script.
    How can i convert vb code below to java / jsp?
    Dim wrdApp As Word.Application
    MyStr = Format(dtMyDate, "mmm dd, yyyy") & ".doc"
    Set wrdApp = New Word.Application 'released first resources
    With wrdApp
    .Documents.Add "normal.dot", , , True
    strPatientName = txtName.Text
    strFileName = "c:\MJCC\Lab\" & strPatientName & "_" & MyStr
    .ActiveDocument.SaveAs strFileName
    .ActiveDocument.Close
    .Quit
    End With
    Set wrdDoc =Nothing

    <%@ page contentType="application/vnd.ms-excel" language="java"%>
    <meta http-equiv="Content-Type" content="application/vnd.ms-excel; charset=iso-8859-1">
    by using this 2 codes, when i run this page, it will pop up a box for me to save the jsp file..
    i'm able to save it in xls / csv format...
    so, mayb you can try change the ms-excel to ms-word or something else..
    hope this is useful...

  • How do I get my Kodak ESP 3.2s printer to print documents from my iPad ?

    I have an iPad
    I have a Kodak ESP 3.2s all in one printer
    I have set it up to print via my home wi fi using my normal laptop with Microsoft
    However I couldn't  work out how to print from my iPad as its not configured for Apple!
    I downloaded Kodak Pic flick HD app
    This means I can now print photos from my iPad!  Great
    But still can't print documents it seems     I get a message saying No AirPrint Printers Found
    Any advice very welcome
    Thank you
    iknow0

    Airprint is a technology created by Apple Inc. and introduced in iOS 4.0 that allowed iPads, iPhones, and iPod Touches to print directly to Airprint compatible printers. Unlike computer printing where the drivers, fonts, etc. are stored on the computer and sent to the printer with the document with Airprint fonts, drivers, etc. are stored on the printer and need not be sent with the document.
    The solution to your problem is 3rd party software which both Jim and I suggested to you.

  • How can i use only black cartridge for printing documents

    i have today installed hp 1510 all in one printer, it uses ink from the both cartridges i just want to use black ink for printing documents, how can i do that
    This question was solved.
    View Solution.

    Hi @sandeepv 
    I can help you with your print settings, so the printer will print black and white only.
    If you have a Mac operating system, use the instructions below.
    Printing with the Black Print Cartridge Only option
    Click File and then click Print.
    Make sure your printer is selected.
    Verify that the Preset option is set to Standard.
    In the Copies & Pages menu, select Select Paper Type / Quality.
    NOTE:If this option is not available, click ColorSync. Then click the down arrow beside Quartz Filter and change the setting from None to Black & White.
    Select the Paper tab.
    From the Color option menu, select Grayscale.
    Select the Color Options tab.
    Select the Black Print Cartridge Only option.
    If that option is not listed, then it is not available. The printer will print using only the black cartridge, however, printing with one cartridge will be slower than printing with both cartridges.
    NOTE:To save the setting, click the arrow next to Preset and select Save As. Save the Preset option as Black Cartridge Only and then click OK. Then, the next time you want to print with just the black cartridge, select the Black Cartridge Only Preset.    -Source
    If you are using a Windows operating system, use the instructions in the following link. Although this document is titled Changing Print Settings in Windows 8 it can be used for other Windows operating systems. The navigation from Windows 8 to older Windows operating systems would vary, please let me know if you are using a different operating system and/or if you require additional assistance.
    I hope this helps.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • I have an 10x14" InDesign image that I'd like to shrink to fit within a 8.5x11 printed document.

    I have an 10"x14" InDesign image that I'd like to shrink to fit within a 8.5"x11" printed document (using InDesign) without losing the quality of the image (especially on print). What is the correct/least destructive process to do this?
    And how is it that you can view different image sizes on Flickr (of the same image) and it doesn't seem to effect the quality of the image?
    I have tried saving/exporting the InDesign image as an EPS file, then opening the file in Photoshop, adjusting the size to my liking, saving it as a Photoshop file, then placing that file in a new InDesign document, and the image comes up distorted looking/pixelated even with my screen zoomed at 100%. I've also tried this same process with exporting it as a PDF file instead of an EPS file with the same distorted/pixelated results.
    Help!?!?!  Thank you in advance!!
    Linds10m

    I am assuming you are in InDesign CS5:
    Change your InDesign Document Size, but before you do this you must make sure the "Enable Layout Adustment" is on.
    Under: Layout/Layout Adjustment/Check the "Enable Layout Adjustment" box is checked and adjust Snap Zone.
    ALSO: Make sure your horizontal and vertical margins touches your live area.
    Then you can change size of document

  • My HP officejet 6210 no longer prints documents from my Mac ibook G4 running 10.4.11; starts to process the document, but then stops the print,if I restart print same thing happens

    My ibookG4, running 10.4.11 suddenly decided it no longer wants to print documents thru my HP officejet 6210 all-in-one printer.  So far I've tried emails, excel and word all with the same result.  The computer will start to process the print request (processing seems to take longer than previously) and then suddenly the processing stops and a red exclamation mark appears next to the printer image at the bottom of screen.  When I pull up the printer utility it tells me the printer is "stopped".  If I restart it, the process begins all over again until once again it stops.  I have already deleted the printer completely from my computer and reinstalled the software fom the HP site.  For some reason had a really tough time finding the correct print drivers on the HP site, but did finally locate them.  I have not even attempted scanning during this (I see lots of people reported issues with that for the 6210), I would be happy if I could at least print again.  I am connecting via USB.  Is there some way to fix this?

    Hi Evelyn,
    Mac OS X: About the Reset Printing System feature ...
    http://support.apple.com/kb/HT1341?viewlocale=en_US

  • How to create print document for payment to customer through cash journal

    Dear Sirs,
    I have a problem with print document from cash journal. I enter a payment to customer (when I turn the money to customer) and the system makes right posting, but when I try to print this point, system printing document for incom from customer. I'm using business transaction for customer posting in cash journal. I would like to know how I have to manage this posting - payment to customer, or incoming from vendor (returnes advances from emploee)?

    Hi,
    please check whether the two solutions below work:
    1. create a contract with milestone billing plan where there are only down payment billings, so that on the basis of the contract you can generate down payment requests and then relevant down payments, release the contract to a sales order which can then be delivered and billed, manually clear the billing document with the down payments
    2. from FI module, create down payment requests via t-code F-37 directly, and then down payment posting, generate sales order directly, and then deliver and bill, manually clear the billing document with the down payments

  • Missing pages in printed document

    Some topics are missing in the printed document. What could be the reason for this? I have tried and tried but could not get those pages printed.

    Welcome to the RH forums.
    Perhaps you could give us some additional information which would help us here. What version of RH are you using? Is the problem only in one project or on one PC? Is it the same pages that are always missing? Are they always missing from the start, middle, end? That sort of thing.
    For a start, check that you have included all the required pages correctly. Check out this link.  Also check to see if you have any Conditional Build Tags that could be filtering out the topics you are expecting to see.
      The RoboColum(n)
      @robocolumn
      Colum McAndrew

  • Print Templates print preview window closes unexpectly when printing document

    This is a cross posting from Internet Explorer Web Development after a suggestion that this forum would be a better location. See
    https://social.msdn.microsoft.com/Forums/ie/en-US/351e1245-b606-4467-9f3c-1c72f9cdf9ea/print-templates-print-preview-window-closes-unexpectly-when-printing-document?forum=iewebdevelopment.
    I have raised an issue through Connect for this:
    https://connect.microsoft.com/IE/feedback/details/1134168/ie9-to-ie11-print-templates-print-preview-window-closes-unexpectly-when-printing-document, but I would like some more visibility of the issue as my customers thought my application was closing when
    they printed a document.  I also don't know if an issue in Connect gets any priority support via MSDN, but this forum does.
    This looks to me like a problem in the IE Print Templates startDoc API call, but if there is a more appropriate forum to raise this issue in please let me know.
    In the application where I use print templates, the window closing is not in it self a problem because the Javascript that is calling startDoc also closes the Print Preview window when the print is finished.
    The fact that the application looses focus and can be hidden by the windows of other applications when the Print Preview window is closed by startDoc is the issue noticed by our customers, so I need a fix preferably, or a work around at a pinch.
    Details of the issue reproduced below.
    When using IE Print Templates, the startDoc function is causing the print preview window to close.  This behaviour started with IE9, and is still present with IE11.
    When an application is using print templates (see
    https://msdn.microsoft.com/en-us/library/aa753279(v=vs.85).aspx) for print functionality, this has the effect of causing the application to become hidden by any other application window once printing from the print preview window has started.  It is
    actually this behaviour that started me looking at this issue as the users thought the hosting application had closed.
    Print Templates are not accessible by using IE as a web browser, but only when using the WebBrowser Control to embed IE in an application.  The reference for this feature is available from this url:https://msdn.microsoft.com/en-us/library/aa753279(v=vs.85).aspx
    and a sample Microsoft application that demonstrates the use of Print Templates can be used to demonstrate the problem (required for the reproduction steps).  The application is available via this article and searching for "download spiffy".
    Steps to reproduce the problem:
    To see the full effect of the issue, first ensure there is a window from another application (like Windows Explorer) that will cover the sample applications window if brought to the foreground (making the Windows Explorer window full screen works).
    Start the sample application (and ensure that the full screen Window Explorer is the next application to activate).
    Then in the drop down box in the top right corner of the UI select Template8.htm.
    Click the Print Preview button that is just below the drop down box (this will open a new Print Preview window).
    In the new window click the Print… button (this will open a Print dialog).
    Click the Print button at the bottom of the Print dialog.
    The Print dialog closes (expected) and then the Print Preview window also closes (not expected), however the document is still printed successfully.
    When the Print Preview windows is closed unexpectedly, the Windows Explorer window is brought to the foreground (obscuring the sample applications window).
    If you reselect the sample application and click the Print Preview button again, the Print Preview dialog is not displayed unless you restart the application (this looks to be a symptom of the same issue, not a separate problem).
    To see that the Print Preview window appears to be closed by the startDoc call, use the resource editor in Visual Studio (the exe can be opened directly by File | Open | File…) to edit the HTML resource "TEMPLATE8.HTM" (I found I needed to delete
    it and add it back in for the change to stick), find the startDoc call and add two alerts, one on the line before and one on the line after.  When IE is accessing the template, it is being done using the name of the executable (so do not rename the modified
    version of printtemplates.exe, make the changes to a copy in a different directory if you don't want to change the original).  Start the modified version of the application and follow the same steps as in the reproduction.  This time, after clicking
    the Print button in the Print dialog, the dialog will close, the first alert will pop up, then the Print Preview window will close, then
    the second alert will pop up.
    Thank you,
    Warren.

    Hi Shu,
    I have noticed that the print templates API is listed as part of the Legacy APIs. 
    Is this just because it hasn't changed or is not new?  Or does this mean that it is no longer maintained and may be removed (or at least deprecated) at some point in the future? 
    It would good to know if we should start planning for the implementation of a different method of printing.
    I understand that the sample application is no longer maintained, but I also think that the Print Template API that it uses has not changed, and so should still work (and it does mostly).
    If the Print Preview window was being closed as a result of using the Print dialog (and if it had behaved the same way with IE8) I would be willing to go with the by design argument.  
    I have found that the Print Preview window is not closed until startDoc is called, and it closes before control is returned from the startDoc function. 
    Just as part of investigating and try to find a workaround, if I call window.close(), any alert calls made no longer display the alert window after the close call. 
    Alert still functions after startDoc has closed the window however. 
    The is not the sort of consistent behaviour I would expect from something that is by design. 
    Also while investigating, I found that calling startDoc after calling window.close() results in an exception with the error code -2147467259 (0x80004005), this is probably quite normal and expected, but does indicate that the Web Browser Control should
    not be closed till after printing.
    I had found that old thread, and I had concluded it was the same issue, but it was also aimed at different aspect of the problem (which I see in the sample application, but not my application). 
    The visible issue I have is that my users think the application has been closed because after clicking print (on the Print dialog) the application gets hidden by other windows from other applications. 
    This aspect affects the sample in the same manner and so it was a convenient way to demonstrate the problem.
    If IE connect do not look at this issue any time soon, do I have any other avenues to resolve this issue?
    Thank you,
    Warren.

  • Printed Document function not working

    I have a user who is trying to use the Printed Document
    function of RoboHelp to convert html files into one continuous
    document, put together in a book form, complete with a table of
    contents. The process errors out giving her error messages like
    --> "Warning: The Word Document became corrupt when attempting
    to append a malformed topic: (then it lists an htm file here)". Can
    anyone tell me what could be causing this error or if something
    might be missing from the installation?
    Thank you!

    Welcome to the forum
    You'll like this. A number of possibilities.
    See Printed Documentation Issues on my site for one
    possibility.
    The other is quite simply insufficient RAM. Yeah I know what
    RH says on the box but Word has its own requirements. I have a
    layout that gives this error on a 2gb ram machine but works quite
    happily on 3gb.
    A way of checking that it is RAM is to create two copies of
    the print layout. Leave one alone. In number two trash half the
    topics. In three trash the other half. If two and three then
    generate OK, there is clearly no problem topic so by my
    calculations it has to be RAM.

Maybe you are looking for

  • 870A-G46 - Issues installing windows 7 using Raid 0 on 2 SSDs.

    I took 2 60GB SSD's and created a RAID 0 array. After that I tried to install Windows 7. Put the disk in and went through the setup. Got to the point where it asks what drive I would like install it on. Nothing showed up. I successfully set up the 2

  • Powerbook Hard Drive Data Recovery

    A few months back, I bumped the desk that my Powerbook was on pretty hard. The laptop did a bounce, the desktop locked up, and that was it. Whenever I attempt to boot up the drive, it makes god-awful sounds, and the farthest I get is the grey Apple l

  • Any fixes available yet to the 4.3 "upgrade" ??

    Like apparently thousands of others, I have had problems with my wifi connection after the 4.3 update. I tried switching off the auto network switch in the advanced settings (that seemed to work for awhile), I tried safe mode with no improvement. The

  • Playing Iphone videos through a Video Projector

    Is it possible to play videos directly from the iphone through a video projector such as the ViewSonic?

  • Wireless(g) USB Adapter

    Can anyone recommend a USB dongle that will work with OSX10.4? I would like to share my wifi with my G3 iBook and can't find much on this subject, surprisingly.