The repo is Kotlin/jvm code.
The code is come from: jipp example, the library just wrapper sample code.
- copy code of use maven/gradle
- import
dependencies {
implementation("top.kikt:PdfToPrinter:1.0.0")
}
- use code in kotlin
package top.kikt.pdf
import org.junit.jupiter.api.Test
import java.io.FileInputStream
import java.io.IOException
internal class ConverterKtTest {
@Test
fun convertPdfTest() {
for (outputFormat in OutputFormat.values()) {
val inputStream =
FileInputStream("testFiles/2022-11-26.pdf") ?: throw IOException("The inputStream cannot open")
inputStream.use {
convertPdf(inputStream, outputFormat) {
val bytes = it.toByteArray()
println("$outputFormat bytes count: ${bytes.count()}")
}
}
}
}
}