我正在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();