iText image in java servlet

后端 未结 6 692
逝去的感伤
逝去的感伤 2021-01-13 13:45

I\'m doing the letter generation with iText (pdf/rtf) in java servlet and got a problem with accessing images. The images are in the WebContent/images folder. When I run it

6条回答
  •  南方客
    南方客 (楼主)
    2021-01-13 14:14

    For Kotlin, if the image is in the resources folder, you can also try the following:

    Image.getInstance(this::class.java.classLoader.getResourceAsStream("images/your_image.png").readBytes())

提交回复
热议问题