DIFFERENT PAGE FORMATS

Hi All.
i have an issue in the form printing.
In  my form I have to pages.
I want the first page in Potroit format and second one in Landscape.
for this requirement,how to deal in Scripts and in Smart forms.
Can any body help me to solve this issue,.
Thanks in advance,
regards,
eswar

With onli one form u cannot achieve this.. but u need to have two same forms .. one with Landscape orientation.. and second with Portrait orientation...
( Otherwise u can go for the SMARTFORMS , with smartforms u can achieve this in a single form )
There is a way to have first page in landscape and second page in portrait.
Use
START_FORM
END_FORM
twice one form in each having different page setting(like landscape....)
See this code:
REPORT ZTEST_LANDSCAPE.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZTEST_02'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = 'ZTEST_02'
LANGUAGE = ' '
STARTPAGE = ' ' <b><u>(*** u can use this option to start printing from the second page )</u></b>
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA1'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA2'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = 'ZTEST_03'
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
CODEPAGE = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'DATA2'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'END_FORM'
IMPORTING
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
CODEPAGE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>reward if it helps u..
sai ramesh</b>

Similar Messages

  • Different page formats in the same document

    Is it at all possible to create an InDesign-document with different page formats? Example: Page 1: 210x297 mm, page 2: 190x297 mm.

    only by using this:
    http://www.dtptools.com/product.asp?id=pcid
    robin
    www.adobescripts.com

  • How to trigger different page formats dynamically in smartforms

    Hi ,
    I have a requirement in smartform,want to trigger different page formants based on country code  for ex if country code is ZA12  then pageformant should be DINA4 else page format should be LETTER.
    Rgrds
    Vasumathi

    Hi,
    According to me, you have to create 2 smartforms, one in DINA4 and other in LETTER format.
    In your driver program, you have to maintain condtion depending on country code.
    if country code = 'ZA12'.
    call fm <--- DINA4 format
    else.
    call fm  <--- LETTER format
    endif.
    Regards,
    Naveen

  • Different page formats in single Smartform

    Hello Experts,
    I have an requirement in my custom Smartforms. I want my first page as by default DINA4 page in where as from second onwards, I want DINA3 page format. Could it be possible? If yes, how I can achieve this? Thanks in advance.

    Hi Mayuresh,
    You can't give two page format in one smartform
    The page format are declared  in form attributes it will be same for all pages
    one thing you can do is change it to landscape or potrait.
    Regards
    Arun VS

  • AP Check different page format

    Hi Gurus ,
    I am printing AP Check using Sapscript . I have to Print the first page in Legal format & Next page inLetter format . How can i control this.
    Thanks in advance

    To achieve this kind of scenario you have to modify your driver program, create two forms with your required formats.
    Now, fix the lenght of main window ex, 10 line items if it is more then 10 items then it should goto next page, now in your driver program, read the size of internal table.. it line items less then or equal to 10 print in first page, if more then 10 items print first 10 items in first page and delete this 10 line items from internal table and pass the rest to second page.
    Rough idea.
    OPEN_FORM  "Open FORM 1
    **USE DO 10 times
    WRITE_FORM " PRINT 10 line items on FORM1
    *Delete this 10 line items from internal table
    **END DO
    CLOSE_FORM  "Close FORM 1
    IF internal table still have values
    OPEN_FORM  "OPEN FORM 2
    WRITE_FORM " PRINT all line items that are left
    CLOSE_FORM
    Regards,
    SaiRam

  • ADOBE READER (9.4.1) prints several files from one Word doc with different pages formats

    I work with Word for Mac, version 11.6.1
    When I have one document with several pages setup (say different sizes, or landscape and vertical orientation) and I need to convert to PDF, I got several PDF files, one for each page section of my document.
    How can I get only one PDF for my whole document ?
    Thanks a lot.
    STURIONE
    Santiago - Chile
    Feb 05, 2011

    Thank you, MichaelKazlow, for your reply/suggestion.
    Actually, I'm not very familiar with this kind of technology, so I'll do my best trying to find out solution following your recommendation.
    Tks again.

  • Multiple page format for single smartforms

    We have a requirement to get the output in different page formates for a smartform.
    How to achieve this???

    suppose you r using a program to print the smartform.
    Just check this program.
    REPORT z_sf_demo1 .
    PARAMETERS p_bukrs LIKE ekko-bukrs.
    DATA: fm_name TYPE tdsfname.
    DATA: ssfctrlop LIKE ssfctrlop.
    Function to get the function name to run SMART FORM.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
    EXPORTING
    formname = 'ZJAYRA_DETAIL'
    VARIANT = ' '
    DIRECT_CALL = ' '
    IMPORTING
    fm_name = fm_name
    EXCEPTIONS
    NO_FORM = 1
    NO_FUNCTION_MODULE = 2
    OTHERS = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To pass parameters for CONTROL_PARAMETERS
    ssfctrlop-no_open = ' '.
    ssfctrlop-no_close = 'X'.
    CALL FUNCTION fm_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = ssfctrlop
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    bukrs = p_bukrs
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    To pass parameters for CONTROL_PARAMETERS
    ssfctrlop-no_open = 'X'.
    ssfctrlop-no_close = ''.
    ssfctrlop-startpage = 'PAGE2'.
    Function to run SMART FORM from third page to last page.
    CALL FUNCTION fm_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = ssfctrlop
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    bukrs = p_bukrs
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ssfctrlop-no_open = 'X'.
    ssfctrlop-no_close = ''.
    ssfctrlop-startpage = 'PAGE3'.
    Function to run SMART FORM from third page to last page.
    CALL FUNCTION fm_name
    EXPORTING
    ARCHIVE_INDEX =
    ARCHIVE_INDEX_TAB =
    ARCHIVE_PARAMETERS =
    control_parameters = ssfctrlop
    MAIL_APPL_OBJ =
    MAIL_RECIPIENT =
    MAIL_SENDER =
    OUTPUT_OPTIONS =
    USER_SETTINGS = 'X'
    bukrs = p_bukrs
    IMPORTING
    DOCUMENT_OUTPUT_INFO =
    JOB_OUTPUT_INFO =
    JOB_OUTPUT_OPTIONS =
    TABLES
    EXCEPTIONS
    formatting_error = 1
    internal_error = 2
    send_error = 3
    user_canceled = 4
    OTHERS = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I have also sent a mail to your gmail id regarding the details of my program.
    Hope your query will be solved.
    <b>Rewards pioint for helpful answers.</b>
    Regards,
    Abhay.

  • Cant print PO - wrong page format

    Hi all
    I have a smartforms to print PO.
    I encounter this problem which some PO cant be print while some other PO can be printed.
    Its quite confusing since only some cant be print.
    Below is the message:
    Form TXT_CONTACT has wrong page format.
    Message no. SSFCOMPOSER026
    Diagnosis
    Form TXT_CONTACT has a different page format than the forms output previously but has been added to the same spool request.
    System Response
    Form TXT_CONTACT ist not processed.
    Procedure
    While forms are formatted (FM SSFCOMP_OPEN to FM SSFCOMP_CLOSE), the page format must not be changed. All forms within one spool request must have the same page format.
    The first page format used, in this case paper format , is applicable to all subsequent forms.
    Please guide me.
    Thanks in advance

    Hi,
    Check the NEXT page's PAGE FORMAT what is used in the smartform and make it the same as that of the FIRST page.
    I believe the POs which are not being able to print do spill over into the next pages.
    Regards,
    Ram

  • Whats mass printing ?multiple page formating?

    whats mass printing ?multiple page formating?

    hi..
    plz follow the mentioned web link for mass printing ..
    and multiple page formatting is ...
    sapscript does not support multiple page formatting where as smartform does.
    Multiple page formating is nothing havinfg different page formats in  a form.
    eg..
    sapscript zform has 3 pages..
    1 page has portrait
    2 page has landscape format and 3rd page has landascape.
    this is not possible with sapscript..it tends to error. however, you can do so in smartform. Also this is sometime possible in sapscript by creating different form for each page and using the same print program.
    regrds,
    shamim.

  • Page Format different than doc

    I have converted a pdf file to a word doc so I can insert into my document but the margins are different and the form is being cut off when I insert.  I cannot change the margins on my document do to the large content. How can I get it to fit?

    Hello Peter,
    All our projects reside on a shared network drive. We both
    have access to them. When I say "my PC" or "my partner's PC", I
    mean that the project is open on my or my partner's PC. But it is
    the same project, not a copy of the project.
    We tried your suggestion, and both projects generated letter
    size documents on my side, and A4 documents on her side.
    Since my original post, we have reinstalled RH as suggested
    on a different message board. This did not solve this problem. We
    have checked and installed update files from the Adobe site - no
    change. We've even had our techies poke around, but they couldn't
    come up with anything.
    Our only working solution so far is to generate the Word
    document and change the page format manually. Which doesn't sound
    too bad, except that 2 of our projects each require 17 different
    pdf files - so it makes for a lot of manual attention as opposed to
    a simple "Batch Generate".
    As I wrote in my first post, I'm not sure if this is a RH
    issue, so I really appreciate any help you can provide.
    Thanks
    Ben

  • !Format event, Global fields & different pages

    Hi, very new to Output Designer and having a couple of head scratching moments with something I've been asked to do.
    I have a requirement to show or not show a barcode dependant on the initial chartacter of an order number. However, the order number and barcode are on different pages. I changed the order number on page 1 to be a global field, but when I go into the !Format event for the barcode field on page 10 it doesn't show up in the globals fields list.
    As a way of testing I put the following code in the format event of another field on page 10, the barcode field page.
    @(If ("@(Substr ("@ORDER_NUMBER.", 1, 1))" == "R", "R", "NOT R"))
    This wouldn't work as it interperates "@ORDER_NUMBER." as a literal string value of @ORDER_NUMBER. and not a global field.
    So, I suppose my question is - Is it possible for a field on one page of a form know what the value of a field on another page is?
    All the best
    Chris

    I believe that if a field is defined as global
    b in the data file
    then it should be able to be referenced on any page. It shouldn't matter what page actually
    b prints
    the field. Effectively, all the global items in the data file are loaded into a "dictionary" and are available for reference anywhere within the form. Unfortunately, the field list provided for the !format event only shows the fields on that page, not all the fields in the form.
    If @ORDER_NUMBER. (as a literal) is what the instruction operates against then the field "ORDER_NUMBER" doesn't exist in the data file. At least that is what some recent testing tells me.

  • Different page sizes in one pdf file will not scale to print correctly

    Hello all,
         I have a pdf document that contains three different page sizes; 8.5"x11", 11"x17" and 34"x22".  These pdf files are custom manuals and we print many of these over the course of a month.
         In the older versions of Adobe Acrobat when printing this type of file, I could click print, select the page setup size to 11"x17", then select shrink oversize pages (or fit, depending), and choose paper by pdf page size and I would get the following pages from the printer - 8.5"x11" page would print on a 8.5"x11" paper, 11"x17" on 11"x17" and (most importantly) 34"x22" on 11"x17".  We do this because our printer does not have paper larger than 11"x17" yet the customer also receives a soft copy of the file and many times prints the large pages full size as needed on their large format plotters.
         With the newer versions of Acrobat, this will not work.  The only way these files will print automatically is to scale the 22"x34" down to 8.5"x11".   Why would I want to scale it smaller than my largest available paper size?  Also, all of the 11"x17" pages in a multi page size document will come out of the printer rotated 180° yet Adobe shows them correctly when the file is opened.
         Also, when I use the settings above, the print preview box shows the document correctly!  The HP technicians have the latest drivers installed and they have shown me where it seems that Adobe is not even sending the larger sheets but instead stops the printing process with an error.  So I try to send a 20 page document but Adobe stops at the first 22x34 page.
         We have now lost our old computers with every last old version of Acrobat that I could use to make this work due to mandatory hardware and OS upgrades.  I must find a way to print these documents without individually selecting different pages to print and then trying to assemble the document afterward.
         How do I preserve the pages sizes in my document and print the large pages scaled down to the largest paper size I have available in my printer?
    Thanks ahead of time.

    Ajlan,
         Thank you for your time.  I am still having the issue.  I am using Adobe reader 11.0.09 and Adobe Acrobat 10.1.12.  Neither one have the option in the print menu that you show for a physical printer.  They only offer that option for an Adobe PDF creation driver.
         It seems as though the printer you have selected in your menu is only for creating a pdf.  I need to physically print the pdf.  Do you have this same option when you select a physical printer?
    (edited to update screen shot)

  • How to use different page scapes in smartforms

    hi
    How to use different page scapes in smartforms.
    I want Potrait format in the 1st page and Lanscape format in 2nd page is it possible if so plz suggest me an idea

    Hi,
    It is possible in smart forms, but not in scripts.
    we can have 3 tabbed options for pages in smart forms.
    <b>General...
    Output options
    Conditions</b>.
    In <b>output options</b> u can define whether a page can portrait or land scape in <b>print attributes</b>.
    Reward if helpful.
    Regards,
    Sandhya

  • Multiple page format's

    Hi ,
    Multiple page formats is possible in script's
    Regards
    Suresh.D

    Hi,
    Yes..It is possible to display multiple page format..
    Create a new form which has a different format...
    Then in the print program..follow the steps
    OPEN_FORM.
    START_FORM with the FIRST PAGE FORMat form
    end_form.
    START_FORM with the SECOND PAGE FORMat form
    end_form.
    CLOSE_FORM
    Thanks
    Naren

  • How do we print multiple components each in a different page?

    hello
    I would like to print multiple JPanels (lets say an array) each in a different page.
    The question I ask is about the following code
             printerJob.setPrintable(printTable.getInstance(), pageFormat);
                  try
                        if (printerJob.printDialog())
                             printerJob.print();
                        }

    Lets say that we have the following code. How do we modify it?
    * This example is from the book "Java Foundation Classes in a Nutshell".
    * Written by David Flanagan. Copyright (c) 1999 by O'Reilly & Associates. 
    * You may distribute this source code for non-commercial purposes only.
    * You may study, modify, and use this example for any purpose, as long as
    * this notice is retained.  Note that this example is provided "as is",
    * WITHOUT WARRANTY of any kind either expressed or implied.
    import java.awt.*;
    import java.awt.print.*;
    import java.io.*;
    import java.util.Vector;
    public class PageableText implements Pageable, Printable {
      // Constants for font name, size, style and line spacing
      public static String FONTFAMILY = "Monospaced";
      public static int FONTSIZE = 10;
      public static int FONTSTYLE = Font.PLAIN;
      public static float LINESPACEFACTOR = 1.1f;
      PageFormat format;   // The page size, margins, and orientation
      Vector lines;        // The text to be printed, broken into lines
      Font font;           // The font to print with
      int linespacing;     // How much space between lines
      int linesPerPage;    // How many lines fit on a page
      int numPages;        // How many pages required to print all lines
      int baseline = -1;   // The baseline position of the font.
      /** Create a PageableText object for a string of text */
      public PageableText(String text, PageFormat format) throws IOException {
        this(new StringReader(text), format);
      /** Create a PageableText object for a file of text */
      public PageableText(File file, PageFormat format) throws IOException {
        this(new FileReader(file), format);
      /** Create a PageableText object for a stream of text */
      public PageableText(Reader stream, PageFormat format) throws IOException {
        this.format = format;
        // First, read all the text, breaking it into lines.
        // This code ignores tabs, and does not wrap long lines.
        BufferedReader in = new BufferedReader(stream);
        lines = new Vector();
        String line;
        while((line = in.readLine()) != null)
          lines.addElement(line);
        // Create the font we will use, and compute spacing between lines
        font = new Font(FONTFAMILY, FONTSTYLE, FONTSIZE);
        linespacing = (int) (FONTSIZE * LINESPACEFACTOR);
        // Figure out how many lines per page, and how many pages
        linesPerPage = (int)Math.floor(format.getImageableHeight()/linespacing);
        numPages = (lines.size()-1)/linesPerPage + 1;
      // These are the methods of the Pageable interface.
      // Note that the getPrintable() method returns this object, which means
      // that this class must also implement the Printable interface.
      public int getNumberOfPages() { return numPages; }
      public PageFormat getPageFormat(int pagenum) { return format; }
      public Printable getPrintable(int pagenum) { return this; }
       * This is the print() method of the Printable interface.
       * It does most of the printing work.
      public int print(Graphics g, PageFormat format, int pagenum) {
        // Tell the PrinterJob if the page number is not a legal one.
        if ((pagenum < 0) | (pagenum >= numPages))
          return NO_SUCH_PAGE;
        // First time we're called, figure out the baseline for our font.
        // We couldn't do this earlier because we needed a Graphics object
        if (baseline == -1) {
          FontMetrics fm = g.getFontMetrics(font);
          baseline = fm.getAscent();
        // Clear the background to white.  This shouldn't be necessary, but is
        // required on some systems to workaround an implementation bug
        g.setColor(Color.white);
        g.fillRect((int)format.getImageableX(), (int)format.getImageableY(),
                   (int)format.getImageableWidth(),
                   (int)format.getImageableHeight());
        // Set the font and the color we will be drawing with.
        // Note that you cannot assume that black is the default color!
        g.setFont(font);
        g.setColor(Color.black);
        // Figure out which lines of text we will print on this page
        int startLine = pagenum * linesPerPage;
        int endLine = startLine + linesPerPage - 1;
        if (endLine >= lines.size())
          endLine = lines.size()-1;
        // Compute the position on the page of the first line.
        int x0 = (int) format.getImageableX();
        int y0 = (int) format.getImageableY() + baseline;
        // Loop through the lines, drawing them all to the page.
        for(int i=startLine; i <= endLine; i++) {
          // Get the line
          String line = (String)lines.elementAt(i);
          // Draw the line.
          // We use the integer version of drawString(), not the Java 2D
          // version that uses floating-point coordinates. A bug in early
          // Java2 implementations prevents the Java 2D version from working.
          if (line.length() > 0)
            g.drawString(line, x0, y0);
          // Move down the page for the next line.
          y0 += linespacing; 
        // Tell the PrinterJob that we successfully printed the page.
        return PAGE_EXISTS;
       * This is a test program that demonstrates the use of PageableText
      public static void main(String[] args) throws IOException, PrinterException {
        // Get the PrinterJob object that coordinates everything
        PrinterJob job = PrinterJob.getPrinterJob();
        // Get the default page format, then ask the user to customize it.
        PageFormat format = job.pageDialog(job.defaultPage());
        // Create PageableText object, and tell the PrinterJob about it
        job.setPageable(new PageableText(new File("file.txt"), format));
        // Ask the user to select a printer, etc., and if not canceled, print!
        if (job.printDialog())
             job.print();
    }thank you in advance

Maybe you are looking for

  • Mini display to my tv

    I have iMac and am trying to connect my iMac to my tv I have got and adapter that goes from mini display to hdmi on tv which the desktop goes onto my tv as lion although I have a different picture but all my icon I can see on my tv but have disappear

  • Setup Installer with Deployment of Postgres DB

    Hello, I am using postgres DB in my windows application.I have successfully created setup installer for my application But i want my setup installer to create Postgres Database with function as well as table.Please suggest me from where i can start a

  • Select nested WMS layers with specific SRS value using XQuery

    A WMS getcapabilities document contains a nested list of Layers. I need to get a list of layers for which is true: - It is queryable and - It has an SRS value of EPSG:28992 or any of it's parent layers (or parents parents etc) has an SRS value of EPS

  • Where is the "keep me logged in" box?

    On the help pages for the new log in arrangements, under 'Saving Time', it says "If you want to save time, use the Email login page and tick the 'keep me logged in box' " There is no "keep me logged in box"! Maddening.

  • Certain web sites require MP3, how do I get that on Firefox

    The netafit.org has music I want to listen to before buying. Firefox does not allow me to listen and an error message says no mp3 features.