but I am testing it with one of his simple example codes and it just loads a blank page. I am new to PDE so I am concerned I did not install the library correctly… I just downloaded from GitHub and then copied the folder into the Libraries folder that processing made in Documents.
Here is a screenshot of what was in the folder - was I supposed to do something else here to install it?
Your source code works on my system (MacOS) using a Chrome browser with p5.js WebEditor. The following are the steps that I used.
Download GitHub repository to my desktop using the URL in your post.
Open p5.js WebEditor in Chrome browser.
Create a new file in the project entitled ‘p5.pdf.js’ . File system should look like the image below.
Copy/paste the contents of the p5.pdf.js file that you downloaded to your desktop (inside folder p5.js-pdf-master) to this newly created file.
Inside of the index.html file of your project add this line of code to allow your project to use the file that you just created:
I placed this line just below the other script code for “sketch.js”.
6. Run the code that you posted and create a pdf file. I sent the output to my desktop instead of the printer; the output is also shown below.
This is amazing thanks so much - it works. I was even able to use your steps with another script to then get it to SVG to save it as a Vector PDF, which is what I set out to do.
By any chance do you know how I would go about getting the same thing in my PDE as I now have in the web browser? You are saying it works on yours? If not I can use a workaround of doing my drawing in PDE and then when its ready to save to PDF.
Figured it out with the Zenozeng method. I know its dumb but I couldn’t figure out how to edit the HTML of my sketches for the PDE. I was trying to open the HTML file from finder and it was coming up blank in textedit. I now see it in the tab next to the sketch I have open in PDE, and was able to add the line as you said. Complete rookie error. Thanks so much.