We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm working on automatic books generated with processing, and for one of these books I need to export the left of my screen to one PDF page, and the right to the next page and so on. This is a static and simplified version of my sketch:
import processing.pdf.*;
PGraphicsPDF pdf;
void setup() {
size(1218,870);
pdf = (PGraphicsPDF)beginRecord(PDF, "test.pdf");
PImage img = loadImage("test.jpg");
image(img, 0,0);
pdf.nextPage();
get(595,0,623,870).save("left.jpg");
get(0,0,623,870).save("right.jpg");
endRecord();
}
Obviously, this doesn't work at all. I get how I can separate the screen in two — with get() —, but is there any way to make that work with the pdf nextPage() function ? And is there any way at all to export a pdf that's not the size of your sketch? Thanks !
Answers
This kind of works, but not the way you want it to. You can only record one half of the screen.
Thank you Eeyorelife I didn't think of that. But I don't get how you can generate multiple pages with the beginRaw function.
I don't think you can. I went to the source code of processing and found the raw function zero edited it a bit so you could change the few parameters that createGraphics took.
If you go to processing ->libraries-> PDF and then click the link to the source code of the library you might be able to find a function you can recreate.
I really don't know how to do that. What I did was record all the pages to different jpg files in a directory. Is there a way I can access these file and organize them in the right order in a pdf file, at the end of my sketch ?
I finally got it, with a resize at the end of my sketch, to reorganize all the pages in the right order :
Thank you for your response Eeyorelife !