Yes, the file is created using Vega/d3.js, exported to SVG and then put into a 
word document with Aspose. Aspose also has a print functionality. They don't 
have this bug but they have other bugs. That's why I resorted to pdfbox. Isn't 
there a native way of printing PDFs on Windows 10 without having to use any 
library?

________________________________
Von: Tilman Hausherr <[email protected]>
Gesendet: Dienstag, 6. April 2021 19:21
An: [email protected] <[email protected]>
Betreff: Re: Jagged lines in Graph when printing with PDFBox 2.0.23

The chart has double lines, i.e. lines that go to itself. This brings
that weird effect in java, but not in Adobe Reader. It's related to the
miter limit.

I wonder if this is a java bug.

Did you create the file yourself?

Tilman



public class JaggedLines
{
     public static void main(String[] args) throws IOException
     {
         BufferedImage bim = new BufferedImage(500, 500,
BufferedImage.TYPE_INT_RGB);
         Graphics2D g = (Graphics2D) bim.getGraphics();
         g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
         g.setBackground(Color.white);
         g.clearRect(0, 0, bim.getWidth(), bim.getHeight());
         GeneralPath path;

         AffineTransform at = g.getTransform();

         g.setColor(Color.red);
         g.transform(AffineTransform.getTranslateInstance(0, -1400));
         g.transform(AffineTransform.getScaleInstance(10, 10));
         path = new GeneralPath();
         path.moveTo(24.954517, 159);
         path.lineTo(21.097446, 157.5);
         path.lineTo(17.61364, 162);
         path.lineTo(13.756569, 163.5);
         path.lineTo(11.890244, 160.5);
         g.draw(path);

         g.setTransform(at);

         g.setColor(Color.blue);
         path = new GeneralPath();
         g.transform(AffineTransform.getTranslateInstance(0, -1300));
         g.transform(AffineTransform.getScaleInstance(10, 10));
         path.moveTo(24.954517, 159);
         path.lineTo(21.097446, 157.5);
         path.lineTo(21.097446, 157.5); // this repeats the previous one
         path.lineTo(17.61364, 162);
         path.lineTo(17.61364, 162); // this repeats the previous one
         path.lineTo(13.756569, 163.5);
         path.lineTo(13.756569, 163.5); // this repeats the previous one
         path.lineTo(11.890244, 160.5);
         g.draw(path);


         g.dispose();


         ImageIO.write(bim, "png", new File("huhu.png"));
     }
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to