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 & HelpOther Libraries › Exporting to PDF
Page Index Toggle Pages: 1
Exporting to PDF (Read 568 times)
Exporting to PDF
Aug 24th, 2009, 5:21pm
 
Hello,

I made a program that makes a chart and I would like to add code so it is rendered to the screen and exported to a PDF.

I added
import processing.pdf*; before setup(),
beginRecord(PDF, "atlas_Downloads.pdf"); as the first line in draw(), and
endRecord(); at the very end of draw().

I think I imported the pdf library into the sketch. There was a file named pdf.jar in C:\...\processing-1.0.3\processing-1.0.3\libraries\pdf\library and I dragged and dropped that into the sketch window.

However, when I try to run the program, I get the following error message: "Only a type can be imported. processing.pdf resolves to a package"

What am I doing wrong?
Re: Exporting to PDF
Reply #1 - Aug 24th, 2009, 5:39pm
 
I just noticed that import processing.pdf*; was missing a period between the pdf and the * so I added that, but now as soon as the program gets to the first text function, in this case textSize(12);, it gives me a NullPointerException.

I have no idea what's going on.
Re: Exporting to PDF
Reply #2 - Aug 24th, 2009, 6:23pm
 
Nevermind, it's working. The problem was that I had to include textFont() in every text-related function. But now the problem is that the caps of the lines in the PDF look really jagged. I'll post about that on the General forum.
Page Index Toggle Pages: 1