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: 908
  • Print on Letter.pdf
    49.9 KB · Views: 659
  • PrintA4Letter.zip
    69 KB · Views: 1,026
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.
 
Top