Forum How do I...?

Pass license key string to Java wrapper

brian.kotek
I am trying to pass my license key to Prince via the Java wrapper object, using `setLicenseKey()`, but it never has any effect. I have looked at other forum posts about the license key and have tried it both with and without a value in the `<signature></signature>` block.

I know the license is valid because if I save it to a file and point Prince at the file (using `setLicenseFile()`) it works.

The debug log doesn't really help because it never mentions anything about trying to use any passed license key, all I ever see logged are attempts to read a license key file, like this. (For some unknown reason, Prince will try to read this blank license.dat file even though I have never created or used it...)

Thu Oct 16 13:39:28 2025: debug: loading license: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat
Thu Oct 16 13:39:28 2025: debug: loading /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat because it is the main resource
Thu Oct 16 13:39:28 2025: loading document: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat
Thu Oct 16 13:39:28 2025: debug: loaded resource: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat
Thu Oct 16 13:39:28 2025: debug: loaded resource: type: no
Thu Oct 16 13:39:28 2025: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat:1: error: Document is empty
Thu Oct 16 13:39:28 2025: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat: warning: could not load license


As you can see, no reference at all to the key I passed in. Again, though, if I specify a path to MY license file, it does work (no watermark):

Thu Oct 16 13:46:22 2025: debug: loading license: /usr/local/bin/prince_license.dat
Thu Oct 16 13:46:22 2025: debug: loading /usr/local/bin/prince_license.dat because it is the main resource
Thu Oct 16 13:46:22 2025: loading document: /usr/local/bin/prince_license.dat
Thu Oct 16 13:46:22 2025: debug: loaded resource: /usr/local/bin/prince_license.dat
Thu Oct 16 13:46:22 2025: debug: loaded resource: type: no


Even trying it straight from command line gives the same result:

prince --control --debug  --license-key='<license id="x">my key with or without value for signature</license>'
ver 11
Prince 15.3
end
msg|dbg||init locking for OpenSSL
msg|dbg||loading license: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat
msg|dbg||loading /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat because it is the main resource
msg|inf||loading document: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat
msg|dbg||loaded resource: /opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat
msg|dbg||loaded resource: type: no
msg|err|/opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat:1|Document is empty
msg|wrn|/opt/homebrew/Caskroom/prince/15.3/prince-15.3-macos/lib/prince/license/license.dat|could not load license


Any help appreciated.

Thanks
mikeday
The --license-key option is used to specify the value of the signature element only, so that element can be left empty in the file like "<signature></signature>" and specified on the command-line instead.
brian.kotek
Wow, thanks, this was driving me completely insane.

It would be great if they just let us pass the entire license as a param instead of having to mess around with still having a file, without the signature block, and passing in only the signature. If I can dynamically provide the signature I should just be able to dynamically provide the whole string.
mikeday
I suppose you could do this by passing a data URL to the --license-file option?