bai yuan created PDFBOX-6094:
--------------------------------
Summary: After upgrading pdfbox, the lines on the right and bottom
have become hard to see.
Key: PDFBOX-6094
URL: https://issues.apache.org/jira/browse/PDFBOX-6094
Project: PDFBox
Issue Type: Bug
Affects Versions: 2.0.35
Reporter: bai yuan
Attachments: border.png
After upgrading pdfbox from 2.0.32 to 2.0.35, the lines on the right and bottom
have become hard to see. Is this change expected? What parts of the code should
I modify if I want the previous effect?
{code:java}
// Some comments here
PDDocument doc = new PDDocument();
BufferedImage bi = new BufferedImage(647, 168, 2);
Graphics2D graphics = bi.createGraphics();
java.awt.Color backgroundColor = java.awt.Color.WHITE;
graphics.setBackground(backgroundColor);
graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
PDPage pdPage = new PDPage(new PDRectangle(647,168));
doc.addPage(pdPage);
try (PDPageContentStream pdPageContentStream = new
PDPageContentStream(doc, pdPage)){
// pdPageContentStream.saveGraphicsState();
//// pdPageContentStream.addRect(0.0f, 1.6f,
//// 646.7868f, 166.4f);
//// pdPageContentStream.clip();
pdPageContentStream.saveGraphicsState();
PDExtendedGraphicsState graphicsState = new
PDExtendedGraphicsState();
graphicsState.getCOSObject().setItem(COSName.BM, COSName.NORMAL);
graphicsState.setNonStrokingAlphaConstant(1.0f);
pdPageContentStream.setGraphicsStateParameters(graphicsState);
pdPageContentStream.setNonStrokingColor(68, 114, 196);
PDExtendedGraphicsState graphicsState2 = new
PDExtendedGraphicsState();
graphicsState2.getCOSObject().setItem(COSName.BM, COSName.NORMAL);
graphicsState2.setStrokingAlphaConstant(1.0f);
pdPageContentStream.setGraphicsStateParameters(graphicsState2);
pdPageContentStream.setLineCapStyle(0);
pdPageContentStream.setLineJoinStyle(1);
pdPageContentStream.setLineWidth(1.28f);
pdPageContentStream.moveTo(92.39811f, 148.80008f);
pdPageContentStream.lineTo(554.3887f, 148.80008f);
pdPageContentStream.lineTo(554.3887f, 20.80008f);
pdPageContentStream.lineTo(92.39811f, 20.80008f);
pdPageContentStream.closePath();
pdPageContentStream.appendRawCommands("W ");
pdPageContentStream.stroke();
pdPageContentStream.restoreGraphicsState();
// pdPageContentStream.restoreGraphicsState();
} finally {
try {
doc.save(new ByteArrayOutputStream());
new PDFRenderer(doc).renderPageToGraphics(0, graphics, 1.0f,
1.0f);
} catch (IOException e) {
// ignored
}
}
File file = new File("export_2.0.35_2.png");
ImageIO.write(bi, "png", file);
doc.close();
graphics.dispose();
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]