Header and footer on print?

How do I put header and footer in my print method? Can anyone plz help me with this, am stuck.... My method looks like this:
public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException
     Graphics2D g2 = (Graphics2D)g;
g2.setColor(Color.black);
Dimension d = scroll.getSize();
double panelWidth = d.width;
double panelHeight = d.height;
double pageHeight = pf.getImageableHeight();
double pageWidth = pf.getImageableWidth();
double scale = pageWidth/panelWidth;
int totalNumPages = (int)Math.ceil(scale * panelHeight / pageHeight);
if(pageIndex >= totalNumPages)
     return Printable.NO_SUCH_PAGE;
g2.translate(pf.getImageableX(), pf.getImageableY());
g2.translate(0f, -pageIndex*pageHeight);
g2.scale(scale, scale);
scroll.paint(g2);
return Printable.PAGE_EXISTS;
}

You have two options:
1) Insert header and footer objects (which can be as simple as a panel with a label in it) - into your pages prior to printing.
2) Insert header/footers into the pageables passed to your print routine.
I used method one - worked nicely.

Similar Messages

  • I want to remove the header and footer when printing from my mac, i can do this in the Page Setup on my PC but not on the Mac. I can do it each time I print but then it resets. How do I make a universal change?

    I want to remove the header and footer when printing from my mac, I can do this in the Page Setup on my PC but not on the Mac. I can do it each time I print but then it resets. How do I make a universal change?
    == This happened ==
    Every time Firefox opened

    Go to the "File" menu, then "Print." The window that appears will have three drop-down menus at the top.
    The first is labeled "Printer",
    The second is "Presets".
    The third is unlabeled but has "Copies & Pages" selected by default.
    Click on that third menu and select "Firefox" near the bottom of the list.

  • Page Header and Footer in Printer Friendly mode

    Hi,
    I have a report which has more than 500 rows and I want to print them.
    The printer friendly mode works fine, but is it possible that there is a page "header" and "footer" on every page which is printed?
    For example, that the column headings are on every page which was printed?
    Or that at the bottom of each page is the page number displayed?
    Does anyone have an idea?
    Thanks,
    Tim

    IE and Firefox are designed for WEB pages.
    WEB pages are on Internet. Security is important and browser should not compromise user to use it.
    Many users=Many printers!
    If you want to write app for especially one printer and know users (Intranet application) then here is what you can do:
    1) Use IE
    2) write your own ocx with interface for your needs.
    3) every user should implement this ocx in their browser.
    4) When they accept your ocx, then in this "small app" you could do as much as this user can do on their own windows. So setting printer, orientation and size is a peace of cake.
    5) make your report regarding this printer
    And this is it!
    And few other things...
    If user choose larger font then your HTML is broken!!!
    For that I think that PL/PDF or Mail merge is better solution!

  • Conditional Header and Footer description print in Report

    Hello,
    Is it possible to print different header or footer of a report depend on condition.
    My requirement to change the header and footer description on a fly depend upon the parameter passed to the report.
    Any soultion ...
    Sam

    hello samar
    of course this is possible. paint your first desidered header/footer, place it in frame and add format trigger on this frame to display it when you want it, otherswise return false. the same is for other possible headers/footers. then place all those frames on same position. look at conditions to display only one header/footer at a time :)
    or seccond (in case of simplier structure) is to place in header/footer only one bolierplate text with value f.e. &p_footer and then send value you want to see in footer n parameter p_footer ...
    hth
    Petr Valouch, Brainbench MVP for Oracle Programming, http://www.brainbench.com

  • How to print (on paper) expected header and footer while printing Jtable

    Hello,
    I am printing jtable on paper using dot mtix printer.In header i want to print some name date and number like below
    Sun
    Date:12/8/20010 No.12334
    | col1 | col2 |
    | col1 | col2 |
    footer
    When i am trying to print header its Font size is very big and its in one line.How i can use expected font and expected text here.
    i am using jtable print method(which contin header and footer printing facility)
    Edited by: Ashtekar on Aug 12, 2010 5:18 AM

    I also once hoped for an easy way to modify a table's header and footer, but found no way.
    Yet it is possible.

  • Header and footer of RTF template not getting carried over to Excel output

    We have Header and Footer in RTF template defined. The output of the report will be in Excel. When we run the report, the header and footer on the report are not getting carried over to excel has header and footer, instead the header and footer are printed as first line on the excel. Also, the RTF template is set to landscape but when the output is generated in excel, it is set to Portrait

    hi..
    chk this presentation...
    http://csc-studentweb.lrc.edu/swp/Berg/articles/NW2004s_what_is_new.ppt#352,3,Why NW 2004s?
    http://www.sap-hefte.de/download/dateien/1090/086_leseprobe.pdf'
    hope this helps...

  • Repeating Header and Footer on each page in Sub-Report

    Post Author: Jimbob
    CA Forum: General
    I am formatting a report that has subreports.  I can get the header on every page, but the footer only appears on the last page. 
    How do I get a header and footer to print on each page of the subreport?
    Thanks for any help!

    Post Author: Guy
    CA Forum: General
    Hi,
    You should add a first level of grouping in your subreport on a fake formula field with a constant value.  Put your header and footer information in this group header and footer.  In the group option make sure to check the "repeat group header on each page option".
    This group will act as a page header + footer within your subreport.
    good luck!
    Guy

  • Avoid printing Header and Footer in the last page

    Hi,
    Could anyone please let me know how to avoid print the header and footer in the last page?
    Note: I'm printing RTF template for publishing the output.
    Looking forward for your valuable inputs/suggestions.
    Thanks in advance,
    Regards,
    Muru

    Hai,
    My report got FROM PO & TO PO parameters and i need to print footer only in first page of each PO. Tried with section but now i am getting first page of all PO contionious and then all lines together.
    Please call me or sent replies to [email protected]

  • Customizing header and footer in the printed documentation

    Hi,
    I'm using a trial version of RoboHelp 2007 and Word 2003.
    I have two question about customizing the header and footer
    of the printed documentation.
    In the printed documentation the footer repeat at the bottom
    of each page and contain page numbers, which appear left-justified
    on even-numbered pages and right-justified on odd-numbered pages.
    How can I customize the footer, that pages numbers appear
    always right-justified?
    In the printed documentation the header repeat at the top of
    each page and are blank on the first page of sections. The name of
    the manual appears on even-numbered pages, left-justified. The name
    of the root chapter appears on odd-numbered pages, right-justified.
    How can I customize the header, that
    on every page the name of the root chapter and the name oft
    the manual appears? Furhermore I want to include a picture in the
    header. How can I realise this?

    You can't from RH. See the article on my site.
    Images in the header are tricky. If you use the setting that
    I think enables that, you will also get the images in the TOC. Try
    putting a two cell table and putting the heading in one and the
    image in another.

  • How to print Header and footer in same page

    Hi All,
    I am using Oracle Report 10g. How can I add header and footer on same page as my body? Right now when a generate a pdf file, it is printing individual pages instead of 1 one page. Please help me.
    Regards

    HI
    First of all,
    Unless otherwise you selected some option like page break after/before - both body and header/footer will print on same page in report, so in pdf as well.
    If you have difference on report and PDF that you should look into your setup.
    If you want more help, please be particular on your issue
    james. wrote:
    Hi All,
    I am using Oracle Report 10g. How can I add header and footer on same page as my body? Right now when a generate a pdf file, it is printing individual pages instead of 1 one page. Please help me.
    Regards

  • How to print header and footer in SET_TABLE_FOR_FIRST_DISPLAY

    Hello Experts,
             How to print header and footer while using the method SET_TABLE_FOR_FIRST_DISPLAY, any tips from the experts will be appreciated.
    Regards,
    Babu

    Hi,
    there are four events for printing: print_end_of_list, print_top_of_list, print_end_of_page and print_top_of_page. More information about implementing these events is in this bible for ALV:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907
    Cheers

  • How do you print from safari without the header and footer?

    I may be missing something but...
    When printing in Safari how do you remove the header and footer.  I am using PDF creator to save pages as PDF for things like online pay slips and want them to be 'clean'.
    Running Safari 5.1 on Windows Vista
    Thanks in advance for any help.
    Mark

    I may be missing something but...
    When printing in Safari how do you remove the header and footer.  I am using PDF creator to save pages as PDF for things like online pay slips and want them to be 'clean'.
    Running Safari 5.1 on Windows Vista
    Thanks in advance for any help.
    Mark

  • Header and Footer Print Margins

    Is it possible to increase header and footer margins slightly in Safari 4.0.4? My printer cuts off about half of the header type at the default margin values for US Letter.
    Custom page sizes with larger margins and scaling down do affect the printed contents of a page, but not the headers and footers.
    Pages opened in Preview from the Print dialog and then printed from there, all at default US Letter, are resized and do not cut off the header type. But only by doubling the size of the default margins, reducing the pages, and requiring two steps to simply print.
    Any suggestions sure are appreciated.

    Im having the exact same issue. The **** headers and footer are always getting cut off. Anyone with more practical advice would be much appreciated. This is driving me nuts.........

  • Is it possible to resize the header and footer on a webpage before you print the page you want the print?

    It seems to me the header and footer on every page I want to print is so darn small. If possible I'd like the header and footer size in Firefox to be close to the size of my other browser, Microsoft's IE8 browser.

    Glad I could help.
    But not all of us are gentiles.

  • How to print jTable with custom header and footer....

    Hello all,
    I'm trying to print a jTable with custom header and footer.But
    jTable1.print(PrintMode,headerFormat,footerFormat,showPrintDialog,attr,interactive)
    does not allow multi line header and footer. I read in a chat that we can make custom header and footer and wrap the printable with that of the jTable. How can we do that..
    Here's the instruction on the chat...
    Shannon Hickey: While the default Header and Footer support in the JTable printing won't do exactly what you're looking for, there is a straight-forward approach. You can turn off the default header/footer and then wrap JTable's printable inside another Printable. This wrapper printable would then render your custom data, and then adjust the size given to the wrapped printable
    But how can i wrap the jTable's Printable with the custom header and footer.
    Thanks in advance,

    I also once hoped for an easy way to modify a table's header and footer, but found no way.
    Yet it is possible.

