Print 12 records of employees in each page of smartforms

hi .
i am using the smartforms to print the details of employees my requirement is that in smartforms the first 12 records records should be print in first page and another 12 records in next page and soon..
here in my smartforms records are getting printed first page printing the details of employees are correct but when it comes to next page it print the same records of first page( eg first 1 to 12 records ) ...not the next 12 records it should print next records ( 13 to 24 )soon.. .
plz help me  this is very urzent..
thanks in advance..
johnku.

Hi,
you are processing loop in main window then
I think there is page protection is active for paragraph. Page protection de-active.
Rgds
Ravi Lanjewar
Edited by: Ravishankar Lanjewar on May 22, 2010 4:52 PM

Similar Messages

  • How to print column's value on each page as a header in XML Publisher

    Hi,
    I have requirements like, there are some fields that I need to print on header level in RTF file. Output file should looks like below.
    LN-1) Company_Name     Tax ID-1     Tax ID-2     Report_Type     Page No: Year/001
    LN-2) Company_Address
    LN-3) MONTH-YEAR
    LN-4) Invoice ID     Invoice Date     Tax Code     Supplier Name     Amount
    Example:
    LN-1) Global Infra.     123     321     General Purchase     Page No: 2012/001
    LN-2) NewYork, USA
    LN-3) JANUARY-2012
    LN-4) Invoice ID     Invoice Date     Tax Code     Supplier Name     Amount
    3454 03-JAN-12 Tax-1 ABCD Corp. 100
    5678 14-JAN-12 Tax-2 Kant Brothers 200
    LN (Line Number)-1,2,3 should be at header level and needs to print on each page. LN-4 are fields of table which will return data. When year changes on Page No. field - page no. should restart from 1 and all records for a particular MONTH-YEAR should be grouped on month-year basis.                
    I have done page no. thing as if year change, page no. reset to 1 by using "Section Break" on first FOR loop. Later I applied second FOR loop to group data on MONTH-YEAR basis. Here I am getting all records for that particular month (e.g - JANUARY-2012) and MONTH-YEAR is printing on FIRST page. If records are more and lines are going into next page, then I am not getting MONTH-YEAR on second page. I am getting only first 2 lines (means LN-1 & LN-2) on second page at header level and records of that MONTH-YEAR but missing MONTH-YEAR value (JANUARY-2012) on second page. My requirement is to print first 3 lines on each page.
    Here Company_Name, Report_Type and MONTH-YEAR are dynamic columns which are holding run time values.
    I tried number of ways but didn't get success. Kindly help me to fix this issue and please let me know if you need more details to understand this issue.
    Kind Regards,
    Umakant

    Hi Umakant,
    Can you please forward me your template and sample XML data so that i can look into it and will try to fix it. My email id is [email protected]
    Thanks,
    Omkar Deshpande.

  • How to print a field on the last page of Smartform?

    HI FRIENDS,
    I NEED TO PRINT ONLY ONE FIELD IN LAST PAGE OF FORM SMARTFORM
    HOW DO I CHECK last page. I tried WITH THE FIELDS OF TABLE
    SYSF BUT NOT worked.
    Thank you.
    ROGERIO VAZ

    Hi,
    Goto the conditions tab of that window and enable the check box for Only after the end of main window.
    This will surely print your field in the last page.
    try this and get back to me if any issues.
    Regards,
    Anand.

  • How to print a field on the last page of Smartform with more  of 2 pages?

    HI FRIENDS,
    I NEED TO PRINT ONLY ONE FIELD IN LAST PAGE OF FORM SMARTFORM
    HOW DO I CHECK last page. I tried WITH THE FIELDS OF TABLE
    SFSY BUT NOT worked.      
    The form has  more of  2 pages.
    Thank you.
    ROGERIO VAZ

    Hi ,
    You dont have to hard code anything to achieve this functionality,
    just create a window and in that window define a text element to print
    that variable.In the conditions tab of that window check the check box
    "only after end of main window".i think you might have used a main window,
    so irrespective of the no of pages the smartform prints,it always displays that
    field in the last page of the smartform.
    regards,
    srikanth.

  • How to bring each lable in each page in smartform output

    Hello Experts,
    I have a requirement to develope a smartforms based on tcode LM55 ,So think is there after executing that smartform driver program it will generate storage bin number with barcode but my requirement is if multiple storage bin number is there then it should come each storage bin in each page.So any one can help me for this.
    Thanks.

    Hi Ram,
    You can add you coding in command.

  • 10g 10 on XP PRO - Which property to print the master group on each page?

    Hi,
    I'm building a reports that displays the sum of orders totals per customer then per salesman.
    All fields have "print on first page" property set.
    However the salesman ename prints only on the first page of the report.
    If I change to "print on every page", the whole install goes "booom" !! :-(
    There are 3 repeating frames:
    group_emp
    --[group_customers]
    -----[group_orders]
    Here is the same report on SQLPlus (in case someone loses faith and needs a report badly)
    set pagesize 40
    set linesize 110
    set pause on
    set pause .........[Return]................
    clear breaks
    clear computes
    ttitle center "Orders Totals by Employee"
    break on ename skip page on custname skip 1
    compute sum of order_total on ename
    compute sum of order_total on custname
    select
    e.ename
    , c.custname
    , o.order_date
    , o.order_total
    from emp e, customers c, orders o
    where e.empno = c.empno
    and c.custno = o.custno
    order by e.ename, c.custname, o.order_date
    Many thanks if you can help
    Message was edited by:
    JeanParis

    Hi Fs, just like I wrote, Reports decided to shut down immediately, so I had to stop running OC4J instance and shutdown the PC running the 3 Oracle services.
    The PC has a Dual Core and 2 Gigabytes of Ram.
    I checked the reports at my company today, the only difference is that the frames display on every page and the fields display once.
    I think I have to reread the manuals before attempting to display one salesman per page.
    Remember what we used to say on Compuserve: There is only one thing more stubborn than a bug, it's a stubborn debugger.

  • Print field in header of each page

    I am attempting to put a field in the Header of my RTF template for my BI Publisher report. I am using the BI Pub Desktop and in Word when I am doing this.
    It says that I am not allowed to put a feild in the header, footer, textbox , etc...
    How can I have a field print in the header or just below the header of every page in my report.
    Thanks
    Steve B

    Look at my explanation here ,these might help.
    http://winrichman.blogspot.com/search/label/element%20in%20header
    http://winrichman.blogspot.com/search/label/different%20page%20header
    http://winrichman.blogspot.com/search/label/diff%20header
    http://winrichman.blogspot.com/search/label/header

  • Printing multiplte customer details on seperate pages using Smartforms

    Hi,
    I have a requirement where I have to accept the customer number using Select-options and display the customer details in seperate smartform pages.
    I applied the command in smartform giving the general attribute go to new page 'page1'.
    the details are getting printed on the smartform but all the customer details are getting printed on all the pages.Kindly tell me where I should make the change to print each customer detail in seperate pages.
    Thank u

    Make sure you use the command prompt correctly inside the MAIN window of the form. Trigger new page, when the customer number is changed ( to do this you need to place condition in the command prompt).
    Example scenario:
    Define global variable GV_KUNNR.
    Inside MAIN WINDOW:
    a) Display customer information
    b) In Command Prompt,  new page condition GV_KUNNR <> KUNNR.
    c) Code page: gv_kunnr = kunnr.
    I guess, above solution will help you to close the thread.
    Regards,
    SaiRam

  • Print text on last but one page of SmartForms

    Hello everyone,
       Here I have a very specific requirement in SmartForms which I am not able to do even after trying a lot of options.
       I want to print Items of PO in Main Window and I am printing total on a different window which should be printed at end of all Items.  Again this does not mean total is printed on last page, as the last page has Conditions which is default with every PO.
      So the requirement is to find out the last but one page at runtime and print the total. 
    Thanks.

    Hi Priya,
    Even I faced the same problem while creating invoice.
    Soln:
    declare a variable "g_counter" at global definition tab with data type "I'.
    In the main window just after your table and before the command line which you have used, create a program line and give input and output parameters as "g_counter"
    In the body of program line just write "g_counter = g_counter + 1".
    Make sure your total window is placed after the main window in sequence.
    Than in the total window you can put condition as "g_counter = 1".
    I am sure this issue will be reolved.
    Regards,
    Vinit

  • Printing text on the back of each page

    I have a question about printing on the "back" of each page. I am trying to create documents (like Purchase Orders, Order Acknowlegments, Invoices) that have Legal Terms and Conditions that need to print on the back of each printed page(so it needs to be every other page). I can't figure out how to make that happen with reports. My report output is pdf.
    I see that a Trailer page has a "Repeat On" property...but that is based on groups. I need it to be based on pages. Even so, they all print at the end.
    I also see there is a between_pages report trigger...can I somehow use that?
    Using Reports 10.1.2.0.2 with Unix App Server(hp-ux).

    Hi curiouslyfun,
    You wrote:
    I'm working on a long document.
    Peter wrote:
    I suspect that it may ultimately be a matter of just how much document can be held in RAM and calculated as to its layout, something Pages is not noticeably efficient at doing.
    Ahem.
    Pages is a $20 word processor. It is not a clone of Microsoft Word. Pages is a user-friendly app for short documents. If you need strong horsepower, buy and use Word for Mac.
    Popcorn wrote:
    an editor will get the document. They requested pages.
    Hi Pop, perhaps your editor will accept your work in a number of small Pages documents. Split your work into several "chapters" in separate Pages docs. If your editor is a Pages user, they will understand.
    Ian.

  • Print - JTable with a TITLE on each page

    Hi! someone know haw can I print a MY TITLE on each page that I print ?
    ----->MY TITLE<----
    | co1 | col2 | col3 | col4 |
    |dtxxz|dtxyz|dtxyz|dtxyz|
    |dtxxz|dtxyz|dtxyz|dtxyz|
    |dtxxz|dtxyz|dtxyz|dtxyz|
    PAGE 1
    I try that :
    g.drawString("MY TITLE", 100,50);
    but the table header hide (writing over) my title
    Here is my call :
    public int print(Graphics g, PageFormat pageFormat, int pageIndex)
    throws PrinterException {
         Graphics2D g2 = (Graphics2D) g;
         g2.setColor(Color.black);
         int fontHeight = g2.getFontMetrics().getHeight();
         int fontDesent = g2.getFontMetrics().getDescent();
         pageFormat.setOrientation(pageFormat.LANDSCAPE);
         //leave room for page number
         double pageHeight = pageFormat.getImageableHeight() - fontHeight;
         double pageWidth = pageFormat.getImageableWidth();
         double tableWidth =
              (double) getCurrentTable().getColumnModel().getTotalColumnWidth();
         double scale = 1;
         if (tableWidth >= pageWidth) {
              scale = pageWidth / tableWidth;
         double headerHeightOnPage =
              getCurrentTable().getTableHeader().getHeight() * scale ;
         double tableWidthOnPage = tableWidth * scale;
         double oneRowHeight =
              (getCurrentTable().getRowHeight() + getCurrentTable().getRowMargin()) * scale;
         int numRowsOnAPage = (int) ((pageHeight - headerHeightOnPage) / oneRowHeight);
         double pageHeightForTable = oneRowHeight * numRowsOnAPage;
         int totalNumPages =
              (int) Math.ceil(((double) getCurrentTable().getRowCount()) / numRowsOnAPage);
         if (pageIndex >= totalNumPages) {
              return NO_SUCH_PAGE;
         g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
         g2.drawString(
              "Page: " + (pageIndex + 1),
              (int) pageWidth / 2 - 35,
              (int) (pageHeight + fontHeight - fontDesent));
         //bottom center
         g2.translate(0f, headerHeightOnPage);
         g2.translate(0f, -pageIndex * pageHeightForTable);
         //TODO this next line treats the last page as a full page
         g2.setClip(
              0,
              (int) (pageHeightForTable * pageIndex),
              (int) Math.ceil(tableWidthOnPage),
              (int) Math.ceil(pageHeightForTable));
         g2.scale(scale, scale);
         getCurrentTable().paint(g2);
         g2.scale(1 / scale, 1 / scale);
         g2.translate(0f, pageIndex * pageHeightForTable);
         g2.translate(0f, -headerHeightOnPage);
         g2.setClip(
              0,
              0,
              (int) Math.ceil(tableWidthOnPage),
              (int) Math.ceil(headerHeightOnPage));
         g2.scale(scale, scale);
         getCurrentTable().getTableHeader().paint(g2); //paint header at top
         return Printable.PAGE_EXISTS;
    Thanks

    //Solution-------------------------------------------------------------------------------------------------------
    // PRINT : CENTER HEADER TITLE ON EACH PAGE
    : PAGE NUMBER ON EACH PAGE
    : USE A PREVIEW WINDOW
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.awt.event.*;
    * File: PrintTable.java
    * (C) Copyright Corp. 2001 - All Rights Reserved.
    * Print a JTable data
    public class PrintTable implements Printable {
    * Insert the method's description here.
    * Creation date: (03-13-2002 13:50:41)
    * @param g java.awt.Graphics
    * @param pg java.awt.print.PageFormat
    * @param i int
    public int print(Graphics g, PageFormat pageFormat,
         int pageIndex) throws PrinterException {
         try{
              Graphics2D g2 = (Graphics2D) g;
              g2.setColor(Color.black);
              int fontHeight = g2.getFontMetrics().getHeight();
              int fontDesent = g2.getFontMetrics().getDescent();
              // Normalize the header color
              // he title of the report is not printed if the color of the header is different of these colors
              m_table.getTableHeader().setBackground(new java.awt.Color(204,204,204));
              m_table.getTableHeader().setForeground(new java.awt.Color(0,0,0));
              //leave room for page number
              double pageHeight = pageFormat.getImageableHeight() - fontHeight;
              double pageWidth = pageFormat.getImageableWidth();
              double tableWidth = (double) m_table.getColumnModel().getTotalColumnWidth();
              double scale = 1;
              if (tableWidth >= pageWidth) {
                   scale = pageWidth / tableWidth;
              // Get the size of the table header
              double headerHeightOnPage = m_table.getTableHeader().getHeight() * scale;
              // Get the table size on a page
              double tableWidthOnPage = tableWidth * scale;
              // Title Height
              double titleHeightOnPage = 0;
              if( m_title != null ){
                   titleHeightOnPage = ((double)m_title.getFontMetrics(m_title.getFont()).getHeight() + 40) * scale;
              // Get size of a row
              double oneRowHeight =
                   (m_table.getRowHeight() + m_table.getRowMargin()) * scale;
              int numRowsOnAPage = (int) ((pageHeight - headerHeightOnPage - titleHeightOnPage) / oneRowHeight);
              // Get number of row in a page
              double pageHeightForTable = oneRowHeight * numRowsOnAPage;
              // Get the number of page to print
              int totalNumPages =
                   (int) Math.ceil(((double) m_table.getRowCount()) / numRowsOnAPage);
              if (pageIndex >= totalNumPages) {
                   return NO_SUCH_PAGE;
              // Print the page label at bottom center
              g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
              g2.drawString(
                   "Page: " + (pageIndex + 1),
                   (int) pageWidth / 2 - 35,
                   (int) (pageHeight + fontHeight - fontDesent));
              g2.translate(0f, headerHeightOnPage + titleHeightOnPage);
              g2.translate(0f, -pageIndex * pageHeightForTable);
              //If this piece of the table is smaller than the size available,
              //clip to the appropriate bounds.
              if (pageIndex + 1 == totalNumPages) {
                   int lastRowPrinted = numRowsOnAPage * pageIndex;
                   int numRowsLeft = m_table.getRowCount() - lastRowPrinted;
                   g2.setClip(
                        0,
                        (int) (pageHeightForTable * pageIndex),
                        (int) Math.ceil(tableWidthOnPage),
                        (int) Math.ceil(oneRowHeight * numRowsLeft));
              //else clip to the entire area available.
              else {
                   g2.setClip(
                        0,
                        (int) (pageHeightForTable * pageIndex),
                        (int) Math.ceil(tableWidthOnPage),
                        (int) Math.ceil(pageHeightForTable));
              g2.scale(scale, scale);
              m_table.paint(g2);
              g2.scale(1 / scale, 1 / scale);
              g2.translate(0f, pageIndex * pageHeightForTable);
              g2.translate(0f, -headerHeightOnPage );
              g2.setClip(
                   0,
                   0,
                   (int) Math.ceil(tableWidthOnPage),
                   (int) Math.ceil(headerHeightOnPage));
              g2.scale(scale, scale);
              // Paint header at the top of the page
              m_table.getTableHeader().paint(g2);
              g2.scale(1 / scale, 1/ scale);
              g2.translate(0f, -titleHeightOnPage);
              g2.setClip(
                   0,
                   0,
                   (int) Math.ceil(tableWidthOnPage),
                   (int) Math.ceil(titleHeightOnPage));
              // Paint title
              if( m_strTitle != null ){
                   //Center
                   g2.translate((pageFormat.getImageableWidth() / 2) -
                                  (m_title.getFontMetrics(m_title.getFont()).stringWidth(m_title.getText()) / 2 ),
                                  0f );
                   g2.drawString(m_title.getText(), 0, 10);
              }else if ( m_title != null ){
                   //Center
                   g2.translate((pageFormat.getImageableWidth() / 2) -
                                  (m_title.getFontMetrics(m_title.getFont()).stringWidth(m_title.getText()) / 2 ),
                                  0f );
                   m_title.paint(g2);     
         }catch (Exception e){
              e.printStackTrace();
              return Printable.PAGE_EXISTS;
    * Show a print dialog box
    * Call the method to print
    * @param JTable table : table to print
    * @param String title : title of the table
    public static void print(JTable table, String title) {
         try {
              m_table = table;
              m_strTitle = title;
              m_data     = m_table.getModel();
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(PrintTable.instance, prnJob.defaultPage());
              // if the print job is cancelled
              if (!prnJob.printDialog())
                   return;
              // print the table
              prnJob.print();
         } catch (PrinterException pe) {
              pe.printStackTrace();
              System.err.println("Printing error: " + pe.toString());
         protected static PrintTable instance     = new PrintTable();
         public static int LANDSCAPE = PageFormat.LANDSCAPE;
         protected static TableModel m_data;
         protected static int m_maxNumPage           = 1;
         protected static String          m_strTitle = null;
         protected static JTable      m_table;
         protected static JLabel      m_title          = null;
         // Paper orientation
         public static int PORTRAIT = PageFormat.PORTRAIT;
         private final static String PREVIEW_LBL = "Aper�u avant impression...";
    * Insert the method's description here.
    * Creation date: (03-13-2002 10:12:41)
    public static void preview(JTable table) {
         m_table = table;
         m_data      = table.getModel();
         PrinterJob prnJob = PrinterJob.getPrinterJob();
         new PrintPreview(PrintTable.instance,
                             PREVIEW_LBL,
                             prnJob.defaultPage());
    * Insert the method's description here.
    * Creation date: (03-13-2002 10:12:41)
    public static void preview(JTable table, PageFormat pf) {
         m_table = table;
         m_data      = table.getModel();
         new PrintPreview(PrintTable.instance,
                             PREVIEW_LBL,
                             pf);
    * Insert the method's description here.
    * Creation date: (03-13-2002 10:12:41)
    public static void preview(JTable table, String title) {
         m_table = table;
         m_data      = table.getModel();
         m_strTitle = title;
         m_title = new JLabel(title);
         PrinterJob prnJob = PrinterJob.getPrinterJob();
         new PrintPreview(PrintTable.instance,
                             PREVIEW_LBL,
                             prnJob.defaultPage());
    * Insert the method's description here.
    * Creation date: (03-13-2002 10:12:41)
    public static void preview(JTable table, String title, PageFormat pf) {
         m_table = table;
         m_data      = table.getModel();
         m_strTitle = title;
         m_title = new JLabel(title);
         new PrintPreview(PrintTable.instance,
                             PREVIEW_LBL,
                             pf);
    * Insert the method's description here.
    * Creation date: (03-13-2002 10:12:41)
    public static void preview(JTable table, JLabel title) {
         m_table = table;
         m_data      = table.getModel();
         m_title = title;
         PrinterJob prnJob = PrinterJob.getPrinterJob();
         new PrintPreview(PrintTable.instance,
                             PREVIEW_LBL,
                             prnJob.defaultPage());
    * Insert the method's description here.
    * Creation date: (03-13-2002 10:12:41)
    public static void preview(JTable table, JLabel title, PageFormat pf) {
         m_table = table;
         m_data      = table.getModel();
         m_title = title;
         new PrintPreview(PrintTable.instance,
                             PREVIEW_LBL,
                             pf);
    * Show a print dialog box
    * Call the method to print
    * @param JTable table : table to print
    * @param String title : title of the table
    public static void print(JTable table, String title, PageFormat pf) {
         try {
              m_table = table;
              m_strTitle = title;
              m_data     = m_table.getModel();
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(PrintTable.instance, pf);
              // if the print job is cancelled
              if (!prnJob.printDialog())
                   return;
              // print the table
              prnJob.print();
         } catch (PrinterException pe) {
              pe.printStackTrace();
              System.err.println("Printing error: " + pe.toString());
    * Show a print dialog box
    * Call the method to print
    * @param JTable table : table to print
    * @param String title : title of the table
    public static void print(JTable table, String title, PageFormat pf, int orientation) {
         try {
              m_table = table;
              m_strTitle = title;
              m_data     = m_table.getModel();
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(PrintTable.instance, prnJob.defaultPage());
              pf.setOrientation(orientation);
              // if the print job is cancelled
              if (!prnJob.printDialog())
                   return;
              // print the table
              prnJob.print();
         } catch (PrinterException pe) {
              pe.printStackTrace();
              System.err.println("Printing error: " + pe.toString());
    * Show a print dialog box
    * Call the method to print
    * @param JTable table : table to print
    * @param String title : title of the table
    public static void print(JTable table, JLabel title) {
         try {
              m_table = table;
              m_title = title;
              m_data = table.getModel();
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(PrintTable.instance, prnJob.defaultPage());
              // if the print job is cancelled
              if (!prnJob.printDialog())
                   return;
              // print the table
              prnJob.print();
         } catch (PrinterException pe) {
              pe.printStackTrace();
              System.err.println("Printing error: " + pe.toString());
    * Show a print dialog box
    * Call the method to print
    * @param JTable table : table to print
    * @param String title : title of the table
    public static void print(JTable table, JLabel title, PageFormat pf) {
         try {
              m_table = table;
              m_title = title;
              m_data      = table.getModel();
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(PrintTable.instance, pf);
              // if the print job is cancelled
              if (!prnJob.printDialog())
                   return;
              // print the table
              prnJob.print();
         } catch (PrinterException pe) {
              pe.printStackTrace();
              System.err.println("Printing error: " + pe.toString());
    * Show a print dialog box
    * Call the method to print
    * @param JTable table : table to print
    * @param String title : title of the table
    public static void print(JTable table, JLabel title, PageFormat pf, int orientation) {
         try {
              m_table = table;
              m_title = title;
              m_data      = table.getModel();
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(PrintTable.instance, pf);
              // if the print job is cancelled
              if (!prnJob.printDialog())
                   return;
              pf.setOrientation(orientation);
              // print the table
              prnJob.print();
         } catch (PrinterException pe) {
              pe.printStackTrace();
              System.err.println("Printing error: " + pe.toString());
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.util.*;
    import java.awt.print.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import javax.swing.event.*;
    public class PrintPreview extends JFrame
    protected int m_wPage;
    protected int m_hPage;
    protected Printable m_target;
    protected JComboBox m_cbScale;
    protected PreviewContainer m_preview;
    private String lblBtnClose           = "Fermer";
    private String lblBtnPrint           = "Imprimer...";
    protected PageFormat m_pf;
    private String[] scales                = { "10 %", "25 %", "50 %", "100 %" };
    public PrintPreview(Printable target, String title, PageFormat pf) {
         super(title);
         setSize(600, 400);
         m_target = target;
         m_pf = pf;
         JToolBar tb = new JToolBar();
         JButton bt = new JButton(this.lblBtnPrint);
         ActionListener lst = new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              try {
              // Use default printer, no dialog
              PrinterJob prnJob = PrinterJob.getPrinterJob();
              prnJob.setPrintable(m_target, m_pf);
              setCursor( Cursor.getPredefinedCursor(
                   Cursor.WAIT_CURSOR));
              prnJob.print();
              setCursor( Cursor.getPredefinedCursor(
                   Cursor.DEFAULT_CURSOR));
              dispose();
              catch (PrinterException ex) {
              ex.printStackTrace();
              System.err.println("Printing error: "+ex.toString());
         bt.addActionListener(lst);
         bt.setAlignmentY(0.5f);
         bt.setMargin(new Insets(4,6,4,6));
         tb.add(bt);
         bt = new JButton(this.lblBtnClose);
         lst = new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              dispose();
         bt.addActionListener(lst);
         bt.setAlignmentY(0.5f);
         bt.setMargin(new Insets(2,6,2,6));
         tb.add(bt);
         m_cbScale = new JComboBox(scales);
         lst = new ActionListener() {
         public void actionPerformed(ActionEvent e) {
              Thread runner = new Thread() {
              public void run() {
                   String str = m_cbScale.getSelectedItem().
                   toString();
                   if (str.endsWith("%"))
                   str = str.substring(0, str.length()-1);
                   str = str.trim();
                   int scale = 0;
                   try { scale = Integer.parseInt(str); }
                   catch (NumberFormatException ex) { return; }
                   int w = (int)(m_wPage*scale/100);
                   int h = (int)(m_hPage*scale/100);
                   Component[] comps = m_preview.getComponents();
                   for (int k=0; k<comps.length; k++) {
                   if (!(comps[k] instanceof PagePreview))
                        continue;
                   PagePreview pp = (PagePreview)comps[k];
                        pp.setScaledSize(w, h);
                   m_preview.doLayout();
                   m_preview.getParent().getParent().validate();
              runner.start();
         m_cbScale.addActionListener(lst);
         m_cbScale.setMaximumSize(m_cbScale.getPreferredSize());
         m_cbScale.setEditable(true);
         tb.addSeparator();
         tb.add(m_cbScale);
         getContentPane().add(tb, BorderLayout.NORTH);
         m_preview = new PreviewContainer();
         PrinterJob prnJob = PrinterJob.getPrinterJob();
         PageFormat pageFormat = pf;
         if (pageFormat.getHeight()==0 || pageFormat.getWidth()==0) {
         System.err.println("Unable to determine default page size");
              return;
         m_wPage = (int)(pageFormat.getWidth());
         m_hPage = (int)(pageFormat.getHeight());
         int scale = 10;
         int w = (int)(m_wPage*scale/100);
         int h = (int)(m_hPage*scale/100);
         int pageIndex = 0;
         try {
         while (true) {
              BufferedImage img = new BufferedImage(m_wPage,
              m_hPage, BufferedImage.TYPE_INT_RGB);
              Graphics g = img.getGraphics();
              g.setColor(Color.white);
              g.fillRect(0, 0, m_wPage, m_hPage);
              if (target.print(g, pageFormat, pageIndex) !=
              Printable.PAGE_EXISTS)
              break;
              PagePreview pp = new PagePreview(w, h, img);
              m_preview.add(pp);
              pageIndex++;
         catch (PrinterException e) {
         e.printStackTrace();
         System.err.println("Printing error: "+e.toString());
         JScrollPane ps = new JScrollPane(m_preview);
         getContentPane().add(ps, BorderLayout.CENTER);
         setDefaultCloseOperation(DISPOSE_ON_CLOSE);
         setVisible(true);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    * Insert the type's description here.
    * Creation date: (03-12-2002 14:17:45)
    * @author: Alexandre Spain
    public class PreviewContainer extends JPanel {
         protected int H_GAP = 16;
         protected int V_GAP = 10;
    * PreviewContainer constructor comment.
    public PreviewContainer() {
         super();
    public void doLayout() {
         Insets ins = getInsets();
         int x = ins.left + H_GAP;
         int y = ins.top + V_GAP;
         int n = getComponentCount();
         if (n == 0)
              return;
         Component comp = getComponent(0);
         Dimension dc = comp.getPreferredSize();
         int w = dc.width;
         int h = dc.height;
         Dimension dp = getParent().getSize();
         int nCol = Math.max((dp.width-H_GAP)/(w+H_GAP), 1);
         int nRow = n/nCol;
         if (nRow*nCol < n)
              nRow++;
         int index = 0;
         for (int k = 0; k<nRow; k++) {
              for (int m = 0; m<nCol; m++) {
                   if (index >= n)
                        return;
                   comp = getComponent(index++);
                   comp.setBounds(x, y, w, h);
                   x += w+H_GAP;
              y += h+V_GAP;
              x = ins.left + H_GAP;
    public Dimension getMaximumSize() {
         return getPreferredSize();
    public Dimension getMinimumSize() {
         return getPreferredSize();
    public Dimension getPreferredSize() {
         int n = getComponentCount();
         if (n == 0)
              return new Dimension(H_GAP, V_GAP);
         Component comp = getComponent(0);
         Dimension dc = comp.getPreferredSize();
         int w = dc.width;
         int h = dc.height;
         Dimension dp = getParent().getSize();
         int nCol = Math.max((dp.width-H_GAP)/(w+H_GAP), 1);
         int nRow = n/nCol;
         if (nRow*nCol < n)
              nRow++;
         int ww = nCol*(w+H_GAP) + H_GAP;
         int hh = nRow*(h+V_GAP) + V_GAP;
         Insets ins = getInsets();
         return new Dimension(ww+ins.left+ins.right,
                                  hh+ins.top+ins.bottom);
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.border.*;
    * Insert the type's description here.
    * Creation date: (03-12-2002 14:17:06)
    * @author: Alexandre Spain
    public class PagePreview extends JPanel {
         protected int m_w;
         protected int m_h;
         protected Image m_source;
         protected Image m_img;
    * PagePreview constructor comment.
    * @param target java.awt.print.Printable
    public PagePreview(int w, int h, Image source) {
         m_w = w;
         m_h = h;
         m_source= source;
         m_img = m_source.getScaledInstance(m_w, m_h,
              Image.SCALE_SMOOTH);
         m_img.flush();
         setBackground(Color.white);
         setBorder(new MatteBorder(1, 1, 2, 2, Color.black));
    public Dimension getMaximumSize() {
         return getPreferredSize();
    public Dimension getMinimumSize() {
         return getPreferredSize();
    public Dimension getPreferredSize() {
         Insets ins = getInsets();
         return new Dimension(m_w+ins.left+ins.right,
                                  m_h+ins.top+ins.bottom);
    public void paint(Graphics g) {
         g.setColor(getBackground());
         g.fillRect(0, 0, getWidth(), getHeight());
         g.drawImage(m_img, 0, 0, this);
         paintBorder(g);
    public void setScaledSize(int w, int h) {
         m_w = w;
         m_h = h;
         m_img = m_source.getScaledInstance(m_w, m_h,
         Image.SCALE_SMOOTH);
         repaint();

  • Each record of table in new page

    experts help
    i will be having records in table  and each record i want to print in new page.
    suppose if i have 5 records ie 5 items i need to print in 5 pages.
    I was looping at table.
    and printing each record , but all are comming in the same page.
    Please tell me how to acheive

    Hi Siva,
    I have the same requirement in Smart forms. COuld you please let me know how you solved the issue?
    What configuration I need to do in smart form?

  • How to display each record on a new page on Smartforms layout

    Hi,
    I need to know how "each time a new record is displayed..it should be displayed on a new page in Smartforms". How much ever I try using the COMMAND inside the LOOP, it is always printing the records in the loop continiously in a single page with the remaining records moving to the next page only once the first page is full. But what i need is to print first record in the first page, second record in the second page...
    Please let me know the exact steps how to use the COMMAND or any other options to acheive this.
    Thanks!
    Edited by: sap123 on Nov 2, 2008 11:55 AM

    hi,
    create a command just before the main windows display and in its general attributes check the check box go to new page and in its conditions tab..set Falg = X.
    now inbetween the loop of ut table or templet, crete program lines and write the code as below.
    data : lv_lines type i.
    describe table i_vbak lines lv_lines.
    clear flag.
    if sy-tabix LT lv_lines.
    flag = 'X'.
    endif.
    remember that these program lines must be after command...
    Try this,

  • Laserjet 6P won't stop printing - prints a line of junk on each page -not connected to network or PC

    My HP Laserjet 6P won't stop printing.  It prints a few lines of symbols and characters at the top of each page.  The printer is not connected to a network or computer.  I tried shutting the printer off for a long time.   This started when I tried printing from a MAC to the printer, but now there is nothing connected to the printer.
    Any suggestions for resetting, etc.?   I don't know how to reset this printer so I haven't tried anything with the various buttons, etc.

    Disable the "Enable bidirectional support" in the P1102w Properties > Ports.
    Please mark the post that solves your issue as "Accept as Solution".
    If my answer was helpful click the “Thumbs Up" on the left to say “Thanks”!
    I am not a HP employee.

  • How can I print just a select/highlighted portion of a webpage/email? FF prints EVERYTHING on each page, wasting ink.

    I switched form IE to FF. In IE, I could select text (or photos) and print just the portion of web pages and emails that I wanted, thus saving paper and ink. I have not been able to do that with FF. I have to print all of each page, so text, ads, and whatever other extraneous material prints. What a waste! Is there any way to select and print just what I need using FireFox? Currently I have to run both IE and FF to handle my printing and documentation needs. Thank you!

    Still happens with Firefox 12. I wish they'd just fix it, the way it used to be in Firefox 10, without the complicated workaround suggested above.

Maybe you are looking for

  • Alignment of columns in sales order

    Dear Colleagues, User wants to fix his layout in the slaes order screen i.e. VA01. He wanted to align columns as per his requirement. He wants to have the same at all logins of VA01. How to save the changes to reflect all the time.. He made changes m

  • Help!!! I deleted my default icon sets

    OMG I just deleted my default icon set!!! I accidentally overwritten all of them on candybar 2.6..!!! what should I do? Is there any way to restore it without re-installing MacOSX??? I changed my default aqua theme with Shapeshifter. then I decided t

  • "Reset" declared variables to initialized state?

    Hiya! This might sound like a very stupid question, but I have not figured out a way to do this. I am working on a "personal information manager", where users can enter a date in a lovely swing textfield, it get's parsed to Integer and a GregorianCal

  • Does anyone have an iPad 3 that is really slow on safari ?

    I have an iPad 3  I have had it since july 2012 and recently safari has been playing up it has been really slow

  • Resouce Usage Profile

    In resource usage profile values on right and left horizontal lines are in hours like 800h is there any way to remove h , or can assign new value of our choice