From 1ad8921f81d4b9323fed23725a02378668ae5d8e Mon Sep 17 00:00:00 2001 From: Salvatore La Manna Date: Fri, 12 Mar 2021 10:20:35 +0100 Subject: [PATCH] Corretta applicazione protocollo su documenti provenienti da scanner --- .../messaging/ProtocolloMessageListener.java | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java index 93089f84..a645d8ac 100644 --- a/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java +++ b/liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java @@ -1,9 +1,26 @@ package it.tref.liferay.portos.report.messaging; +import it.tref.liferay.portos.bo.shared.util.Constants; +import it.tref.liferay.portos.report.shared.constants.ReportConstants; +import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult; +import it.tref.liferay.portos.report.shared.dto.ReportDto; +import it.tref.liferay.portos.report.shared.dto.ReportResultDto; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.Serializable; +import java.nio.file.Files; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Map; + import com.itextpdf.text.Element; import com.itextpdf.text.Font; import com.itextpdf.text.FontFactory; import com.itextpdf.text.Phrase; +import com.itextpdf.text.Rectangle; import com.itextpdf.text.pdf.ColumnText; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfLayer; @@ -35,26 +52,8 @@ import com.liferay.portal.service.RoleLocalServiceUtil; import com.liferay.portal.service.ServiceContext; import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portlet.documentlibrary.DuplicateFileException; -import com.liferay.portlet.documentlibrary.model.DLFileEntry; import com.liferay.portlet.documentlibrary.service.DLAppLocalServiceUtil; import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; -import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; - -import it.tref.liferay.portos.bo.shared.util.Constants; -import it.tref.liferay.portos.report.shared.constants.ReportConstants; -import it.tref.liferay.portos.report.shared.constants.ReportConstants.ReportResult; -import it.tref.liferay.portos.report.shared.dto.ReportDto; -import it.tref.liferay.portos.report.shared.dto.ReportResultDto; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Serializable; -import java.nio.file.Files; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Map; public class ProtocolloMessageListener extends BaseMessageListener { @@ -143,15 +142,16 @@ public class ProtocolloMessageListener extends BaseMessageListener { Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f); // Gestione stringa protocollo - float xProtocollo = cb.getPdfDocument().getPageSize().getWidth() - 8; - float yProtocollo = cb.getPdfDocument().getPageSize().getHeight() / 3; + Rectangle pageSize = reader.getPageSize(i); + float xProtocollo = pageSize.getWidth() - 8; + float yProtocollo = pageSize.getHeight() / 3; ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font), xProtocollo, yProtocollo, 90); // Gestion stringa oggetto - float xOggetto = cb.getPdfDocument().getPageSize().getWidth() - 8; - float yOggetto = cb.getPdfDocument().getPageSize().getHeight() - 30; + float xOggetto = pageSize.getWidth() - 8; + float yOggetto = pageSize.getHeight() - 30; if (oggetto != null) { if (oggetto.length() >= 75) {