We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hi all,
So let's say I have a sketch that's 1000px by 250px. I know how I can export the whole sketch (1000x250) into a PDF, but what if I want to export content that starts getting drawn 350px in from the left and 25px down from the top? Is it possible to target a region of a sketch and export it as a PDF?
So far I've tried using createGraphics, which allows you to specify a width and height, but those values originate from the origin, which isn't quite what I'm looking for.
Any help would be appreciated!
Answers
Perhaps get() can help ya crop a part of the canvas as a PImage.
Then you can set() or image() that in a PDF PGraphics: :-??
Ok, I'll give this a go. Sounds like it should work. Thanks!
Probably cannot work, PDF isn't good with bitmap captures, and it looses the interest of PDF: being a vectorial format.
That said, cropping drawings to a region while exporting to PDF seems to be a hard task.
Or, perhaps, draw on a PGraphics of the size of the area to export: that would be the part to be exported, and you draw the resulting PGraphics on the sketch area.
Hi PhiLho,
Thanks for the response! Your suggestion does the trick. Below is a snippet of test code. The blue and red bars represent menu areas. The black represents the live area of the sketch. My goal was to export just the black region, which using PGraphics allowed me to accomplish. Thanks again!