Bug 1343 : Open the PDF library a bit more
Last modified: 2010-03-11 05:35




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
enhancement

 

Reporter:
PhiLhoČ
Assigned To:
fry

Attachment Type Created Size Actions

Description:   Opened: 2009-10-07 04:17
In the continuation of bug/enhancement request 1276 (suggest declaring
PDF's members protected -
http://dev.processing.org/bugs/show_bug.cgi?id=1276), I will suggest to add
an OutputBuffer field (see Write PDF to Byte[] (without writing a file!) -
http://processing.org/discourse/yabb2/YaBB.pl?board=LibraryProblems;action=display;num=1237962559
thread for motivation).
The idea is that the OutputBuffer will be created in the setPath() call,
instead of in the beginDraw() call, as it is done currently. Thus, we can
set the output buffer ourself before calling beginDraw which would use
whatever output we need.
I haven't looked but I suppose this applies to the DXF exporter as well.

I think it is a minor change, not altering compatibility, opening the lib
to advanced users (or other libs like the SaveToWeb one) without the need
for awful hacks... :-)
Additional Comment #1 From fry 2009-10-13 15:13
Sure, I'll look into it. This had occurred to me when creating the library,
so I think there was a reason that I didn't do this in the first place
(writing to a buffer in general), but I'll take another look for you.
Additional Comment #2 From fry 2010-03-11 05:35
k, adding this to PDF for the next release. the idea is to use:

PGraphicsPDF pdf = (PGraphicsPDF) createGraphics(w, h, PDF);
pdf.setOutput(yourOutputStream);

then i've added bug #1502 to look at the larger setOutput() issue.