Cannot figure out how to use PDFBox

后端 未结 2 823
我在风中等你
我在风中等你 2021-01-04 23:02

I am trying to create a PDF file with a lot of text boxes in the document and textfields from another class. I am using PDFBox.

OK, creating a new file is easy and w

相关标签:
2条回答
  • 2021-01-04 23:41

    This implementation is deprecated.

    PDPageContentStream title1 = new PDPageContentStream(doc, page, true, true);
    

    The new implementation would be

    PDPageContentStream title1 = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.OVERWRITE, true);
    
    0 讨论(0)
  • 2021-01-04 23:49
    PDPageContentStream title1 = new PDPageContentStream(doc, page, true, true);
    

    OP posted this as the answer, so this will flag to the system that there was an answer

    Furthermore, if the first content stream contains operations substantially changing the graphics state, e.g. by changing the current transformation matrix, and one wants the new content stream to start with these changes reverted, one should use the constructor with three boolean parameters:

    PDPageContentStream title1 = new PDPageContentStream(doc, page, true, true, true);
    
    0 讨论(0)
提交回复
热议问题