Sfoglia il codice sorgente

Corretta applicazione protocollo su documenti provenienti da scanner

master
Salvatore La Manna 4 anni fa
parent
commit
1ad8921f81
  1. 44
      liferay-plugins-sdk-6.2/portlets/portos-report-portlet/docroot/WEB-INF/src/it/tref/liferay/portos/report/messaging/ProtocolloMessageListener.java

44
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; 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.Element;
import com.itextpdf.text.Font; import com.itextpdf.text.Font;
import com.itextpdf.text.FontFactory; import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Phrase; import com.itextpdf.text.Phrase;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.ColumnText; import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfContentByte;
import com.itextpdf.text.pdf.PdfLayer; 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.ServiceContext;
import com.liferay.portal.service.UserLocalServiceUtil; import com.liferay.portal.service.UserLocalServiceUtil;
import com.liferay.portlet.documentlibrary.DuplicateFileException; 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.DLAppLocalServiceUtil;
import com.liferay.portlet.documentlibrary.service.DLAppServiceUtil; 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 { public class ProtocolloMessageListener extends BaseMessageListener {
@ -143,15 +142,16 @@ public class ProtocolloMessageListener extends BaseMessageListener {
Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f); Font font = FontFactory.getFont(FontFactory.COURIER, 9.0f);
// Gestione stringa protocollo // Gestione stringa protocollo
float xProtocollo = cb.getPdfDocument().getPageSize().getWidth() - 8; Rectangle pageSize = reader.getPageSize(i);
float yProtocollo = cb.getPdfDocument().getPageSize().getHeight() / 3; float xProtocollo = pageSize.getWidth() - 8;
float yProtocollo = pageSize.getHeight() / 3;
ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font), ColumnText.showTextAligned(cb, Element.ALIGN_RIGHT, new Phrase(protocolloToAttach, font),
xProtocollo, yProtocollo, 90); xProtocollo, yProtocollo, 90);
// Gestion stringa oggetto // Gestion stringa oggetto
float xOggetto = cb.getPdfDocument().getPageSize().getWidth() - 8; float xOggetto = pageSize.getWidth() - 8;
float yOggetto = cb.getPdfDocument().getPageSize().getHeight() - 30; float yOggetto = pageSize.getHeight() - 30;
if (oggetto != null) { if (oggetto != null) {
if (oggetto.length() >= 75) { if (oggetto.length() >= 75) {

Caricamento…
Annulla
Salva