Help on how to Set a page length and width.

Hi guys I'm kind a new to java JDBC and Jasper.
I'm currently creating my senior project, developing a POS system using Java JDBC, MySql and JasperReport.
I'm now on the finally stage of my project polishing stage.
Now here is my problem.
My adviser wanted my to print sale Invoice using and ordinary Printer let say Espon LX 300 which is available on our Cmpter Lab. He want me to print Sale Invoice using continues paper and try to simulate an actual thing. But I don't know on how to set up a custom paper size in Java or trying to select printer from your system or in your network.
here is the sample of the code:
void PrintInvoice(String databaseName,String userName,String password,String reportFile,String Invoice_Reprint)
        HashMap hm = new HashMap();
        hm.put("REPORT_DATE", saledate_tbox.getText());      
        hm.put("REPORT_VAT", vat_tbox.getText());
        hm.put("REPORT_SUBTOTAL", subtotal_tbox.getText());
        hm.put("REPORT_TOTALPAYMENT", total_tbox.getText());
        hm.put("REPORT_CASH", cash_tbox.getText());
        hm.put("REPORT_CHANGE", change_tbox.getText());
        hm.put("REPORT_POS",POS);       
        hm.put("REPRINT", "REPRINT");
        Connection connection = null;
        ResultSet resultSet = null;
        Statement statement = null;
        try{
        Class.forName(JDBC_DRIVER);     
        String query1 = "select invoice.idinvoice as 'Invoice No'" +
                ",CONCAT(customer.firstname,' ',customer.lastname) as 'Customer'" +
                ",invoice.date as 'Date-Time'" +
                ",item.description as 'Description'" +
                ",sum(invoice_items.quantity) as 'Quantity'" +
                ",Format(item.regular_price,2) as 'Unit Price'" +
                ",Concat((invoice_items.discount*100),'%') as 'Whl Disc'" +
                ",Format(invoice_items.price,2) as 'Price'" +
                ",employee.username as 'Employee'" +
                ",Format(invoice.totaltax,2) as 'Vat'" +
                ",Format(invoice.total,2) as 'Total'" +             
                ",Format(invoice.cash,2) as 'Cash'" +
                ",Format((invoice.total-invoice.totaltax),2) as 'Subtotal'" +               
                ",Format((invoice.cash-invoice.total),2) as 'Change'" +
                " from invoice,item, invoice_items,customer,employee " +
                "where invoice.IDINVOICE = invoice_items.IDINVOICE " +
                "AND invoice_items.UPC_CODE = item.UPC_CODE " +
                "and invoice.idcustomer = customer.customerid " +
                "and invoice.idemployee = employee.idemployee " +
                "AND invoice.idinvoice = (select idinvoice from invoice " +
                "where idemployee = (select idemployee from employee where username = '"+soldby_tbox.getText()+"') " +
                "AND idinvoice = '"+Invoice_Reprint+"' ) GROUP BY item.DESCRIPTION";
        connection = (Connection) DriverManager.getConnection(databaseName,userName,password);
        statement = (Statement) connection.createStatement();
        resultSet = statement.executeQuery(query1);
        JasperDesign jasperDesign = JRXmlLoader.load(reportFile);
        JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);        
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, hm, new   JRResultSetDataSource(resultSet));        
        JasperExportManager.exportReportToPdfFile(jasperPrint, PDFEXPORT);        
        JasperViewer.viewReport(jasperPrint);
        JasperPrintManager.printReport(jasperPrint, false);       
      }catch(Exception ex) {
         String connectMsg = "Could not create the report " + ex.getMessage() + " " + ex.getLocalizedMessage();
         System.out.println(connectMsg);
      finally{
        try                                                       
              statement.close();                                     
              connection.close();                                    
           } // end try                                              
           catch ( Exception exception )                             
              exception.printStackTrace();                           
           } // end catch    
    }My code print the report on the default printer and default printer setting.
I hope someone out there can help me thx alot. by the way I uses Ubuntu as my OS.
The theme of my Senior Project: POS System Using Open Source.
Hey can someone suggest a project tag line or a better theme cause I believe in the ideals of Open Source,
Thx

Try to define ENTER this way & try
class cl_abap_char_utilities definition load.
DATA : BEGIN OF enter,
x type c value cl_abap_char_utilities=>cr_lf,
END OF enter.
PS : I am not 100% sure about this.

