B4J Tutorial ? Printing on A4 and Letter sized paper

Hello all,
As the title say, this is a quick tutorial on how to print on A4 or Letter sized paper using the follow information provided by Steve Laming (better known as @stevel05).

CLICK HERE for B4J Print JavaFX 8

I have attached two PDF files showing example printouts for both A4 and letter sized paper. It's actually extremely easy to adjust the layouts for any size paper so just give it a go, I've also attached the example project I created just for this post.

A4 is the main paper size used in the UK, I believe Letter size is mainly used in the US (but I could be wrong). In the UK lots for firms with warehouses use Letter sized paper for business to business with carbon copy paper sheets when delivery stock, the delivery driver keep a copy, so does the firm receiving the goods.

Anyway, what tutorial you are thinking, I've just been banging on about nothing interesting. Well you are learning from the attached source code and by looking at the screenshots and PDF files, it's that simple really ;)

I used Scene Builder but I would highly recommend that you use the B4J native built-in designer, you will get the exact same results.

Layout preview/design in Scene Builder
A4Preview.png


Layout outline/design in Scene Builder
A4Outline.png


Enjoy...
 

Attachments

  • Pint on A4.pdf
    51.2 KB · Views: 1,064
  • Print on Letter.pdf
    49.9 KB · Views: 814
  • PrintA4Letter.zip
    69 KB · Views: 1,192
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Hmm, now how did I know that question was going to arise, I should put some money on the lottery this weekend lol.

One question though, why have you used the Scene Builder and not the B4J Visual Designer?

Okay, there's no actual reason whatsoever.
The example created by Steve was using SB, as I know how to use SB I just created the layouts using SB even though using the built-in native designer was an option too. I just did it, why, I have no idea, I just did?

It was only afterwards I though to myself that I could and should have used the native built-in designer, but by that time I only had about 2 days left to finish the project and there's no harm in using SB, it will not kill the app so I just rolled with it.

You will get the same results using the native built-in designer even though I personally didn't use it, I just didn't, I should have, but I didn't ;)
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
After thinking about it for a while, I now know and realised why I didn't use the native designer @inakigarm.

I originally found Steve's example which used SB, straight away I started to modify and figure out both A4 and Letter paper sizes still using Steve's original B4J project which was using SB, I was modifying Steve's original layout. Once I had figured out the two paper sizes (layouts) by printing PDF files as proof of concept (which took about 15 minutes), I just saved the two files and imported them directly into the B4J project that I was working on, thus I used SB instead of native designer.
 
Last edited:

Peter Simpson

Expert
Licensed User
Longtime User
Is possible run this in linux server with cups?

What you mean with Common UNIX Printing System?

Dunno, maybe, maybe not, I don't really know.
I've only tested my print server solution on a PC and a Mac, both ran absolutely perfect...
 
Last edited:

stevel05

Expert
Licensed User
Longtime User
ts possible run this in linux server with cups?
The easiest way to find out is to try it, I just did a quick search on Google and there are a few posts about it, so it appears it may. But you would need to try it.
 

aeric

Expert
Licensed User
Longtime User
Nice!
Let say I created a program to print barcode labels on A4 or Letter size paper with the FXML template, I can let the user use the Scene Builder to modify the design by drag and drop or change the label properties if they want to.
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello Aeric,
I can let the user use the Scene Builder to modify the design by drag and drop or change the label properties if they want to.
You can but I wouldn't and didn't.

In my invoicing and stock control solutions, I've created a drag and drop layout editor which only took a few hours develop, it stores each views x and y top/left locations. This way my customers can move views around on different printable layouts without contacting me to edit or create new layouts for them, they can do it themselves. The view locations are stored automatically once the left mouse button is let go off. I create default printable templates that customers can then manipulate or leave as they are. Any views that the customer does not want printing, can be dragged off the page to the right hand side to the safe area. Just create and include a layout editor for your customers to use, it's easier and a lot better for the end user as it's incorporated into the same package.

Basic B4J header layout:
Below is a screenshot in the B4J designer of the editable header layout. Users can decide how document headers will look whilst printing on A4 paper.
1000080711.jpg


Bonus:
The images below are taken from my Facebook and Twitter accounts. All the layout are designed in B4J, A7 is a custom paper size.


1000080708.jpg

1000080710.jpg


I decided to add 4 smaller custom ISO A7 paper size printable kanban cards to my Kanban creator software. A7 measures 74 millimeters by 105 millimeters in size.

Left side is A7, right side is A6.
1000080706.jpg


Some examples of my A6 warehouse Kanban cards. These cards as well as others are created using B4J designer and printed using B4J Print Java FX8.
1000080707.jpg

I've developed a beta version of my kanban card printer software. The kanban layouts views are drag and drop, but I've not released that version to my customers as yet as I don't think that they really need it in this case.


Enjoy...
 
Last edited:

Magma

Expert
Licensed User
Longtime User
@Peter Simpson Will be nice-interesting, if you can share the part of code printing at columns how you manage it, for many line items - also if have multiple pages? ... because as i see you have every column as one label (for ex. LblProdCode).
1759571726664.png
 
Top