B4J Question Poor quality of printout using jFX8print

jantorun

New Member
Licensed User
Longtime User
Hello,

I am struggling with simple printing on A4 paper and also on PDF-printer using the jFX8print library.
The printout has a week quality/resolution for text and barcode:

Example.jpg


As I need to scan the barcode from the printout it is essential for me to have a much better resolution.
The small project is attached. Any support is welcome.
Jan
 

Attachments

  • PrintTest.zip
    31.7 KB · Views: 298

sfsameer

Well-Known Member
Licensed User
Longtime User
Hello,

I am struggling with simple printing on A4 paper and also on PDF-printer using the jFX8print library.
The printout has a week quality/resolution for text and barcode:

View attachment 112760

As I need to scan the barcode from the printout it is essential for me to have a much better resolution.
The small project is attached. Any support is welcome.
Jan
Hello,

Am trying to run the project to find out where the problem is but am missing the following jar : java-barcode-2.0.3.jar

Could you please upload it so i can check the project problem.

Thank you,
Saif
 
Upvote 0

jantorun

New Member
Licensed User
Longtime User
Attached is the Lib.
It is not only the barcode that has poor resolution but also simple text (e.g. a font 8dot is so milky that it is almost unreadable).

Thanks
Jan
 

Attachments

  • java-barcode-2.0.3.jar
    130.3 KB · Views: 297
Upvote 0

jantorun

New Member
Licensed User
Longtime User
Solved: Using scaled output

Hello,

by looking at the example provided by Steve together with the lib I saw that I ignored the scaleoutput routine which is essential.
I added this to my project (attached) and now the printout is much better (on pdf and on paper):
TestPrint.jpg

These steps were done:
- The canvas and the items on it (values referred to 1/72") have to be blown up, in my case *4.5
- The output has to be sclaed with a routine like this (source is from Steve, I added a small Zoomfactor):
Printpage with calling ScaleOutput:
PJ.PrintPage(ScaleOutput(PJ.GetPrinter,PrintCanvas, 1.2))
Scale Output:
Sub ScaleOutput(P As Printer, N As Node, ZoomFactor As Double) As Node
    Dim PL As PageLayout = P.GetDefaultPageLayout
    Dim ScaleX,ScaleY As Double
    Dim NJO As JavaObject = N
    Dim JO As JavaObject = N
    ScaleX = ZoomFactor * PL.GetPrintableWidth / JO.RunMethodJO("getBoundsInParent",Null).RunMethod("getWidth",Null)
    ScaleY = ZoomFactor * PL.GetPrintableHeight / JO.RunMethodJO("getBoundsInParent",Null).RunMethod("getHeight",Null)
    Dim SJO As JavaObject
    SJO.InitializeNewInstance("javafx.scene.transform.Scale",Array(ScaleX,ScaleY))
    NJO.RunMethodJO("getTransforms",Null).RunMethod("add",Array(SJO))
    Return NJO
End Sub

Regards
Jan
 

Attachments

  • PrintTest.zip
    31.6 KB · Views: 291
Upvote 0
Top