Hi,
I'm using Processing within a larger Java application to write a PDF file. The problem I have is that the sketch seems to terminate without error when creating the file, i.e. when executing this line:
Code:size(200,200, PDF, "d:/tmp.pdf")
If I rewrite the sketch just to display the output instead (e.g. size(200,200)), everything seems to work fine.
I'm developing in Eclipse and I've got core.jar, pdf.jar, and itext.jar on my build path. The calling code is within a JUnit test which calls sc.someMethod(); (where sc is an instance of SomeClass).
Code:
public class SomeClass {
private MyModel model; // contains data used in sketch
public void someMethod() {
LayoutGraph.setModel(model);
LayoutGraph.main(new String[]{});
}
}
and the sketch itself (bare bones) is
Code:
public class LayoutGraph extends PApplet {
private MyModel model;
int myField = model.getFieldValue();
// etc
static public void main(String args[]) {
PApplet.main(new String[]{LayoutGraph.class.getName()};
}
public void setup() {
size(200,200, PDF, "D:/tmp.pdf");
// more set up
}
public void draw() {
background(255);
// more drawing stuff
exit();
}
public void setModel(MyModel model) {
LayoutGraph.model = model;
}
}
Again this code terminates without error but doesn't get beyond the size() declaration (it does touch and create the PDF in the right place but nothing's written into it). The reference to the model instance works fine and all the fields have sensible values.
Any ideas how I can get this working? Thanks.