我正在其中一个PDF页面上绘制图像..当我使用PDPageContentStream stream = new PDPageContentStream(doc,page);绘制图像,一切正常..见下图.
但是当我使用构造函数PDPageContentStream(doc,page,true,true)时;要创建PDPageContentStream并绘制图像,新添加的图像会颠倒倒置.
没有弄到这里出了什么问题..
解决方法:
使用具有第五个参数的构造函数,以重置图形上下文.
public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent,
boolean compress, boolean resetContext) throws IOException
或者,通过调用保存和恢复第一个内容流中的图形状态
saveGraphicsState();
// ...
restoreGraphicsState();
标签:java,android,pdfbox
来源: https://codeday.me/bug/20190612/1223678.html