Similar Messages

  • 2 Question How to set the page size and  full screen

    I am looking to find out how to set the page to be 1024 by
    768 static and also how to force a browser window to go to full
    screen. Thanks

    Hi Ludek,
    i could solve the issue by using the follwing code.
    report = new ReportDocument();
    PageMargins customPageMargin = report.PrintOptions.PageMargins;
    report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
    report.PrintOptions.PaperSize = PaperSize.Paper10x14;
    customPageMargin.rightMargin = 1;
    customPageMargin.topMargin = 0;
    customPageMargin.bottomMargin = 0;
    report.PrintOptions.ApplyPageMargins(customPageMargin);
    Thanks for you help.
    Regards,
    smitha.

  • How to set the page size and the margins programatically

    Hello,
      I am working with crystal report XI Release2 and asp.net.
    One of my report is having 4 graphs in a single report.In order to display all the graphs in one page i have set  the paper size as A3.(Via Crysta report ->File->Page set up)
    But the page size A3 is not provided by all printers.So problem comes when the application is diployed on a machine which does not support A3 Printer.All the graphs will not be shown on a single page.
    Also Each and Every time ,when the application is diployed on a machine,user has to open the crystal report and adjust the page size accordingly to get all the reports on a single page.
    This is a kind of usability issue also.
    Is it possible to set the page size and the margins programatically say for eg 11 X 17.so that with out doing anything all the 4 graphs will get displayed on a single page ?
    Please let me know if you require more information regarding this issue.
    Thanks in advance.
    smitha.

    Hi Ludek,
    i could solve the issue by using the follwing code.
    report = new ReportDocument();
    PageMargins customPageMargin = report.PrintOptions.PageMargins;
    report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
    report.PrintOptions.PaperSize = PaperSize.Paper10x14;
    customPageMargin.rightMargin = 1;
    customPageMargin.topMargin = 0;
    customPageMargin.bottomMargin = 0;
    report.PrintOptions.ApplyPageMargins(customPageMargin);
    Thanks for you help.
    Regards,
    smitha.

  • How to set a page header and footer of an excel file i'm creating

    Hello !
    SORRY MY ENGLISH is very BAD.
    I tried to set page header and footer in Excel sheet with ABAP  ole
    DATA : BEGIN OF enter,
    x(1) TYPE x VALUE '0D',
    END OF enter.
    DATA : format(255) TYPE c.
    FORM set_page_sheet.
    CALL METHOD OF excel 'ActiveSheet' = sheet.
    CALL METHOD OF sheet 'PageSetup' = pagesetup.
    SET PROPERTY OF pagesetup 'Orientation' = xllandscape.
    SET PROPERTY OF pagesetup 'PrintTitleRows' = '$9:$12'.
    CLEAR format.
    ERROR
    CONCATENATE 'PAGESHEET' enter-x 'PAGE &P/&N' INTO format.
    ERROR
    SET PROPERTY OF pagesetup 'RightHeader' = format.
    CLEAR format.
    CONCATENATE ' Text 1 ' enter-x 'Text 2'
    enter-x 'Text 3 ' INTO format.
    SET PROPERTY OF pagesetup 'RightFooter' = format.
    FREE OBJECT pagesetup.
    ENDFORM. " set_page_sheet
    Activate report -
    ERROR - The enter-x must by data type c or another then data type x
    Thanks for answer.

    Try to define ENTER this way & try
    class cl_abap_char_utilities definition load.
    DATA : BEGIN OF enter,
    x type c value cl_abap_char_utilities=>cr_lf,
    END OF enter.
    PS : I am not 100% sure about this.

  • How to increase the size (Length and width)  of check box

    Hi All,
    I have to increase the size of ( width and length) of check box, I have revised to check box topic in dev guide but didnt find any clue, i have also tried to use CCStyle class but that is also not working, I would appreciate if some can help me out on this. Thanks in advance , let me know if any clarification required.
    Thanks
    Pratap

    Hi Pratap ,
    I honestly don't know how to increase the size
    But i am giving you an alternate solution : we can create two Images with check box type 1 ) with checked
    2 ) with unchecked . ( you can create image of any size ) and get them displayed on OAF screen dynamically using switcher case .
    Dynamically displaying image will give the illusion of check box being checked and unchecked .
    keep this image moved to following media directory
    eg : /oraapp/mfgtestcomn/java/oracle/apps/media .
    Implement the switcher case , add the fire action to this Image Column , create a transient attribute and attach to this
    column . Depending on the value returned by transient attribute display the image on the column .
    Let me know if its not clear .
    Keerthi

  • How to set default page in DLN among folders structure

    Hi All,
    We have the navigation structure as follows.
    In Top Level Navigation we have a Role called " Role1"
    In Second Level Navigation we have a Workset called "Workset1"
    In Detailed Navigation we have a folders as below :
    Folder1
        Folder2
              Page1
              Page2
              Page3
        Folder3
             Page4
             Page5
             Page6
    Now our requirement is when user clicks on Role1 then in the Detailed Navigation (DLN) , Page1 should set by default and content in that page has to be displayed in the content Area.
    Currently it is happening like, when user clicks on Role1 then in the Detailed Navigation(DLN), Folder1 is selecting by default , then user has to select manually the page1 then that page1 is content is displaying in the content area.
    Could you please get back to me what are the properties has to be changed at page level or folder level if any, for achieving the requirement as page1 should set by default when user clicks on Role1 ( from the First Level Navigation).??
    I tried the property of "Default entry for folder"  for page1 as "Yes", Still it is setting the page1 as deafult in the DLN on click of Role1. Please let me know if any other properties are required to change?
    Note : Currently we are using Light framework page fucntionality instead of Default framework page.
    Thanks in advance, it would be great help to us if get back to us.
    Regards,
    PortalUser100
    Edited by: PortalUser100 on Feb 24, 2011 6:53 PM
    Edited by: PortalUser100 on Feb 24, 2011 6:54 PM
    Edited by: PortalUser100 on Feb 24, 2011 6:57 PM

    Hi Mahesh,
    Thanks for your reply.
    Currently we are using Light framework page not Default Framework Page, Inside we have Light detailed Navigation, inside i had check for the property of "Clicking Folder Name Launches First Node", but it was not there for Light detailed Navigation.And this property is there as you said for detailed navigation inside the desktop inner page.
    Could you please guide whether out requirement is possible or not with light framework page->light detailed navigation?
    The following is our requirement
    How to set a Page as Default which is inside the Folder Structure on DLN (Detailed Level Navigation).?
    When user clicks on Role , then we need to set the Page as default to be loading in the detailed Navigation then the content of Page will be automatically displayed in the content area.?
    The following is the Structure of our requirement, then please let me know how to set Page as default when we click on Role 1, as mentioned in the below structure. Currently when click on Role1, then Folder1 in the DLN is selecting by default then user has to click on Page manually then content of page will be displayed in the content area.
    Role1 (First Level Navigation)
         Workset1(Second Level Navigation)
             Folder1(Deailed Navigation content)
                  Folder2
                        Page (Google Page, for example)
    I tried the property of Page as "Default Entry for Folder" as "Yes", even though still the page is not setting by default on click of Role1. let me know if any other changes/properties/options are there to get the solution for this.
    If any one helps on this then it would be great help to us.
    Currently we are using Light Framework Page. Not Default Framework Page.
    Thanks in advance.
    Regards,
    PortalUser100

  • How to Set a page as home page in Oracle portal 10g

    Hi,
    I have one doubt.
    How to set a page (Not Page group) as home page in Oracle portal 10g?
    whether it should be a HTML Portlet or some other?
    Thanks & Regards
    Suthan.Sathya

    Hi,
    Welcome to SDN
    By defining the Sort Sequence of Navigation Nodes, you can do this, check the links:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/92/3e703e632c7937e10000000a114084/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/53/89503ede925441e10000000a114084/frameset.htm
    If you need more help, just ping back.
    Greetings,
    Praveen Gudapati
    p.s. Points are always welcome for helpful answers

  • TS2755 Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help of how to set up messages on each

    Hi all, I bought one iphone and 3 ipads, i set up all on one apple ID. Now i have a problem when using messages: when sending message from one device it appears again on screen from the other 3 devices. I need help on how to set up messages on each device separately and to start using messages app on each device independently. Thanks

    search google for "iphone remove picture from contact"

  • How to set min-password length on ASR1002?

    How to set min-password length on ASR1002?

    Try:
    security passwords min-length
    I'm not positive if it's supported in your version of IOS-XE but it is in some.

  • Hi, I am using Indesign CS6, How to set the page size in Inches.

    Hi, I am using Indesign CS6, How to set the page size in Inches.

    All fields in InDesign can be entered in any measurement system. So, if you want to make an 8"x10" document and go to File>New Document and the window looks like this:
    …you can type either 8 in or 8" into the Width field like this:
    …and when you move to the next field, it will convert the eight inches into the equivalent number in the unit of measure that it is using at the moment, like this:
    … (203.2 milimeters is the same as 8 inches). You can also enter a different measurement unit into other fields once the file is created, such as the width or height of a frame, or the position of an object in the X and Y coordinates.
    If you would rather just work in inches instead of having to type the inches mark or abbreviation, go to InDesign>Preferences>General and select the Units & Increments tab. There you will see Ruler Units for Horizontal and Vertical at the top of the window. Set them to Inches and all of the fields will display in inches. If you do that to an open document, you will change the unit of measure for that document. If you do it while no documents are open, it will change the unit of measure for any new documents you create. To change the unit of measure for existing documents, you will have to open each and make the change.

  • How to set the page size

    Hi,
    How to set the page size of a B tree node in berkeley db java edition?
    thanks.

    The two systems have different performance characteristics. If you are concerned with the performance characteristics, then the best way to tell is to benchmark them.
    By the way, both BDB and BDB JE are B-trees.

  • Need help: Flex  record webcam problem, how to setting Brightness,Contrast,Saturation and Sharpness

    Hello, dear all
    Please help me!
    Flex  record webcam problem, how to setting Brightness,Contrast,Saturation and Sharpness?
    nsOutGoing=new NetStream(nc);
    nsOutGoing.attachCamera(m_camera);
    nsOutGoing.publish(filename, "record");
    I want to control the Brightness,Contrast,Saturation and Sharpness for the recorded flv file.
    At present, I only can control the videodisplay object, but I can not able to control Camera.
    Thanks very much!!
    kimi
    MSN: [email protected]

    Can I change a Video object to to Camera object, If yes, How do??
    nsOutGoing.attachCamera(video as Camera);// it does not work rightly
    thanks

  • How to set value for trim and bleed using jsx script?

    I have tried using bleedoffsetRect but somehow it is not working. Can anybody please help me on how to set value for trim and bleed using jsx script? Any example will be highly appreciated.
    Following is the code I am trying with:
    var _saveName = new File ( root_path +_strFileName+".pdf");
        var _saveOpts = new PDFSaveOptions();
        _saveOpts.printerResolution = 300; 
        var bleedarray = new Array();
         bleedarray[0] =9.00;
         bleedarray[1]=9.00;
         bleedarray[2]=9.00;
         bleedarray[3]=9.00;    
        _saveOpts.bleedOffsetRect = bleedarray;

    I would expect although I've not actually tried this for the bleed off set box to be larger than the artbaord and the first two values to be negative or 0…
    var bleedarray = new Array(-9,-9,artboard.width+9,artboard.height+9);
    Where 'artboard.width' & 'artboard.height' you will have calculated from your file. An Array(9,9,9,9); would not constitute any boxes bounds.

  • How do I view page margins and drag objects around to fit?

    How do I view page margins and drag objects around to fit?

    Hi Sime,
    Some ideas for workarounds now that Numbers 3 has lost Page Setup, Print View and Layout View.
    1. Numbers 2.3 is still on your computer unless you deleted it. Look in your Applications folder for the iWork '09 folder. Drag the Numbers '09 (Numbers 2) icon to your Dock. It will become an Alias. Right click (or control click) on it then Options > Keep in Dock. You might actually enjoy running both versions at the same time, to compare features. Just be careful which version you are running before you edit and save.
    2. Use Numbers 3 to export a document 'backwards' to Numbers 2. Be aware that features lost in Numbers 3 may not be restored by exporting 'backwards' to Numbers 2.
    3. In Numbers 3 > Preferences > Rulers
    Those Guides help you to align objects with each other.
    4. Menu > View > Show Rulers. This will show zero for the top or right left margin. Then drag a ruler guide from top or left.
    More hints on workarounds here:
    https://discussions.apple.com/message/23622372#23622372
    What has been GAINED in Numbers 3 is here:
    https://discussions.apple.com/thread/5473882?start=45&tstart=0
    If you want to see what has been lost in Numbers 3, go here:
    https://discussions.apple.com/thread/5470448?start=240&tstart=0
    Regards,
    Ian.
    Message was edited by: Yellowbox. Oops, This will show zero for the top or *right* margin. Mirror image this to *left* margin

  • How to get length and width of a textbox or image box and display on a dialog

    Hi,
    When I draw a textbox or frame on a document, and If I select it then I want to display its length and width on a dialog.I am not able to solve it, Can anybody help me ?
    Can u suggest some sites or online books about Indesign plugin development programming using c++.
    Thanks,
    Ravi Sharma

    Thanks Schneider. It was very helpful.<br /><br />As I am new to Indesign CS3 SDK programming. <br /><br />I am not able to understand the syntax of this programming ,<br /><br />How to use InterfacePtr.<br /><br />For eg:<br /><br />InterfacePtr<IClassIDData> orgDocFileHandlerData(doc, IID_ORGICLASSIDDATA); <br /><br />Can u please explain me this and suggest some good sites/online books <br /><br />about Indesign CS3 SDK programming for Windows and Mac.<br /><br />Thanks n Regards,<br /><br />Ravi Sharma

Maybe you are looking for