jfreepdf icon indicating copy to clipboard operation
jfreepdf copied to clipboard

Coordinate precision issues in vector elements inside produced PDF

Open istinnstudio opened this issue 3 years ago • 2 comments

It seems there is an issue when translating java2D graphics to PDF. Some lines are getting off their real precise coordinates. Same graphics exported to SVG from jfreeSVG are coordinate accurate. There might be some kind of optimization (or java variable type setting, float to double maybe) that actually reduces the number of coordinate digits and as a result some points are off their actual position in the used grid. I have noted such behavior in inkscape 's SAVE optimization algorithms that optionally can reduce the SVG size by reducing the number of digits used in coordinates. For some designs this might be and look OK, but for coordinate accurate or complex graphics this might lead to this artifact. You can consider this as a high priority bug as it can distort the produced graphics data with irreversible loss in specific cases.

There should be a way to improve the accuracy of the exported vectors, and this could be selectable scenarios by entering a new parameter hint value upon the fundamental call of graphics, something like graphicsPDF.setRenderingHint(PDFHints.KEY_VECTOR_ACCURACY, PDFHints.VALUE_DRAW_VECTOR_ACCURACY_LOW/MED/HIGH);

image image

istinnstudio avatar Jan 18 '22 14:01 istinnstudio