Problem writing pdf in applet
in
Programming Questions
•
3 years ago
Howdy;
I'm working on a sketch that visualizes municipal census data, and I've added a feature that allows users to export PDF images of the current frame. This feature works fine when I'm running the sketch from the IDE or as an application, but when I attempt to export a PDF from an applet running on my website, the applet hangs. The applet (with accompanying error) can be found here:
http://jeemang.ca/projects/metroview/index.html.
The method I used to implement this feature is outlined briefly below:
1. In the draw loop, before stuff is written, check boolean variable indicating if pdf should be written or not.
2. If this variable is true, prompt the user for the export path (using selectOutput()). Use the output from this to call beginRecord (ie "beginRecord(PDF, <path from previous step>)").
3. Draw stuff I want in pdf.
4. Check boolean variable indicating if pdf is to be written or not and, if it's true, switch it back to false.
The boolean variable I mention above can be "flicked" by a button I created using the controlP5 library. If this isn't enough detail, code can be found here:
http://code.google.com/p/metroview/source/browse/. (The draw() and setup() loops are located in "MV.pde.")
So far, I've tried a couple of things to fix this:
1. Based on the advice at the controlP5 website, I made basically every variable and method in the sketch "public." This did not fix the problem.
2. The sketch also uses some stuff from the giCentre Utilities. Just to check, I removed all references to these libraries, but this also did not fix the problem.
So, I'm a little stuck. My hunch right now is that the problem lies in the way that I'm specifying the output path in beginRecord(). When using this command within an applet, can one simple specify a path to the user's hard drive as my sketch does? Is it even possible to write pdf's to the user's hard drive using this command? Or, alternatively, could the problem lie elsewhere?
Any suggestions or help would be very much appreciated.
Josh
1