Hi, i have a serious problem and i need some help please.
I am opened to any other solution, i just dont know what to doo and i actualy desperately need resolve it.
I am making generated booklet, a little book. Book is designed as spreads (two pages together) i then intend to print it as saddle stitch. So what i need is to cut all the pages of PDF in halfs to have pages for printer.
So my initial idea was to generate the graphics into PGraphics frame buffer and then draw it into pdf.
Problem is when i split pages this way, i get very bad quality PDF. I asume its because PGraphics probably converts it somehow from vectors to pixels.
I am lost i cant find any other solution. Maybe ist because of my bad use of beginDraw(); (can it be oppened when i use image()?) or its not possible at all?
- import processing.pdf.*;
- PGraphicsPDF pdf;
- PGraphics buf;
- void setup() {
- buf = createGraphics(600, 500);
- pdf = (PGraphicsPDF) createGraphics( 300, 500, PDF, "spreads.pdf");
- size(300, 300);
- background(255);
- }
- void draw() {
- }
- void keyPressed() {
- pdf.stroke(10);
- pdf.fill(10);
- pdf.beginDraw();
- buf.beginDraw();
- buf.background(255);
- gen01(buf);
- buf.endDraw();
- pdf.image(buf, 0, 0);
- pdf.nextPage();
- pdf.image(buf, -pdf.width, 0);
- pdf.nextPage();
- gen01(pdf);
- pdf.dispose();
- pdf.endDraw();
- }
- void gen01(PGraphics gen) {
- int xde = int(gen.width/50);
- int yde = int(gen.height/50);
- gen.stroke(100);
- gen.fill(100);
- gen.strokeWeight(0.3);
- for ( int x=0; x < gen.width; x = x + xde) {
- for ( int y=0; y < gen.height; y = y+ yde) {
- gen.stroke(0, 50);
- gen.line(x, y, gen.width/2, gen.height/2);
- }
- }
- }
You can see the difference if you run sketch (and keypress), the generated image is not important, i will have differend ones and text there.
Thank you for any response. I am getting realy desperate.
1