Results 1 to 6 of 6
  1. #1
    BobswYourUcle is offline Member
    Join Date
    Mar 2011
    Posts
    23
    Rep Power
    0

    Default Printing file through browser

    Hello,
    I am trying to print a file using the browsers functionality. I can get it to work however the printer dialog opens on the server not in the browser.

    I assume I have to change it to be some sort of response/request but I am not sure how to do that.

    Currently i have a button that when pushed it generates afile to an input stream which i then output to the printer using PDFBox

    Java Code:
    PDDocument pdDocument;
    pdDocument = PDDocument.load(generateFile);
    pdDocument.print(printJob);
    the above works but of course opens the dialog box on the printer not the users machine.

    Thanks

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    the printer dialog opens on the server not in the browser.
    Where is the code being executed?
    What code is being executed in the browser?

  3. #3
    BobswYourUcle is offline Member
    Join Date
    Mar 2011
    Posts
    23
    Rep Power
    0

    Default

    Thanks,

    I assume it is being run on the server as that is where the dialog box is opening. I am using wicket and have as of yet to figure out how to send the response to the useres browser instead of the servers.

    Please assist

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    What code is being executed in the browser?

  5. #5
    BobswYourUcle is offline Member
    Join Date
    Mar 2011
    Posts
    23
    Rep Power
    0

    Default

    Thanks again,

    I am using wicket to send the pdf back:

    Java Code:
    public class PdfGeneration extends Panel 
    { 
        public BPPdfGeneration(String id) throws IOException, DocumentException, PrinterException 
        { 
            super(id); 
            PDDocument pdDocument; 
            pdDocument = PDDocument.load(PDFGen.generatePDF()); 
            pdDocument.print(); 
    
    //I assume that the pdDocument.print(); should be added to the html somehow such as: 
    //     add(new ?("pdf", pdDocument.print()); 
       } 
    }

    Thanks again

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    Not sure what wicket is. Is it part of cricket?

    What code is being executed in the browser?

Similar Threads

  1. Printing to browser
    By BobswYourUcle in forum New To Java
    Replies: 6
    Last Post: 07-07-2011, 10:00 AM
  2. Replies: 1
    Last Post: 08-04-2010, 03:24 PM
  3. Sorting and Printing file
    By spry.chipper in forum New To Java
    Replies: 3
    Last Post: 12-13-2009, 08:15 PM
  4. Job name when printing file
    By pjmorce in forum Advanced Java
    Replies: 3
    Last Post: 12-23-2008, 01:55 AM
  5. File Browser
    By Troman in forum SWT / JFace
    Replies: 5
    Last Post: 09-09-2008, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •