How to export PDF files in P3D mode ?

allall
edited September 2016 in How To...

Hello,

I'm surprised not to find the answer on the forum : How to export PDF Files in P3D mode ? I don't have trouble in P2D. I use the PDF library without difficulty. But now, I need to do it in P3D, to get 2D PDF files... Thank you for your help. Best,

Tagged:

Answers

  • Use beginRaw with PDF. See reference.

    BeginRecord moans about not being available using this renderer in 3d but beginRaw doesn't. I only found this out on Monday.

  • allall
    edited September 2016

    Hello koogs,

    Thank you for your time. Unfornunately, it doesn't work. I tried with a easy example (from the Reference page) :

    import processing.pdf.*;
    Boolean saveOneFrame = false;
    
    void setup() {
      size(400, 400, P3D);
    }
    
    void draw() {
      if (saveOneFrame == true) {
        beginRaw(PDF, "Export/Raw"+frameCount+".pdf");
      }
    
      line(pmouseX, pmouseY, mouseX, mouseY);
    
      if (saveOneFrame == true) {
        endRaw();
        saveOneFrame = false;
      }
    }
    
    void keyPressed() {
      if (key == 'r') saveOneFrame = true;
    }
    

    But I have only a white background ! I keep looking for... Best

  • Your sketch works for me, but if you don't move the mouse while pressing "r", then it will result in drawing only a point instead of a line, which might be hard to spot. Does it still appear empty if you draw a fixed line?

    line(0, 0, width, height);

  • line(mouseX, mouseY, mouseX + 100, mouseY + 100);
    

    it's exactly as benja says, you'll get a 0 length line if you aren't moving the mouse. the above replacement will fix it.

    but you will only get at most 1 line in the pdf with that example, because you're only drawing one line between the start and end of recording.

Sign In or Register to comment.