5条评论

  1. 用Java获取文件的信息
    Get Information About a PDF in Java
    https://www.baeldung.com/java-pdf-info
    `
    1. Overview
    In this tutorial, we’ll get to know different ways of getting information about a PDF file using the iText and PDFBox libraries in Java.

    2. iText Library

    2.2. Getting the Number of Pages
    PdfReader.getNumberOfPages()

    2.3. Getting the PDF Metadata
    PdfReader.getInfo()

    2.4. Knowing the PDF Password Protection
    PdfReader.isEncrypted()

    3. PDFBox Library

    3.2. Getting the Number of Pages
    PDDocument.getNumberOfPages()

    3.3. Getting the PDF Metadata
    PDDocumentInformation info = PDDocument.getDocumentInformation();

    3.4. Knowing the PDF Password Protection
    boolean isEncrypted = PDDocument.isEncrypted();
    `

  2. 6. Adding Watermarks to Existing PDF
    iText PDF library made it easy to add watermarks to existing PDFs. We’ll first load our PDF document into our program. And use the iText library to manipulate our existing PDF.
    https://www.baeldung.com/java-watermarks-with-itext
    https://github.com/eugenp/tutorials/blob/master/libraries-files/src/main/java/com/baeldung/iTextPDF/StoryTime.java
    `
    func main
    func createPdf
    func addWatermarkToExistingPdf
    func createWatermarkParagraph
    func addWatermarkToPage
    func addWatermarkToExistingPage
    `

  3. java生成PDF的几种方法
    https://www.jianshu.com/p/e0a54d5e63c3
    `
    总结一下用java生成PDF的方法:

    A、itext-PdfStamper pdfStamper(俗称抠模板)
    B、itext-Document document(正常代码撰写)
    C、wkhtmltopdf(使用工具)

    比较分析
    方法 优点 缺点
    A 代码简单 模板要先提供,且字段长度固定、不灵活
    B 模板可根据代码调整、但样式不如C灵活 要维护的后台代码较多
    C 模板样式可根据前端随意调整 要维护的前台代码较多
    `

  4. How to identify and remove hidden text from the PDF using PDFBox java
    https://stackoverflow.com/questions/63936154/how-to-identify-and-remove-hidden-text-from-the-pdf-using-pdfbox-java?rq=3
    `
    So let’s extend the text stripper by a color filtering option. This in particular means adding operator processors for color setting instructions as the PDFTextStripper by default ignores them

    因此,让我们通过颜色过滤选项来扩展文本剥离器。这尤其意味着为颜色设置指令添加操作处理器,因为 PDFTextStripper 默认忽略这些指令
    `

    PDFBox – Removing invisible text (by clip/filling paths issue)
    https://stackoverflow.com/questions/47908124/pdfbox-removing-invisible-text-by-clip-filling-paths-issue
    `
    The reason why the PDFVisibleTextStripper from this answer the OP referenced does not work is that the calculation of the end of a character baseline end in the overwritten processTextPosition does not take page rotation into account. If you change that method, though, to only test the start of each character baseline and ignore the end, it works fairly good for the document at hand:

    OP 所引用的答案中的 PDFVisibleTextStripper 无法正常工作的原因是,在覆盖 processTextPosition 中计算字符基线末端时没有将页面旋转考虑在内。不过,如果更改该方法,只测试每个字符基线的起点,而忽略终点,那么对于手头的文档来说,效果还是不错的:
    `

    Methods for Adding Hidden Text to a PDF Document
    https://copyprogramming.com/howto/how-to-insert-invisible-text-into-a-pdf

  5. Page orientation 页面方向
    https://en.wikipedia.org/wiki/Page_orientation
    `
    landscape mode是指宽度比高度宽的模式,也就是俗称的”宽屏模式”;
    portrait mode是指高度比宽度高的模式,也就是俗称的”竖屏模式”;
    `
    啥是landscape,啥是portrait
    https://blog.csdn.net/k7arm/article/details/48085423

    What is the difference between portrait mode and landscape mode?
    https://pc.net/helpcenter/portrait_and_landscape_mode

回复 abc 取消回复

您的邮箱地址不会被公开。 必填项已用 * 标注