Skip to content

Commit

Permalink
Bumped pdfgencore to 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MikAoJk committed Nov 15, 2023
1 parent d7946b1 commit c50508a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 29 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ val junitJupiterVersion = "5.10.1"
val verapdfVersion = "1.24.1"
val ktfmtVersion = "0.44"
val testcontainersVersion= "1.19.1"
val pdfgencoreVersion = "1.0.2"
val pdfgencoreVersion = "1.0.3"


plugins {
Expand Down
29 changes: 1 addition & 28 deletions src/test/kotlin/no/nav/pdfgen/RenderingTest.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
package no.nav.pdfgen

// import no.nav.pdfgen.core.api.render
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.github.jknack.handlebars.Context
import com.github.jknack.handlebars.JsonNodeValueResolver
import com.github.jknack.handlebars.context.MapValueResolver
import java.io.ByteArrayInputStream
import no.nav.pdfgen.core.HANDLEBARS_RENDERING_SUMMARY
import no.nav.pdfgen.core.pdf.createPDFA
import no.nav.pdfgen.core.pdf.render
import no.nav.pdfgen.core.template.loadTemplates
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
Expand Down Expand Up @@ -101,26 +97,3 @@ internal class RenderingTest {
}
}
}

// TODO remove this and use pdfgen-core method
fun render(directoryName: String, template: String, jsonNode: JsonNode): String? {
return HANDLEBARS_RENDERING_SUMMARY.startTimer()
.use {
loadTemplates()[directoryName to template]?.apply(
Context.newBuilder(jsonNode)
.resolver(
JsonNodeValueResolver.INSTANCE,
MapValueResolver.INSTANCE,
)
.build(),
)
}
?.let { html ->
/* Uncomment to output html to file for easier debug
* File("pdf.html").bufferedWriter().use { out ->
* out.write(html)
* }
*/
html
}
}

0 comments on commit c50508a

Please sign in to comment.