From 017c6b9a70145dc753ce5d7c5ec7be2ddd1ae504 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Sat, 22 Jun 2024 00:41:54 +0200 Subject: [PATCH 1/6] new converter --- .java-version | 2 +- node/package.json | 7 +++ pom.xml | 27 ++++++++- .../HttpTriggerGeneratePDFFunction.java | 43 +++++++------- .../service/impl/GeneratePDFServiceImpl.java | 59 ++++++++++++++++--- 5 files changed, 103 insertions(+), 35 deletions(-) diff --git a/.java-version b/.java-version index b4de3947..98d9bcb7 100644 --- a/.java-version +++ b/.java-version @@ -1 +1 @@ -11 +17 diff --git a/node/package.json b/node/package.json index 9a6a0723..c21f8392 100644 --- a/node/package.json +++ b/node/package.json @@ -30,3 +30,10 @@ "jest": "^29.6.4" } } + +2024-06-21 16:16:16.420 DEBUG 1 --- [io-8080-exec-10] i.g.p.p.n.g.client.PdfEngineClientImpl : +endpoint POST https://api.dev.platform.pagopa.it/printit/pdf-engine/v1/generate-pdf +headers [Ocp-Apim-Subscription-Key: 2627c054351c49b8a28e6754e61c933a] +body {"debtor":{"fullName":"Mario Rossi","taxCode":"FFFCST83A15L113V","address":"Via Roma","buildingNumber":"15","postalCode":"00100","city":"Roma","province":"RM"},"payee":{"logo":"https://pagopadprintitci.blob.core.windows.net/institutionslogoblob/00264560608%2Flogo.png","name":"Comune di Frosinone","taxCode":"00264560608","sector":"Servizio Pagamenti (Test)","additionalInfo":"info test","channel":{"online":{"website":true,"app":true},"physical":{"data":""}}},"notice":{"subject":"Avviso Pagamento di TEST","amount":"1,00","expiryDate":"31/12/2024","qrCode":"PAGOPA|002|123456789012345678|00264560608|100","refNumber":"123456789012345678","cbillCode":"AMX61","posteAccountNumber":"232323","posteAuth":"AUT. 08/5 S3/81 53079 08129.07.20211","posteDocumentType":"896","posteDataMatrix":"codfase=NBPA;181234567890123456781200000023232310000000010038961P100264560608FFFCST83A15L113VMario Rossi Avviso Pagamento di TEST A","instalments":{"items":[],"discounted":{},"reduced":{}}}} + +args={noticeGenerationRequestItem=NoticeGenerationRequestItem(templateId=TemplateSingleInstalment, data=NoticeRequestData(notice=Notice(subject=Avviso Pagamento di TEST, paymentAmount=100, reducedAmount=null, discountedAmount=null, dueDate=31/12/2024, code=123456789012345678, installments=null), creditorInstitution=CreditorInstitution(taxCode=00264560608, fullName=null, organization=null, info=null, webChannel=null, appChannel=null, physicalChannel=null, cbill=null, logo=null, posteAuth=null, posteAccountNumber=null))), folderId=}, operationId=f2952e2a-36a9-4a46-a393-efb3762c4c17, startTime=1718986576314, method=generateNotice, requestId=request 58 diff --git a/pom.xml b/pom.xml index d6143a5b..99927909 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ com.e-iceblue e-iceblue https://repo.e-iceblue.com/nexus/content/groups/public/ - + maven_centralMaven Centralhttps://repo.maven.apache.org/maven2/ @@ -188,7 +188,7 @@ e-iceblue spire.pdf.free - 9.12.3 + 5.1.0 @@ -234,6 +234,29 @@ 2.6.1 + + org.apache.pdfbox + pdfbox-tools + 3.0.2 + + + net.sf.cssbox + pdf2dom + 2.0.3 + + + + com.itextpdf + itextpdf + 5.5.13 + + + com.itextpdf + itext-pdfa + 5.5.13 + + + diff --git a/src/main/java/it/gov/pagopa/pdf/engine/HttpTriggerGeneratePDFFunction.java b/src/main/java/it/gov/pagopa/pdf/engine/HttpTriggerGeneratePDFFunction.java index c85398da..4c856d50 100644 --- a/src/main/java/it/gov/pagopa/pdf/engine/HttpTriggerGeneratePDFFunction.java +++ b/src/main/java/it/gov/pagopa/pdf/engine/HttpTriggerGeneratePDFFunction.java @@ -1,4 +1,3 @@ - package it.gov.pagopa.pdf.engine; import com.fasterxml.jackson.databind.ObjectMapper; @@ -41,14 +40,11 @@ */ public class HttpTriggerGeneratePDFFunction { - private final Logger logger = LoggerFactory.getLogger(HttpTriggerGeneratePDFFunction.class); - - private final String workingDirectoryPath = System.getenv().getOrDefault("WORKING_DIRECTORY_PATH", ""); - private static final String INVALID_REQUEST_MESSAGE = "Invalid request"; private static final String ERROR_GENERATING_PDF_MESSAGE = "An error occurred when generating the PDF"; private static final String PATTERN_FORMAT = "yyyy.MM.dd.HH.mm.ss"; - + private final Logger logger = LoggerFactory.getLogger(HttpTriggerGeneratePDFFunction.class); + private final String workingDirectoryPath = System.getenv().getOrDefault("WORKING_DIRECTORY_PATH", ""); private final GeneratePDFService generatePDFService; private final ParseRequestBodyService parseRequestBodyService; @@ -63,6 +59,16 @@ public HttpTriggerGeneratePDFFunction(GeneratePDFService generatePDFService, Par this.parseRequestBodyService = parseRequestBodyService; } + private static HttpStatus getHttpStatus(PDFEngineException e) { + HttpStatus status; + if(e.getErrorCode().equals(AppErrorCodeEnum.PDFE_703) || e.getErrorCode().equals(AppErrorCodeEnum.PDFE_704) || e.getErrorCode().equals(AppErrorCodeEnum.PDFE_705)) { + status = INTERNAL_SERVER_ERROR; + } else { + status = BAD_REQUEST; + } + return status; + } + /** * This function will be invoked when a Http Trigger occurs. * This function listens at endpoint "/api/generate-pdf". To invoke it using "curl" command in bash: @@ -80,7 +86,7 @@ public HttpResponseMessage run( logger.debug("Generate PDF function called at {}", LocalDateTime.now()); Optional optionalRequestBody = request.getBody(); - if (optionalRequestBody.isEmpty()) { + if(optionalRequestBody.isEmpty()) { logger.error("Invalid request the payload is null"); return request .createResponseBuilder(BAD_REQUEST) @@ -122,7 +128,7 @@ public HttpResponseMessage run( .build(); } - if (generatePDFInput.getTemplateZip() == null) { + if(generatePDFInput.getTemplateZip() == null) { logger.error("Invalid request, template HTML not provided"); return request .createResponseBuilder(BAD_REQUEST) @@ -130,7 +136,7 @@ public HttpResponseMessage run( .build(); } - if (generatePDFInput.getData() == null) { + if(generatePDFInput.getData() == null) { logger.error("Invalid request the PDF document input data are null"); return request .createResponseBuilder(BAD_REQUEST) @@ -138,7 +144,7 @@ public HttpResponseMessage run( .build(); } - try (BufferedInputStream inputStream = generatePDFService.generatePDF(generatePDFInput, workingDirPath, logger)){ + try (BufferedInputStream inputStream = generatePDFService.generatePDF(generatePDFInput, workingDirPath, logger)) { byte[] fileBytes = inputStream.readAllBytes(); logger.debug("Returning generated pdf at {}", LocalDateTime.now()); @@ -176,16 +182,6 @@ public HttpResponseMessage run( } - private static HttpStatus getHttpStatus(PDFEngineException e) { - HttpStatus status; - if (e.getErrorCode().equals(AppErrorCodeEnum.PDFE_703) || e.getErrorCode().equals(AppErrorCodeEnum.PDFE_704) || e.getErrorCode().equals(AppErrorCodeEnum.PDFE_705)) { - status = INTERNAL_SERVER_ERROR; - } else { - status = BAD_REQUEST; - } - return status; - } - private ErrorResponse buildResponseBody(HttpStatus status, AppErrorCodeEnum appErrorCode, String message) { return new ErrorResponse( status, @@ -209,12 +205,13 @@ private void clearTempDirectory(Path workingDirPath) { private File createWorkingDirectory() throws IOException { File workingDirectory = new File(workingDirectoryPath); - if (!workingDirectory.exists()) { + if(!workingDirectory.exists()) { try { Files.createDirectory(workingDirectory.toPath()); - } catch (FileAlreadyExistsException e) {} + } catch (FileAlreadyExistsException e) { + } } return workingDirectory; } -} \ No newline at end of file +} diff --git a/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java b/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java index 7e70027f..d26cdec6 100644 --- a/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java +++ b/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java @@ -1,7 +1,8 @@ - package it.gov.pagopa.pdf.engine.service.impl; -import com.spire.pdf.conversion.PdfStandardsConverter; +import com.itextpdf.text.Document; +import com.itextpdf.text.DocumentException; +import com.itextpdf.text.pdf.*; import it.gov.pagopa.pdf.engine.client.impl.PdfEngineClientImpl; import it.gov.pagopa.pdf.engine.exception.GeneratePDFException; import it.gov.pagopa.pdf.engine.model.AppErrorCodeEnum; @@ -11,7 +12,6 @@ import it.gov.pagopa.pdf.engine.service.GeneratePDFService; import it.gov.pagopa.pdf.engine.util.ObjectMapperUtils; import org.apache.commons.io.IOUtils; - import org.slf4j.Logger; import java.io.*; @@ -22,8 +22,46 @@ import java.util.zip.ZipOutputStream; import static it.gov.pagopa.pdf.engine.model.AppErrorCodeEnum.*; + public class GeneratePDFServiceImpl implements GeneratePDFService { + + public static void convert(String pdfNormal, String pdfA, Logger logger) { + Document document = new Document(); + PdfReader reader; + try { + PdfAWriter writer = PdfAWriter.getInstance(document, new FileOutputStream(pdfA), PdfAConformanceLevel.PDF_A_1B); + document.addCreationDate(); + + writer.setTagged(); + writer.createXmpMetadata(); + writer.setCompressionLevel(9); + + document.open(); + PdfContentByte pdfContentByte = writer.getDirectContent(); + + reader = new PdfReader(pdfNormal); + + PdfImportedPage page; + + int pageCount = reader.getNumberOfPages(); + for (int i = 0; i < pageCount; i++) { + final int index = i + 1; + document.setPageSize(reader.getPageSize(index)); + document.newPage(); + + page = writer.getImportedPage(reader, index); + page.setBoundingBox(reader.getCropBox(index)); + + pdfContentByte.addTemplate(page, 0, 0); + } + } catch (IOException | DocumentException ex) { + logger.error(ex.getMessage(), ex); + } + + document.close(); + } + @Override public BufferedInputStream generatePDF(GeneratePDFInput generatePDFInput, Path workingDirPath, Logger logger) throws GeneratePDFException { @@ -42,20 +80,22 @@ public BufferedInputStream generatePDF(GeneratePDFInput generatePDFInput, Path w logger.debug("PdfEngineClient called at {}", LocalDateTime.now()); PdfEngineResponse response = pdfEngineClient.generatePDF(pdfEngineRequest); - if (response.getStatusCode() != 200 || response.getTempPdfPath() == null) { + if(response.getStatusCode() != 200 || response.getTempPdfPath() == null) { throw new GeneratePDFException(AppErrorCodeEnum.valueOf( - response.getErrorCode()),response.getErrorMessage()); + response.getErrorCode()), response.getErrorMessage()); } logger.debug("PdfEngineClient responded at {}", LocalDateTime.now()); String fileToReturn = response.getTempPdfPath(); - logger.debug("Starting pdf conversion at {}", LocalDateTime.now()); - PdfStandardsConverter converter = new PdfStandardsConverter(fileToReturn); - converter.toPdfA2A(pdfTempFile.getParent() + "/ToPdfA2A.pdf"); + logger.info("Starting pdf conversion at {}", LocalDateTime.now()); +// PdfStandardsConverter converter = new PdfStandardsConverter(fileToReturn); +// converter.toPdfA2A(pdfTempFile.getParent() + "/ToPdfA2A.pdf"); + convert(fileToReturn, pdfTempFile.getParent() + "/ToPdfA2A.pdf", logger); + fileToReturn = pdfTempFile.getParent() + "/ToPdfA2A.pdf"; logger.debug("Completed pdf conversion at {}", LocalDateTime.now()); - if (generatePDFInput.isGenerateZipped()) { + if(generatePDFInput.isGenerateZipped()) { return zipPDFDocument(new File(fileToReturn), workingDirPath); } return new BufferedInputStream(new FileInputStream(fileToReturn)); @@ -98,4 +138,5 @@ private File createTempFile(String fileName, String fileExtension, Path workingD throw new GeneratePDFException(error, error.getErrorMessage(), e); } } + } From 536e1adb57c13ccd852dfa2f1f32deb947e4cbd1 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Sat, 22 Jun 2024 09:16:50 +0000 Subject: [PATCH 2/6] Bump to version 2.10.9-itextpdfa [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- openapi/openapi_node.json | 2 +- pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 8da0231a..1bddfdf2 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopapdfengine description: Microservice description type: application -version: 0.117.0 -appVersion: 2.10.8 +version: 0.118.0 +appVersion: 2.10.9-itextpdfa dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 628fcebb..618163e5 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.8" + tag: "2.10.9-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 667bc429..f56e4553 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.8" + tag: "2.10.9-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 579e7ab8..506add3c 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.8" + tag: "2.10.9-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/openapi/openapi.json b/openapi/openapi.json index d2411bd4..b5f91271 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "OpenAPI definition - PDF Engine", - "version": "2.10.8" + "version": "2.10.9-itextpdfa" }, "servers": [ { diff --git a/openapi/openapi_node.json b/openapi/openapi_node.json index f424716a..5876ccb9 100644 --- a/openapi/openapi_node.json +++ b/openapi/openapi_node.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "OpenAPI definition - PDF Engine Node", - "version": "2.10.8" + "version": "2.10.9-itextpdfa" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 99927909..c648ecc2 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ it.gov.pagopa pdf-engine - 2.10.8 + 2.10.9-itextpdfa jar pagopa-pdf-engine From 0f0cbd38b2ffe2e68b4281f5df57c2745cd73fe0 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Sat, 22 Jun 2024 11:28:17 +0200 Subject: [PATCH 3/6] rollback --- node/package.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/node/package.json b/node/package.json index c21f8392..9a6a0723 100644 --- a/node/package.json +++ b/node/package.json @@ -30,10 +30,3 @@ "jest": "^29.6.4" } } - -2024-06-21 16:16:16.420 DEBUG 1 --- [io-8080-exec-10] i.g.p.p.n.g.client.PdfEngineClientImpl : -endpoint POST https://api.dev.platform.pagopa.it/printit/pdf-engine/v1/generate-pdf -headers [Ocp-Apim-Subscription-Key: 2627c054351c49b8a28e6754e61c933a] -body {"debtor":{"fullName":"Mario Rossi","taxCode":"FFFCST83A15L113V","address":"Via Roma","buildingNumber":"15","postalCode":"00100","city":"Roma","province":"RM"},"payee":{"logo":"https://pagopadprintitci.blob.core.windows.net/institutionslogoblob/00264560608%2Flogo.png","name":"Comune di Frosinone","taxCode":"00264560608","sector":"Servizio Pagamenti (Test)","additionalInfo":"info test","channel":{"online":{"website":true,"app":true},"physical":{"data":""}}},"notice":{"subject":"Avviso Pagamento di TEST","amount":"1,00","expiryDate":"31/12/2024","qrCode":"PAGOPA|002|123456789012345678|00264560608|100","refNumber":"123456789012345678","cbillCode":"AMX61","posteAccountNumber":"232323","posteAuth":"AUT. 08/5 S3/81 53079 08129.07.20211","posteDocumentType":"896","posteDataMatrix":"codfase=NBPA;181234567890123456781200000023232310000000010038961P100264560608FFFCST83A15L113VMario Rossi Avviso Pagamento di TEST A","instalments":{"items":[],"discounted":{},"reduced":{}}}} - -args={noticeGenerationRequestItem=NoticeGenerationRequestItem(templateId=TemplateSingleInstalment, data=NoticeRequestData(notice=Notice(subject=Avviso Pagamento di TEST, paymentAmount=100, reducedAmount=null, discountedAmount=null, dueDate=31/12/2024, code=123456789012345678, installments=null), creditorInstitution=CreditorInstitution(taxCode=00264560608, fullName=null, organization=null, info=null, webChannel=null, appChannel=null, physicalChannel=null, cbill=null, logo=null, posteAuth=null, posteAccountNumber=null))), folderId=}, operationId=f2952e2a-36a9-4a46-a393-efb3762c4c17, startTime=1718986576314, method=generateNotice, requestId=request 58 From 08f96a54a1acc3044f5cb72c1779804721f24d4e Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Sat, 22 Jun 2024 09:33:19 +0000 Subject: [PATCH 4/6] Bump to version 2.10.10-itextpdfa [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- openapi/openapi_node.json | 2 +- pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 1bddfdf2..c0b99631 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopapdfengine description: Microservice description type: application -version: 0.118.0 -appVersion: 2.10.9-itextpdfa +version: 0.119.0 +appVersion: 2.10.10-itextpdfa dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 618163e5..2c2dbe26 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.9-itextpdfa" + tag: "2.10.10-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index f56e4553..4876515c 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.9-itextpdfa" + tag: "2.10.10-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 506add3c..2a30677f 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.9-itextpdfa" + tag: "2.10.10-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/openapi/openapi.json b/openapi/openapi.json index b5f91271..7c9e464d 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "OpenAPI definition - PDF Engine", - "version": "2.10.9-itextpdfa" + "version": "2.10.10-itextpdfa" }, "servers": [ { diff --git a/openapi/openapi_node.json b/openapi/openapi_node.json index 5876ccb9..4be46897 100644 --- a/openapi/openapi_node.json +++ b/openapi/openapi_node.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "OpenAPI definition - PDF Engine Node", - "version": "2.10.9-itextpdfa" + "version": "2.10.10-itextpdfa" }, "servers": [ { diff --git a/pom.xml b/pom.xml index c648ecc2..240c2b76 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ it.gov.pagopa pdf-engine - 2.10.9-itextpdfa + 2.10.10-itextpdfa jar pagopa-pdf-engine From cd0bbc23eaf93e5c91645ba8a9c68adbbeef77f7 Mon Sep 17 00:00:00 2001 From: pagopa-github-bot Date: Sat, 22 Jun 2024 09:45:19 +0000 Subject: [PATCH 5/6] Bump to version 2.10.11-itextpdfa [skip ci] --- helm/Chart.yaml | 4 ++-- helm/values-dev.yaml | 2 +- helm/values-prod.yaml | 2 +- helm/values-uat.yaml | 2 +- openapi/openapi.json | 2 +- openapi/openapi_node.json | 2 +- pom.xml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index c0b99631..31f8cb60 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,8 +2,8 @@ apiVersion: v2 name: pagopapdfengine description: Microservice description type: application -version: 0.119.0 -appVersion: 2.10.10-itextpdfa +version: 0.120.0 +appVersion: 2.10.11-itextpdfa dependencies: - name: microservice-chart version: 2.4.0 diff --git a/helm/values-dev.yaml b/helm/values-dev.yaml index 2c2dbe26..3e5d1985 100644 --- a/helm/values-dev.yaml +++ b/helm/values-dev.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.10-itextpdfa" + tag: "2.10.11-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/helm/values-prod.yaml b/helm/values-prod.yaml index 4876515c..4a9ff46c 100644 --- a/helm/values-prod.yaml +++ b/helm/values-prod.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.10-itextpdfa" + tag: "2.10.11-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/helm/values-uat.yaml b/helm/values-uat.yaml index 2a30677f..152bb248 100644 --- a/helm/values-uat.yaml +++ b/helm/values-uat.yaml @@ -4,7 +4,7 @@ microservice-chart: fullnameOverride: "" image: repository: ghcr.io/pagopa/pagopa-pdf-engine - tag: "2.10.10-itextpdfa" + tag: "2.10.11-itextpdfa" pullPolicy: Always # https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script.WebHost/Controllers/HostController.cs livenessProbe: diff --git a/openapi/openapi.json b/openapi/openapi.json index 7c9e464d..2ded571e 100644 --- a/openapi/openapi.json +++ b/openapi/openapi.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "OpenAPI definition - PDF Engine", - "version": "2.10.10-itextpdfa" + "version": "2.10.11-itextpdfa" }, "servers": [ { diff --git a/openapi/openapi_node.json b/openapi/openapi_node.json index 4be46897..1dcd33e7 100644 --- a/openapi/openapi_node.json +++ b/openapi/openapi_node.json @@ -2,7 +2,7 @@ "openapi": "3.0.1", "info": { "title": "OpenAPI definition - PDF Engine Node", - "version": "2.10.10-itextpdfa" + "version": "2.10.11-itextpdfa" }, "servers": [ { diff --git a/pom.xml b/pom.xml index 535413e1..e065fbd3 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ it.gov.pagopa pdf-engine - 2.10.10-itextpdfa + 2.10.11-itextpdfa jar pagopa-pdf-engine From 3262c64be81e2dceeb67f5f82bf1d84b7816cafb Mon Sep 17 00:00:00 2001 From: Jacopo Date: Sat, 22 Jun 2024 11:54:02 +0200 Subject: [PATCH 6/6] clean code --- pom.xml | 10 ---------- .../engine/service/impl/GeneratePDFServiceImpl.java | 2 -- 2 files changed, 12 deletions(-) diff --git a/pom.xml b/pom.xml index 535413e1..7a332552 100644 --- a/pom.xml +++ b/pom.xml @@ -239,16 +239,6 @@ 2.6.1 - - org.apache.pdfbox - pdfbox-tools - 3.0.2 - - - net.sf.cssbox - pdf2dom - 2.0.3 - com.itextpdf diff --git a/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java b/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java index d26cdec6..25d58b5c 100644 --- a/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java +++ b/src/main/java/it/gov/pagopa/pdf/engine/service/impl/GeneratePDFServiceImpl.java @@ -88,8 +88,6 @@ public BufferedInputStream generatePDF(GeneratePDFInput generatePDFInput, Path w String fileToReturn = response.getTempPdfPath(); logger.info("Starting pdf conversion at {}", LocalDateTime.now()); -// PdfStandardsConverter converter = new PdfStandardsConverter(fileToReturn); -// converter.toPdfA2A(pdfTempFile.getParent() + "/ToPdfA2A.pdf"); convert(fileToReturn, pdfTempFile.getParent() + "/ToPdfA2A.pdf", logger); fileToReturn = pdfTempFile.getParent() + "/ToPdfA2A.pdf";