You changed according to my first remark, not to my second one. All drawings on the PDF surface must be prefixed by the PDF PGraphics name.
Untested code...
- PImage img;
- import processing.pdf.*;
- PGraphicsPDF my_pdf;
- void setup(){
- size(500, 375);
- img = loadImage("15.jpg");
- my_pdf = (PGraphicsPDF)createGraphics(500, 375, PDF, "img.pdf");
- my_pdf.beginDraw();
- my_pdf.image(img, 0, 0);
- my_pdf.endDraw(); // stop and save pdf
- my_pdf.dispose();
- //exit();
- }
Untested code...