Add new font for cfdocument

Thank you very much @martin for this information. Didn’t know that… very imortant to know it, maybe also for @roryjc . However, sometimes google brings easier answers, because after digging the net I’ve found an OSGi compliant bundle at
https://mvnrepository.com

Downloaded the bundle org.apache.servicemix.bundles.zxing-3.4.0_1.jar:

Saved it to path-to-your/lucee/lib/ext/org.apache.servicemix.bundles.zxing-3.4.0_1.jar

Restarted Lucee(Tomcat), saved the following code as testbarcode128.cfm:

<cfscript>
format  = createObject("java","com.google.zxing.BarcodeFormat");
writer  = createObject("java","com.google.zxing.oned.Code128Writer");
matrix  = createObject("java","com.google.zxing.client.j2se.MatrixToImageWriter");
</cfscript>



<cfset output="My Barcode" />
<cfset barcode=writer.encode(output,format.CODE_128,75,75) />
<cfset image=ImageNew(matrix.toBufferedImage(barcode)) />
<cfoutput>#image#</cfoutput>

Loaded the page, worked.

1 Like

Hey Andreas, that worked fine and when i eventually restarted my server all the other attempts i had done on the same DEMO.cfm that didn’t work before also jumped into life !

it was a veritable sea of qr and 128 bar codes !

just got to assign them as server vars now in my implementation.

thanks guys.

1 Like

I have had this working on a server for years, when I migrated and installed on a new server I am getting the error: No matching Method for toBufferedImage(com.google.zxing.common.BitMatrix) found for com.google.zxing.client.j2se.MatrixToImageWriter

Can anyone help me figure that out?

@joebruin916 would you please give some information about your setup? On what OS did you install it? What servlet engine (Tomcat, Undertow with CommandBox)? How did you install it and what did you do, so we can reproduce the error? By the way… show some code that throws the error.

@andreas Thank you very much for asking…

My former server that is working is CentOS 7, my new server is Almalinux 8. They are both colocated VPSes with CPanel. I installed Lucee with the .run file downloaded from Lucee with nearly a default setup (I had to make an Apache include after for CPanel).

On my previous server I had core-3.4.1.jar and javase-3.4.1.jar inside of /opt/lucee/tomcat/lib/

I tried those files and I also tried updating to 3.5.2 to see if that would help. Rebooted the server each time.

The code that you put works on the old server and gives that message on the new.

<cfscript>
format  = createObject("java","com.google.zxing.BarcodeFormat");
writer  = createObject("java","com.google.zxing.oned.Code128Writer");
matrix  = createObject("java","com.google.zxing.client.j2se.MatrixToImageWriter");
</cfscript>

<cfset output="My Barcode" />
<cfset barcode=writer.encode(output,format.CODE_128,75,75) />
<cfset image=ImageNew(matrix.toBufferedImage(barcode)) />
<cfoutput>#image#</cfoutput>

Would appreciate if you have any idea on what I might be forgetting or would have done.

Thank you very much!

I had several WEB-INF/lucee/lib folders, what finally worked for me was /opt/lucee/tomcat/lib

Thanks

If you want a custom directory, you can try to use in Application.cfc

this.javaSettings = { LoadPaths = [".\java_lib\",".\java\myjar.jar"] }

1 Like