We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello everybody,
I'm having an issue with Processing (v 2.1) and PDF on exported application.
The PDF will be exported when this code is run via the IDE but not when exported as an app
import processing.pdf.*;
void setup() {
PGraphics pdf = createGraphics(458, 649, PDF, "output.pdf");
pdf.beginDraw();
pdf.fill(0);
pdf.rect(0, 0, 100, 100);
pdf.dispose();
pdf.endDraw();
}
Any ideas?
Thank you!
Answers
(the same code works fine in previous versions of Processing)
Is a simple sketch (no libraries) exported in your version of Processing working for you?
Yes.
Perhaps it works, but the file goes to an unexpected place...
You can try and put an absolute path for the file name, at least for testing purpose.
You can also use paths like:
Thanks for your help PhilHo. Sorry I didn't reply earlier but I'm not receiving notifications from the forum.
I've tried that and it shows the same location both through the IDE and the app. The pdf file doesn't get saved on apps exported by processing 2.1 (it works on previous versions).
Here's the code I'm using:
This will save a file when run on the IDE but won't save anything when run as an app.
PDF works fine in exported applications, it is the export as application which is broken on Windows for 2.1... Check the Using Processing category, there are a number of topics about this. In one of them, I give a workaround.
Hi PhiLho, thanks for your help.
I couldn't find a solution to my problem, I had a look at your answers but the problem still arises when the sketch is exported as an application from Processing 2.1+ both in Mac and Windows
As an example, this code would work fine as a sketch but won't save a file when exported
Actually, I just found out that the file IS exported! But it's the path that needs to be changed (with the current method the file is saved in the user's root)
sketchPath refers to the absolute root on Mac OSX
Here's the issue with a temporary workaround on github https://github.com/processing/processing/issues/2181