B4J Tutorial Printing on A4 and Letter sized paper

Discussion in 'B4J Tutorials' started by Peter Simpson, Nov 14, 2018.

  1. Peter Simpson

    Peter Simpson Expert Licensed User

    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...
     

    Attached Files:

    Last edited: Nov 17, 2018
  2. inakigarm

    inakigarm Well-Known Member Licensed User

    Thanks for sharing !

    One question though, why have you used the Scene Builder and not the B4J Visual Designer?
     
    Peter Simpson likes this.
  3. Peter Simpson

    Peter Simpson Expert Licensed User

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

    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: Nov 14, 2018
    inakigarm likes this.
  4. Peter Simpson

    Peter Simpson Expert Licensed 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: Nov 17, 2018
  5. Don Oso

    Don Oso Member Licensed User

    Awesome !! thanks for sharing your solution its great!

    Its possible run this in linux server with cups?

    Thanks
    Javier.
     
  6. Peter Simpson

    Peter Simpson Expert Licensed User

    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: Nov 19, 2018
  7. stevel05

    stevel05 Expert Licensed User

    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.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice