"I have tried both SVG libraries"
Which ones?
Since I made one (a third one?), I am interested to have
feedback.
I tried prosvg and
the PDE couldn’t find the library even though it was in the libraries folder with the other
libraries. I tried P8gGraphicsSVG but
none of the examples worked so I gave up. I don’t really want SVG output
anyway.
"The transparency shows up in preflight analysis. I
don't know what the red X means other than some error, but it may not be good
for the service provider."
I didn't know Preflight, so I went to their site, and they
warn:
"Although transparency is now a widely accepted
functionality within most design and page layout applications many printing
companies are still wary of PDF files containing transparency and like to give
them specific attention to ensure they are processed and imaged correctly.
"
I suppose you use transparency, not to print, but to load
the PDF in some vector drawing application, so it should be OK.
I tried fixing the problem in Acrobat and all it did was
flatten the image (removed the transparency) and changed the entire background
to dark gray. Bogus. And this is probably what a service provider is going to
do too. I read that Adobe has a 100-page treatise about transparency in PDFs so
I guess it’s not as easy as you might imagine. I mentioned in my other post,
about fonts, that I intend to send this to a service provider, or actually to a
local (cheap) photo printer like Costco. Their prices are great but I don’t
know about quality. In any case I want the PDF to be perfect because they will
not provide any personal service or expertise, I’m sure.
The latter is great for developers that have already Java2D
drawings, as they can just make a thin wrapper around the library and redirect
the drawings to it. That's what I made with my P8gGraphicsSVG library, inspired
by the way PGraphicsPDF is done: if you look at its source, you will find it is
quite small!
The downside is that this Java2D mode offers less
flexibility overall, and has some limitations.
One of them is handling of fonts (you have to give the path
to the font file to be able to use it), another seems to be transparency
handling...
I’ll take a look but that transparency limitation would kill
it for me.
If your third attempt is almost OK with only the resolution
issue, you can try and draw on a much bigger PGraphics, no?
Well yeah, but it is not optimal. I plan to add different
scalable fonts and vector graphics so it seems a real pain to have to worry
about scaling everything to fit the large bitmap. Maybe not but I’d really like
to be able to add some code and get the full functionality of iText, which BTW
is quite sophisticated.
"I don't know why 72ppi would be the default. It is
ridiculously low even for a small-screen monitor."
72 dpi was the standard resolution of CRT monitors not so
long ago...
I think it is the default of iText, unless otherwise
specified.
Not so long ago? You mean 15-20 years is ‘not so long ago’?
In terms of Moore’s law it is comparable to the Middle Ages of computing. Yes,
iText defaults, sadly, to 72 ppi. That’s why they provide scaling functions,
which are obviously being ignored by the PDF library.
Perhaps you can take the PGraphicsPDF as a start, and hack
it to get the intended result: make a library out of it (compile and put the
.class file in a jar) or just add the .java file to you sketch. Thus, you can
add anything you might need.
That’s the last thing I want to do. I might as well use
iText directly rather than hack the library. How would you add a java file to
my sketch above and access the iText functions using data from Processing as
much as possible? That would be very helpful. I can’t find enough about doing
that online. I’m not an experienced java programmer, though I write various
scripting code all the time and do have experience with C++. I am using eclipse for both Processing and iText,
so that helps a lot.