From cc4c31cfa7809e4b0b439914d4191ca0f8e299f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Knut=20Bj=C3=B8rnar=20W=C3=A5lberg?= Date: Sun, 4 Aug 2024 22:34:38 +0200 Subject: [PATCH] eux-pdf-flattener --- .../kotlin/no/nav/eux/pdf/service/FlattenPdfService.kt | 4 +++- print.js | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/eux-pdf-flattener-service/src/main/kotlin/no/nav/eux/pdf/service/FlattenPdfService.kt b/eux-pdf-flattener-service/src/main/kotlin/no/nav/eux/pdf/service/FlattenPdfService.kt index 98f457b..cbeff5c 100644 --- a/eux-pdf-flattener-service/src/main/kotlin/no/nav/eux/pdf/service/FlattenPdfService.kt +++ b/eux-pdf-flattener-service/src/main/kotlin/no/nav/eux/pdf/service/FlattenPdfService.kt @@ -15,7 +15,7 @@ class FlattenPdfService( val inPath= "/tmp/pdf.js/in/" val outPath = "/tmp/pdf.js/out/" val printJsPath = "/print.js" - val timeout = 65; + val timeout = 55; val charPool : List = ('a'..'z') + ('A'..'Z') + ('0'..'9') @@ -26,6 +26,8 @@ class FlattenPdfService( val exitCode = process.waitFor() if (exitCode == 0) { + val listFiles = File(outPath).listFiles() + log.info { "Files $listFiles" } val readBytes = File(outPath + randomName).readBytes() return readBytes } else { diff --git a/print.js b/print.js index 34c56d0..19a1f99 100644 --- a/print.js +++ b/print.js @@ -7,8 +7,8 @@ const options = { }; var args = process.argv.slice(2); - const url = 'http://localhost:8888/web/viewer.html?file=/in/' + args[0]; - - -let pdf = htmlPdf.create(url, options).then((pdf) => pdf.toFile('/tmp/pdf.js/out/' + args[0])); +const outFile = '/tmp/pdf.js/out/' + args[0] +process.stdout.write(url) +process.stdout.write(outFile) +let pdf = htmlPdf.create(url, options).then((pdf) => pdf.toFile(outFile));