Hi, i have a serious problem and i need some help please.
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.
I am opened to any other solution, i just dont know what to doo and i actualy desperately need resolve it.
Thank you for any response. I am getting realy desperate.
Hi, i am looking for a way to make censored text in a textblock. The problem is i dont know how to find width of individual lines. textWidth() wont help me here. I need to get width of individual lines, so i dont have just block of black lines starting and ending in the same place.
I am using jquery, typekit and processing.js. quite lot of things together.
What i found is that although lots of browsers support canvas, only the new firefox and chrom display my sketch. Problem is browsers like safari and IE9 think that can display it but they dont so canvas fallback (what you put between <canvas></canvas>) doesnt work.
Partialy i believe its because i use 3D in my sketch which means i need to use WebGl. Maybe its only because of that ( ill have to try how 2d proccesing wokrs on differend browsers).
My first thoughts for solution was to use javascript and find browsers that dont support webgl then give them just static image of my sketch. But then ive found that there are not many browsers that can use WebGl (as far as i know only updated versions of chrome and firefox). So better solution will probably be otherway around, show images everewhere but if browser supports webgl show processing sketch.
Anyway, i want ask if somebody has some experience with webgl detection. What is best solution to this (not only webgl but fallback options for processing on web)? I am not very good javascript programer (i stick to jquery :D). I would realy appreciate some thoughts.
Hi i have this big problem for which i cant find any answer.
When i make shapes and then export them to pdf, they are not connected. In illustrator they seem to be just many lines and i need them to be connected.
In my program i generate z-cordinate values for my vertexes. And then make series of vertical lines which differ only in their z coordinate. I thought that when i put my loop (i dont know i can do that) between beginShape(); endShape(); that shape should be connected. But its not.
I believe the problem is in the fact that i make pdf from 3D.
Code is crazy im not great programmer sorry for that.