i am not sure this a right forum for this question but hopefully you will be able to answer me.
i have recently finished developing java application in netbeans and there is a simple issue of printing the source code. once the code printed each page should be numbered does anyon know any way of making that possible?>
also i have tried printing the code in netbeans and if the line of code exceeds the width of the page new pages is automatically printed instead of printing that line on new line.

kind regards and thank you

5 Years
Discussion Span
Last Post by gedas

Okay, assuming your use Windows, when you try to print the code, Click on Print Options in the print preview page (the page you get after pressing the print button), in here you can fix both of your problems, for reference, here is a screenshot:


To fix the "code on multiple pages" thing, set the "Fit width" option to 1 page. HOWEVER, if you go over the page by a large amount (20 or more chars), then the zoom will make the code small and unreadable. If this is the case for you, you will have to make some of the lines of code multi-lined. Since lines of Java code are ended with a semi-colon, you can spread them over multiple lines, like this:


And that will still function. NetBeans has a red line in the code window that will tell you where the page will break when editing. As I said before, you can use the window width limit if it only goes over by a few chars, so try breaking up the lines into multi-line statements and if any chars still go over the red line, then use the page width limit.

For the page number, you would fix that using the "Print Footer" option, using the buttons below the text boxes to add the macros for page numbers, or if you're lazy, you can just copy-paste this to the left footer and right footer boxes, respectively:

Left Box


Right Box


Hope that helps.

Edited by Tarkenfire: n/a


thanks a lot very helpful,
the code looks good and it saved me lots of time.
keep up the good work!!

thanks again

This question has already been answered. Start a new discussion instead.
Be sure to adhere to our posting rules.