PDFBox: PDPageContentStream adds bad behavior mode
I am drawing an image on one of the PDF pages. When I use PDPageContentStream stream = new PDPageContentStream(doc, page);
to draw an image everything works fine. see below image.
but when I use the constructor PDPageContentStream(doc, page, true, true);
to create PDPageContentStream
and draw the image, the newly added image is flipped upside down.
it does not work, what is wrong here.
PS. I am using PdfBox-Android library
+3
source to share
1 answer
Use the constructor with the 5th parameter, so reset the graphics context.
public PDPageContentStream(PDDocument document, PDPage sourcePage, boolean appendContent,
boolean compress, boolean resetContext) throws IOException
alternatively, save and restore the graphics state in the first content stream by calling
saveGraphicsState();
// ...
restoreGraphicsState();
+5
source to share