jCapture

jCapture is a plug-in for DokuWiki. It allows to capture screen shots and upload them directly to DokuWiki media manager without having to save into a file. With jCapture you can quickly create documentation pages for UI-rich software products.

License

GPL v 2.

Release date

2011/04/09

Requirements

jCapture is an applet. It was tested in FireFox 3.6 and IE, and DokuWiki 2009-12-25c. It requires Java 7 or above.

Resources and downloads

FilenameFilesizeLast modified
jcapture.zip962.3 K2011/12/08 22:39

Download and Installation

Download and install the plugin using the Plugin Manager and the URL (http://www.hammurapi.com/products/jcapture/jcapture.zip) given above.

The applet attempts to download some resources dynamically. Therefore, the applet codebase is set /somenonexistingcodebase because the web server must return proper error code for the applet to work correctly. If this attribute is not set, codebase defaults to page location. In this case DokuWiki returns “Page does not exist” with status code 200 and the applet fails.

If your server doesn't return proper error codes for non-existing resources but rather some customized pages, you should configure some URL on the server to return proper error codes and point applet's codebase to that location.

Usage

Once you install the plug-in, there will be a new tool bar item as shown below

When you click on the toolbar button, a translucent window shows up1). Select “No” if browser asks whether to block unsigned content.

Move and resize the window as required. If the “Border” checkbox is checked, then the capture will have a border. Then double-click the window client area. A file name dialog will pop-up with auto-generated file name. Change the name if required and click OK. The image will be uploaded to the web and a link to the image will be inserted into the cursor position in the edit area. For large images/slow connections a progress dialog appears after several seconds and disappears once upload is complete. If upload is successful, the capture window disappears. In the case of a problem an error dialog pops-up and the window remains visible for another capture attempt.

Installation and applet permissions

jCapture applet jars are signed and trusting the applet content is all you have to do to make it work - just click the Run button (see below).

If you run into permission problems (which should never happen), you may need to grant the following permissions to the applet codebase as shown below

grant codeBase "http://localhost/dokuwiki/lib/plugins/jcapture/lib/-" {	 
  permission java.awt.AWTPermission "setWindowAlwaysOnTop";	 
  permission java.net.NetPermission "getProxySelector";	 
  permission java.awt.AWTPermission "createRobot";	 
  permission java.awt.AWTPermission "readDisplayPixels";	 
  permission java.net.SocketPermission "*:*", "connect, resolve";	 
};

Replace http://localhost/dokuwiki with the URL of your DokuWiki installation. The last permission is needed to connect through proxy. If you know address(es) and port(s) of your proxy server(s), then you can replace “*.*” with server(s) IP adress(es) and port(s).

You can use policytool or edit .java.policy file directly.

Image format

Default image format is GIF. You can change image format by changing file extension of the capture. The plug-in capitalizes the extension and passes it as image format parameter to javax.imageio.ImageIO.write() method. Therefore, all formats supported by this class are supported by the plug-in. On Java 6 update 21 supported formats are: BMP, JPG, JPEG, PNG, WBMP, GIF. We tested gif, jpeg, and png extensions - it works fine!

Troubleshooting

If the plug-in doesn't work, check Java console and Error console (if you are using FireFox).

Building from sources

Below is an Ant build file to compile sources, create a jar file and sign jars. Keystore password is passed to the signjar task through storepass property. This article describes how to create a keystore and a key.

Replace _key_alias_ and _path_to_keystore_ placeholders with real values.

The build file expects sources to be in src folder and dependency jars to be in lib folder.

build.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="build">
	<target name="build">
		<delete dir="build" failonerror="false" />
		<mkdir dir="build/jcapture" />
 
		<delete file="lib/jcapture.jar" failonerror="false" />
 
		<javac srcdir="src" debug="on" destdir="build/jcapture">
			<classpath>
				<fileset dir="lib" includes="*.jar"/>
				<fileset dir="C:/Program Files/Java/jdk1.6.0_20/jre/lib" includes="plugin.jar"/>
			</classpath>
		</javac>
 
		<jar destfile="lib/jcapture.jar">
			<fileset dir="build/jcapture" />
			<fileset dir="src" excludes="**/*.java" />
			<manifest>
				<attribute name="Vendor" value="Hammurapi Group" />
				<attribute name="Bundle-Version" value="0.1" />
				<attribute name="Bundle-SymbolicName" value="com.hammurapi.jcapture" />
				<attribute name="Class-Path" value="apache-mime4j-0.6.jar commons-codec-1.3.jar	commons-logging-1.1.1.jar httpclient-4.0.1.jar httpcore-4.0.1.jar httpmime-4.0.1.jar " />
			</manifest>
		</jar>
 
		<delete dir="build/signed" failonerror="false"/>
		<mkdir dir="build/signed"/>
 
		<signjar 
			destDir="build/signed"
    		alias="_key_alias_" 
    		keystore="_path_to_keystore_"
    		storepass="${storepass}"
    		preservelastmodified="true">
 
  			<path>
    			<fileset dir="lib" includes="*.jar" />
  			</path>
		</signjar>		
 
		<property name="releaseDir" value="release" />
 
		<delete dir="${releaseDir}" failonerror="false" />
		<mkdir dir="${releaseDir}"/>
 
		<zip destfile="${releaseDir}\jcapture.zip">
			<zipfileset prefix="jcapture/" dir="${basedir}" excludes=".classpath, .project, bin/**, build/**, wink, build.xml, lib/**" />
			<zipfileset prefix="jcapture/lib" dir="${basedir}/build/signed" />
		</zip>
	</target>
</project>
1) It may take some time for the window to appear for the first time because browser downloads applet's jar files.
Last modified: 2011/12/21 21:49 by Pavel Vlasov
   
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Hammurapi Group