Saving frame to new PDF

edited December 2016 in Programming Questions

I was looking around to find out about how to save current freme to PDF. I want to record the drawing so that i need beginRecord at setup(), but any time if i endRecord, i cant save the another frame. if i put the record in draw(), it will only record the current frame not all previously frames.

does any one know how to save different frame to pdf, just like saveframe(), but output the pdf vector file?

Answers

  • edited December 2016

    An alternative is to save the frames using saveFrame() and then use an online tool:

    https://www.google.ca/webhp?sourceid=chrome-instant&rlz=1C1CHWA_enCA688CA688&ion=1&espv=2&ie=UTF-8#q=images to pdf converter

    For example, I tried this one in Win OS: https://smallpdf.com/jpg-to-pdf

    If you are in Linux, you can use imagemagick.

    Kf

  • edited December 2016

    In the processing IDE go to Files>>Examples and then go to Libraries>>PDF Export and open the ManyPages.pde example. It does export multiple pages. So the information provided in https://processing.org:8443/reference/libraries/pdf/index.html needs to be updated as it doesn't work as advertised.

    Edited: From github https://github.com/processing/processing/blob/master/java/libraries/pdf/examples/ManyPages/ManyPages.pde

    Kf

  • the pdf examples cover a lot of cases:

    https://processing.org:8443/reference/libraries/pdf/index.html

    I want to record the drawing so that i need beginRecord at setup(), but any time if i endRecord, i cant save the another frame.

    look at the "Single Frame from an Animation" example. it calls beginRecord in the draw() and allows you to specify a filename. this can either have hashes in the filename like the example or you can make up your own filenames to reflect what you want.

    if i put the record in draw(), it will only record the current frame not all previously frames.

    if you do something like this

    if (startRecording) {
      beginRecord(...);
      startRecording = false;
    }
    

    you can set global boolean beginRecord to true in setup and you'll get everything from the start.

    and it'll record frames until you call endRecord. the logic in the documentation only does one frame, yes, but you can modify the logic.

    (using saveFrame and then converting the resultant pixel based images to pdf is not going to give you the same results as saving shapes as vectors directly to pdf (assuming that's what you're doing). the latter will be much better quality)

  • edited December 2016

    thanks for the solution guys. the problem I am facing here is after endRecord cant be save again to another one. if I start again that would only record from the frame when it started.

    those solutions i was already family about them, thought there would have a another solution to save just with pdf as saveframe.

    Thanks guys. : )

Sign In or Register to comment.