Skip to content

Commit

Permalink
eux-pdf-flattener
Browse files Browse the repository at this point in the history
  • Loading branch information
walberg committed Oct 21, 2024
1 parent dd0aa54 commit 0422cb3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class PdfApiImpl(
override fun flattenPdf(file: Resource?): ResponseEntity<Resource> {
try {
val byteArrayResource = ByteArrayResource(pdfService.flattenPdf(file!!.contentAsByteArray))
val map: MultiValueMap<String, String> = LinkedMultiValueMap()
map.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_PDF_VALUE)
map.add(HttpHeaders.CONTENT_LENGTH, byteArrayResource.contentLength().toString())
map.add(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(file!!.filename).build().toString())
val map: MultiValueMap<String, String> = LinkedMultiValueMap()
map.add(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_PDF_VALUE)
map.add(HttpHeaders.CONTENT_LENGTH, byteArrayResource.contentLength().toString())
map.add(HttpHeaders.CONTENT_DISPOSITION, ContentDisposition.attachment().filename(file!!.filename).build().toString())

return byteArrayResource.toPdfOkResponseEntity(map)
return byteArrayResource.toPdfOkResponseEntity(map)
} catch (e: RuntimeException) {
log.error ( "Feilet å konvertere " , e)
throw e
Expand Down
23 changes: 23 additions & 0 deletions eux-pdf-flattener-webapp/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="net.logstash.logback.encoder.LogstashEncoder"/>
</appender>

<springProfile name="local,local-remote">
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} %X{X-Nav-CallId} [%thread] %-5level %logger{70} - %msg%n
</pattern>
</encoder>
</appender>

</springProfile>

<root level="INFO">
<appender-ref ref="stdout"/>
</root>

</configuration>

0 comments on commit 0422cb3

Please sign in to comment.