PDFBox:PDPageContentStream的追加模式行为不端

我正在其中一个PDF页面上绘制图像..当我使用PDPageContentStream stream = new PDPageContentStream(doc, page); 绘制图像,一切正常..见下图。

图片

但是当我使用构造函数PDPageContentStream(doc, page, true, true); 要创建PDPageContentStream并绘制图像,新添加的图像会颠倒倒置。

图片

没有弄到这里出了什么问题..

PS。 我正在使用库PdfBox-Android

使用具有第五个参数的构造函数,以便重置图形上下文。

 public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent, boolean compress, boolean resetContext) throws IOException 

或者,通过调用保存和恢复第一个内容流中的图形状态

 saveGraphicsState(); // ... restoreGraphicsState();