Hi Klaus,
In the export menu there's a "Number of Pages" input box. Instead of putting your script inside a loop, you can define the number of PDF's it needs to generate in the input box (10, 100, 100000 :-)
If your script contains random() commands the output in each of the generated PDF's will be different.
Hi Tom De Smedt,
yes, I know thanks! But what if I like to create a pic for example where I add a Circle, and then one more and so on, and like to export every singel picture but don't like to use "random". I also don't like to export a movie, I need PDFs.
Is there a command for exporting? Or will it be possible to include such a command in a future release?
Thanks
Klaus
Then you need the page number of the current PDF being exported. You can use the global PAGENUM variable for that.
Here's an example that draws more and more circles on each page (try exporting 200-300 PDF's):
size(400,400) from math import sin, cos, radians for i in range(PAGENUM): x = 200 + sin(radians(i*2)) * 100 y = 200 + cos(radians(i*2)) * i/2 fill(i*0.002, 0, 0) oval(x, y, 20, 20)
If you need to do specific things on certain pages, use an if-statetement:
if PAGENUM == 100: # specific stuff for page 100 goes here
Klaus, this has worked for me although it is not a documented feature and relies on looking under the hood--use it with caution since it does no error checking and will overwrite files that get in it's way.
data = graphicsView.pdfData data.writeToFile_atomically_("FileName" + ".pdf" , False)where FileName is the name of the file. The file ends up in the same place as the script you are running.
Thank you very much, it seems that it is exactly that what I need!
Thank you for your help!
Klaus
PDF Export via command?
Posted by Klaus on Apr 23, 2007Hi,
I like to know if there is a command for exporting a PDF, so that I can use it lets say in a "for x in range..." loop to export several PDFs.