why not print from SVG? Apache Batik should be able to do that. (but if the 
double line is there, you might end up with the same problem)

Tilman



--- Original-Nachricht ---
Von: Andrin Meier
Betreff: AW: Jagged lines in Graph when printing with PDFBox 2.0.23
Datum: 07. April 2021, 9:12
An: users@pdfbox.apache.org




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 <thaush...@t-online.de <mailto:thaush...@t-online.de> 
>
Gesendet: Dienstag, 6. April 2021 19:21
An: users@pdfbox.apache.org <mailto:users@pdfbox.apache.org> <
users@pdfbox.apache.org <mailto:users@pdfbox.apache.org> >
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)<http://bim.getGraphics> ();
<http://g.setRenderingHint(RenderingHints.KEY_ANTIALIASING>
,
RenderingHints.VALUE_ANTIALIAS_ON);
<http://g.setBackground(Color.white>
);
<http://g.clearRect(0>
, 0,<http://bim.getWidth> (),<http://bim.getHeight> ());
GeneralPath path;

AffineTransform at =<http://g.getTransform> ();

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

<http://g.setTransform(at>
);

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


g.dispose();


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


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org
<mailto:users-unsubscr...@pdfbox.apache.org>
For additional commands, e-mail: users-h...@pdfbox.apache.org
<mailto:users-h...@pdfbox.apache.org>

Reply via email to