"I have tried both SVG libraries"
Which ones?
Since I made one (a third one?), I am interested to have feedback.
"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.
The problem is that iText, like Batik and similar libraries, can work in two modes: the native library mode, like the one you used above in the pure Java program, and the Java2D mode, where the library overrides AWT's Graphics2D, thus transforming regular AWT drawing calls to drawing instructions for the targeted output.
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...
If your third attempt is almost OK with only the resolution issue, you can try and draw on a much bigger PGraphics, no?
"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.
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.
Which ones?
Since I made one (a third one?), I am interested to have feedback.
"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.
The problem is that iText, like Batik and similar libraries, can work in two modes: the native library mode, like the one you used above in the pure Java program, and the Java2D mode, where the library overrides AWT's Graphics2D, thus transforming regular AWT drawing calls to drawing instructions for the targeted output.
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...
If your third attempt is almost OK with only the resolution issue, you can try and draw on a much bigger PGraphics, no?
"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.
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.