Maybe you are looking for

  • Problem in loading of flat file transaction data into BI7

    Hi Experts, I am new to BI7, got in problem in creation of Data source. I have fields in flat file are: CUSTID,SREPID,MATID,PRICE PER UNIT,UNIT,QUANTITY,TRANS.DATE one of the row under the above fields is C100,SR100,MAT01, 50,CS,5,19991005 Created in

  • Best practice question regarding media

    Okay, I've finally decided to convert all of my old VHS and MiniDV tapes to .mov files so I can host them on my Plex server for family & friends across the country to be able to view them online. All of these tapes contain various recordings that fea

  • LOCAL CHURCH COMPUTER 'ON THE BLINK'    PLEASE GIVE US ASSISTANCE

    OUR COMPUTER SYSTEM SEEMS TO HAVE A 'BUG' - ON A GIVEN DAY, THE COMPUTER SCREEN LOOSES OUR WORK, AND THEN I FIND THIS MESSAGE, DISPLAYED IN A WORDFILE, WITHIN AN ICON. HERE IS THE MESSAGE: PLEASE ASSIST WITH INFORMATION. THANK YOU MUCH. MRS. D. BOGGS

  • Oracle Waveset 8.1.1

    Could someone please tell me when the patch for Oracle Waveset 8.1.1 will come out?

  • XpressMusic 5800, IM+ (and other apps) certificate...

    Hello. I have some problems with application in Menu->Download!. For example I want to download IM+, it tells me that it's free, I choose "get" and after IM+ downloaded, phone shows me error message "Expired Certificate". I get same error message the