1

Does anyone have any idea how to get a Java Applet to work in a CiviCRM Extension? In particular, I'm trying to load the QZ-Print applet.

The first problem I'm having is getting the location of the jar. Currently the code to embed the applet is (where the applet is in www/qz-print/ dir on the localhost):

<applet id="qz" name="QZ Print Plugin" code="qz.PrintApplet.class" archive="/qz-print/qz-print.jar" width="100" height="100"></applet>

The code is in the main page TPL file for my extension. This seems to (sometimes) completely hang the web page/browser... On the occasion where it does load the page, I get the following: "SecurityException JAR should not contain JNLP-INF/APPLICATION.JNLP".

Anyways, I'm at a loss for what to do right now. Any help on getting an applet to work with an extension would be greatly appreciated.

UPDATE: So I looked into this and realized that I need to load the JNLP file. So I'm doing that now. HOWEVER, I'm having trouble getting the path to the jnlp/jar file. When working with an extension paths aren't typical.

How does one go about getting the path to the JAR/JNLP within an extension?

Thanks!

2

It looks like the archive path is incorrect. You can make it an absolute path by assigning it to the template from php:

$path = CRM_Extension_System::singleton()->getMapper()->keyToBasePath('myextension');
$this->assign('basePath', $path);

Your archive url can then begin with the smarty variable {$basePath}

  • Coleman, thanks. I was able to use this to get the path that I needed. I was finally able to get qzprint working and now I am able to print barcodes/labels from my extension! – Sleewok Jun 22 '15 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.