Hi Peter,
I hadn't added it to the library simply because it isn't documented as part of the API in java 8 and I didn't know about it.
It appears in the documentation for Java 9 and I have tried it in Java 8 and it seems to be available as it didn't crash. I don't have a printer to try it on but you can create the following two classes and try it out.
Class PrinterResolution as a Standard Class:
#IgnoreWarnings:12
'Class Module
Sub Class_Globals
'Private fx As JFX ' Uncomment if required. For B4j only
Private TJO As JavaObject
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
'Initialize the static sub so that field names will be updated. If you don't use the standard naming conventions you will need to change the class name
End Sub
'Construct a new printer resolution attribute from the given items.
Public Sub Create(CrossFeedResolution As Int, FeedResolution As Int, Units As Int)
'If a JavaObject has been passed, you may need to create it here and remove the parameter
TJO.InitializeNewInstance("javax.print.attribute.standard.PrinterResolution",Array As Object(CrossFeedResolution, FeedResolution, Units))
End Sub
Public Sub AsJavaObject As JavaObject
Return TJO
End Sub
'Get the name of the category of which this attribute value is an instance.
Public Sub GetName As String
Return TJO.RunMethod("getName",Null)
End Sub
'Returns the wrapped object as Object
Public Sub GetObject As Object
Return TJO
End Sub
'Comment if not needed
'Set the underlying Object, must be of correct type
Public Sub SetObject(Obj As Object)
TJO = Obj
End Sub
PrinterResolution_Static As a Static Class
'Code Module
Sub Process_Globals
'Private fx As JFX ' Uncomment if required. For B4j only
End Sub
'Value to indicate units of dots per centimeter (dpcm).
Public Sub DPCM As Int
Dim TJO As JavaObject
TJO.InitializeStatic("javax.print.attribute.standard.PrinterResolution")
Return TJO.GetField("DPCM")
End Sub
'Value to indicate units of dots per inch (dpi).
Public Sub DPI As Int
Dim TJO As JavaObject
TJO.InitializeStatic("javax.print.attribute.standard.PrinterResolution")
Return TJO.GetField("DPI")
End Sub
'Construct a new printer resolution attribute from the given items.
Public Sub NewPrinterResolution(CrossFeedResolution As Int, FeedResolution As Int, Units As Int) As PrinterResolution
Dim TObj As PrinterResolution
TObj.Initialize
TObj.Create(CrossFeedResolution,FeedResolution,Units)
Return TObj
End Sub
Then you can create a new printer resolution object like this:
Dim PR As PrinterResolution = PrinterResolution_Static.NewPrinterResolution(120,144,PrinterResolution_Static.DPI)
I'm not sure how to apply it, if it doesn't work as expected, please post a link to the sample code you found and I'll take a look.
The PR Object is wrapped, so you will need to use PR.GetObject to apply it. Once I know how it is applied, i will amend the library to unwrap it automatically.
Hopefully that will do the trick.