We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › DrawRecord() | PDF in Eclipse
Page Index Toggle Pages: 1
DrawRecord() | PDF in Eclipse (Read 3542 times)
DrawRecord() | PDF in Eclipse
Jun 26th, 2009, 9:37am
 
Hej,
I'm trying to create an PDF file out of my Processing sketch in Eclipse, but a strange error is confusing me.

Quote:
java.lang.RuntimeException: public PGraphicsPDF(int width, int height, PApplet parent, String filename) does not exist.

     at processing.core.PApplet.createGraphics(PApplet.java:1257)
     at processing.core.PApplet.createGraphics(PApplet.java:1141)
     at processing.core.PApplet.beginRecord(PApplet.java:7099)
     at mails.Mails.draw(Mails.java:89)
     at processing.core.PApplet.handleDisplay(PApplet.java:1465)
     atprocessing.core.PGraphics.requestDisplay(PGraphics.java:690)
     at processing.core.PApplet.run(PApplet.java:1562)
     at java.lang.Thread.run(Thread.java:613)


I call drawRecord() as usual:

Quote:
     public void draw()
     {        beginRecord(PDF, "filename.pdf");
           drawPoster();
           endRecord();      }


Everything seems to be fine without using the PDF Stuff and it's a normal class.

Quote:
public class Mails extends PApplet


I guess my programming skills aren't that good (like my english) to solve this problem alone. Does anybody has a kind of solution?



Re: DrawRecord() | PDF in Eclipse
Reply #1 - Jun 26th, 2009, 12:08pm
 
I think you need to include <path to processing>/libraries/pdf/bin/processing/pdf/PGraphicsPDF.class in your classpath.
Re: DrawRecord() | PDF in Eclipse
Reply #2 - Jun 27th, 2009, 4:17am
 
Thank you for the fast response. I don't know wether I added the class the wrong way to the classpath (Eclipse > Preferences > Classpath ...), but this don't work. Probably I did it the wrong way - so I still get the same error message.
Re: DrawRecord() | PDF in Eclipse
Reply #3 - Jun 27th, 2009, 7:07am
 
I don't know what Eclipse you have or what you are doing.
On my Eclipse 3.4.1, to edit the classpath of a project, I just right-click on the project (eg. in Package Explorer), and select Properties. (Or select the project and go to Project > Properties).
There I choose Java Build Path, the Libraries tab, and I would choose one option, say Add External Class Folder to add the whole <path to processing>/libraries folder. I suppose there that Eclipse recursively loads all the class files it finds there, like with the option java.ext.dirs.
Haven't tried though.
Re: DrawRecord() | PDF in Eclipse
Reply #4 - Jun 27th, 2009, 10:56am
 
This is actually the way, I did it - without any convincing result. I'm now switching back to Processing for this Project where the PDF Library works fine. Sad
Thank you.
Re: DrawRecord() | PDF in Eclipse
Reply #5 - Dec 29th, 2009, 6:04am
 
for pdf export in eclipse you need the pdf.jar and the itext.jar. that's all to use PGraphicsPDF..
Re: DrawRecord() | PDF in Eclipse
Reply #6 - Jan 17th, 2010, 11:45am
 
I do have the same problem.

I am using Eclipse 4.6 M4 on a Mac.

I added the libraries pdf.jar and itext.jar to the class path and they are displayed correctly in the package explorer.

But I still get the run-time exception:

public PGraphicsPDF(int width, int height, PApplet parent, String filename) does not exist.

Any ideas what else I could try?
Re: DrawRecord() | PDF in Eclipse
Reply #7 - Jan 17th, 2010, 3:01pm
 
Just to be sure: do you have an include processing.pdf.PGraphicsPDF; line in your code?
Re: DrawRecord() | PDF in Eclipse
Reply #8 - Feb 10th, 2010, 4:44pm
 
Code:
import processing.pdf.*;

private PGraphicsPDF pdf;

pdf = (PGraphicsPDF) createGraphics((int) imageWidth, (int) imageHeight, PDF, savePath + ".pdf");

beginRecord(pdf);
...
endRecord();


works for me
Page Index Toggle Pages: 1