From 82f9a8d86e8fb91627bc41dd9bfb617a15c64638 Mon Sep 17 00:00:00 2001 From: Thomas Gutmann Date: Fri, 9 Aug 2024 21:39:06 +0200 Subject: [PATCH] Enhance the designer to add the PDF emitter options like configuration at advanced property register --- .../report/engine/emitter/pdf/PDFPage.java | 3 +- .../engine/emitter/pdf/PDFPageDevice.java | 377 ++++++++++-------- .../model/api/ReportDesignHandleImpl.java | 172 ++++++++ .../IInternalReportDesignModel.java | 45 +++ .../birt/report/model/elements/rom.def | 43 +- .../report/model/i18n/Messages.properties | 31 +- .../report/model/writer/DesignWriterImpl.java | 9 + 7 files changed, 514 insertions(+), 166 deletions(-) diff --git a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java index 085252eedd..e2d2d93ffa 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java @@ -470,9 +470,10 @@ private void drawText(String text, float textX, float textY, FontInfo fontInfo, if (this.pageDevice.isPdfAFormat() && fontInfo.getBaseFont() != null && !fontInfo.getBaseFont().isEmbedded()) { try { + // PDF/A fallback font must be entered fully qualified with path and file name String defaultFontPdfA = this.pageDevice.getDefaultFontPdfA(); if (defaultFontPdfA != null) { - font = BaseFont.createFont(defaultFontPdfA, "", true); + font = BaseFont.createFont(defaultFontPdfA, BaseFont.IDENTITY_H, true); } logger.log(Level.WARNING, "PDF/A: " + fontInfo.getFontName() + " not embeddable, fallback font used."); diff --git a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java index 0379e7ae6c..ea2e106416 100644 --- a/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java +++ b/engine/org.eclipse.birt.report.engine.emitter.pdf/src/org/eclipse/birt/report/engine/emitter/pdf/PDFPageDevice.java @@ -247,92 +247,90 @@ public PDFPageDevice(OutputStream output, String title, String author, String su // append to the end. // this is where we will test the merge List pdfs = new ArrayList<>(); + Object listObject; // added null check - if (userProperties != null) { - Object listObject = userProperties.get(PDFPageDevice.PREPEND_PROPERTY_NAME); - if (userProperties.containsKey(PDFPageDevice.PDF_PREPEND_DOCUMENTS)) { - listObject = userProperties.get(PDFPageDevice.PDF_PREPEND_DOCUMENTS); - } + if (userProperties != null && userProperties.containsKey(PDFPageDevice.PREPEND_PROPERTY_NAME)) { + listObject = userProperties.get(PDFPageDevice.PREPEND_PROPERTY_NAME); + } else if (userProperties != null && userProperties.containsKey(PDFPageDevice.PDF_PREPEND_DOCUMENTS)) { + listObject = userProperties.get(PDFPageDevice.PDF_PREPEND_DOCUMENTS); + } else { + listObject = Expression.newConstant(-1, + (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDF_PREPEND_DOCUMENTS)); + } + + if (listObject != null) { + Expression exp = (Expression) listObject; - if (listObject != null) { - Expression exp = (Expression) listObject; - - Object result = context.evaluate(exp); - // there are two options here. 1 is the user property "AppendList" is a - // comma-seperated - // string list. If so, check that it is a String, and split it. - if (result instanceof String) { - String list = (String) result; - - // check that the report variable AppendList is set, and actually has value - if (list != null) { - if (list.length() > 0) { - // iterate over the list, and create a fileinputstream for each file location. - for (String s : list.split(",")) { - // If there is an exception creating the input stream, don't stop execution. - // Just graceffully let the user know that there was an error with the variable. - try { - String fileName = s.trim(); - - File f = new File(fileName); - - if (f.exists()) { - FileInputStream fis = new FileInputStream(f); - - pdfs.add(fis); - } else { - // get the file using context.getResource() for relative or universal paths - URL url = context.getResource(fileName); - InputStream is = new BufferedInputStream(url.openStream()); - pdfs.add(is); - } - } catch (Exception e) { - logger.log(Level.WARNING, e.getMessage(), e); + Object result = context.evaluate(exp); + // there are two options here. 1 is the user property "AppendList" is a + // comma-seperated + // string list. If so, check that it is a String, and split it. + if (result instanceof String) { + String list = (String) result; + // check that the report variable AppendList is set, and actually has value + if (list != null) { + if (list.length() > 0) { + // iterate over the list, and create a file inputstream for each file location. + for (String s : list.split(",")) { + // If there is an exception creating the input stream, don't stop execution. + // Just graceffully let the user know that there was an error with the variable. + try { + String fileName = s.trim().replace("\\", "\\\\"); + File f = new File(fileName); + if (f.exists()) { + FileInputStream fis = new FileInputStream(f); + pdfs.add(fis); + } else { + // get the file using context.getResource() for relative or universal paths + URL url = context.getResource(fileName); + InputStream is = new BufferedInputStream(url.openStream()); + pdfs.add(is); } + } catch (Exception e) { + logger.log(Level.WARNING, e.getMessage(), e); } } } } + } - // The other is a "Named Expression", which is basically a user property that is - // the result - // of an expression instead of a string literal. This should be set as an - // arraylist through - // BIRT script - if (result instanceof ArrayList) { - ArrayList pdfList = (ArrayList) result; - + // The other is a "Named Expression", which is basically a user property that is + // the result + // of an expression instead of a string literal. This should be set as an + // arraylist through + // BIRT script + if (result instanceof ArrayList) { + ArrayList pdfList = (ArrayList) result; for (String fileName : pdfList) { - // If there is an exception creating the input stream, don't stop execution. - // Just graceffully let the user know that there was an error with the variable. - try { - File f = new File(fileName); - - if (f.exists()) { - FileInputStream fis = new FileInputStream(f); + // If there is an exception creating the input stream, don't stop execution. + // Just graceffully let the user know that there was an error with the variable. + fileName = fileName.replace("\\", "\\\\"); + try { + File f = new File(fileName); - pdfs.add(fis); - } else { - // get the file using context.getResource() for relative or universal paths - URL url = context.getResource(fileName); - InputStream is = new BufferedInputStream(url.openStream()); - pdfs.add(is); - } - } catch (Exception e) { - logger.log(Level.WARNING, e.getMessage(), e); + if (f.exists()) { + FileInputStream fis = new FileInputStream(f); + pdfs.add(fis); + } else { + // get the file using context.getResource() for relative or universal paths + URL url = context.getResource(fileName); + InputStream is = new BufferedInputStream(url.openStream()); + pdfs.add(is); } + } catch (Exception e) { + logger.log(Level.WARNING, e.getMessage(), e); } } + } - // check size of PDFs to make sure we aren't calling this on a 0 size array - if (pdfs.size() > 0) { - // this hasn't been initialized yet, open the doc - if (!this.doc.isOpen()) { - this.doc.open(); - } - concatPDFs(pdfs, false); + // check size of PDFs to make sure we aren't calling this on a 0 size array + if (pdfs.size() > 0) { + // this hasn't been initialized yet, open the doc + if (!this.doc.isOpen()) { + this.doc.open(); } + concatPDFs(pdfs, false); } } // End Modification @@ -417,87 +415,85 @@ public void close() throws Exception { List pdfs = new ArrayList<>(); Map userProperties = report.getDesign().getUserProperties(); + Object listObject; // added null check - if (userProperties != null) { - Object listObject = userProperties.get(PDFPageDevice.APPEND_PROPERTY_NAME); - if (userProperties.containsKey(PDFPageDevice.PDF_APPEND_DOCUMENTS)) { - listObject = userProperties.get(PDFPageDevice.PDF_APPEND_DOCUMENTS); - } - - if (listObject != null) { - Expression exp = (Expression) listObject; - - Object result = context.evaluate(exp); - // 2 options to append pdf - // option 1: is the user property "AppendList" is a comma-seperated string list - // If so, check that it is a String, and split it. - if (result instanceof String) { - String list = (String) result; - - // check that the report variable AppendList is set, and actually has value - if (list != null) { - if (list.length() > 0) { - // iterate over the list, and create a fileinputstream for each file location. - for (String s : list.split(",")) { - // If there is an exception creating the input stream, don't stop execution. - // Just graceffully let the user know that there was an error with the variable. - try { - String fileName = s.trim(); + if (userProperties != null && userProperties.containsKey(PDFPageDevice.APPEND_PROPERTY_NAME)) { + listObject = userProperties.get(PDFPageDevice.APPEND_PROPERTY_NAME); + } else if (userProperties != null && userProperties.containsKey(PDFPageDevice.PDF_APPEND_DOCUMENTS)) { + listObject = userProperties.get(PDFPageDevice.PDF_APPEND_DOCUMENTS); + } else { + listObject = Expression.newConstant(-1, + (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDF_APPEND_DOCUMENTS)); + } + if (listObject != null) { + Expression exp = (Expression) listObject; + + Object result = context.evaluate(exp); + // 2 options to append pdf + // option 1: is the user property "AppendList" is a comma-seperated string list + // If so, check that it is a String, and split it. + if (result instanceof String) { + String list = (String) result; + // check that the report variable AppendList is set, and actually has value + if (list != null) { + if (list.length() > 0) { + // iterate over the list, and create a fileinputstream for each file location. + for (String s : list.split(",")) { + // If there is an exception creating the input stream, don't stop execution. + // Just graceffully let the user know that there was an error with the variable. + try { + String fileName = s.trim().replace("\\", "\\\\"); + ; File f = new File(fileName); - if (f.exists()) { FileInputStream fis = new FileInputStream(f); - pdfs.add(fis); } else { // get the file using context.getResource() for relative or universal paths URL url = context.getResource(fileName); InputStream is = new BufferedInputStream(url.openStream()); pdfs.add(is); - } + } } catch (Exception e) { logger.log(Level.WARNING, e.getMessage(), e); - } } } } } + } - // option 2: "Named Expression", which is basically a user property that is the - // result of an expression instead of a string literal. This should be set as an - // arraylist through - // BIRT script - if (result instanceof ArrayList) { - ArrayList pdfList = (ArrayList) result; - - for (String fileName : pdfList) { - // If there is an exception creating the input stream, don't stop execution. - // Just graceffully let the user know that there was an error with the variable. - try { - File f = new File(fileName); - - if (f.exists()) { - FileInputStream fis = new FileInputStream(f); - - pdfs.add(fis); - } else { - // get the file using context.getResource() for relative or universal paths - URL url = context.getResource(fileName); - InputStream is = new BufferedInputStream(url.openStream()); - pdfs.add(is); - } - } catch (Exception e) { - logger.log(Level.WARNING, e.getMessage(), e); + // option 2: "Named Expression", which is basically a user property that is the + // result of an expression instead of a string literal. This should be set as an + // arraylist through + // BIRT script + if (result instanceof ArrayList) { + ArrayList pdfList = (ArrayList) result; + + for (String fileName : pdfList) { + // If there is an exception creating the input stream, don't stop execution. + // Just graceffully let the user know that there was an error with the variable. + fileName = fileName.replace("\\", "\\\\"); + try { + File f = new File(fileName); + if (f.exists()) { + FileInputStream fis = new FileInputStream(f); + pdfs.add(fis); + } else { + // get the file using context.getResource() for relative or universal paths + URL url = context.getResource(fileName); + InputStream is = new BufferedInputStream(url.openStream()); + pdfs.add(is); } + } catch (Exception e) { + logger.log(Level.WARNING, e.getMessage(), e); } } - - // check size of PDFs to make sure we aren't calling this on a 0 size array - if (pdfs.size() > 0) { - concatPDFs(pdfs, false); - } + } + // check size of PDFs to make sure we aren't calling this on a 0 size array + if (pdfs.size() > 0) { + concatPDFs(pdfs, false); } } @@ -599,7 +595,7 @@ public void concatPDFs(List streamOfPDFFiles, boolean paginate) { // Create a writer for the outputstream PdfWriter writer = this.writer; - BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); + BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED); // TGXX PdfContentByte cb = writer.getDirectContent(); // Holds the PDF PdfImportedPage page; @@ -647,11 +643,14 @@ public void concatPDFs(List streamOfPDFFiles, boolean paginate) { * Set the PDF version based on the user property */ private void setPdfVersion() { + String userPdfVersion; // PDF version based on user property if (this.userProperties != null && this.userProperties.containsKey(PDFPageDevice.PDF_VERSION)) { - String userPdfVersion = this.userProperties.get(PDFPageDevice.PDF_VERSION).toString(); - this.setPdfVersion(userPdfVersion); + userPdfVersion = this.userProperties.get(PDFPageDevice.PDF_VERSION).toString(); + } else { + userPdfVersion = (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDF_VERSION); } + this.setPdfVersion(userPdfVersion); } /** @@ -709,38 +708,42 @@ public String getPdfVersion() { * Set the PDF conformance user property based */ private void setPdfConformance() { + String userPdfConformance; + // PDFA & PDFX conformance, based on user property if (this.userProperties != null && this.userProperties.containsKey(PDFPageDevice.PDF_CONFORMANCE)) { - String userPdfConformance = this.userProperties.get(PDFPageDevice.PDF_CONFORMANCE).toString().toUpperCase(); - switch (userPdfConformance) { - case PDFPageDevice.PDF_CONFORMANCE_X32002: - this.pdfConformance = PdfWriter.PDFX32002; - this.isPdfAFormat = false; - break; - case PDFPageDevice.PDF_CONFORMANCE_A1A: - this.pdfConformance = PdfWriter.PDFA1A; - this.isPdfAFormat = true; - break; - case PDFPageDevice.PDF_CONFORMANCE_A1B: - this.pdfConformance = PdfWriter.PDFA1B; - this.isPdfAFormat = true; - break; - default: - this.pdfConformance = PdfWriter.PDFXNONE; - this.isPdfAFormat = false; - break; - } - this.setPdfConformance(this.pdfConformance); + userPdfConformance = this.userProperties.get(PDFPageDevice.PDF_CONFORMANCE).toString().toUpperCase(); + } else { + userPdfConformance = (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDF_CONFORMANCE); + } + switch (userPdfConformance) { + case PDFPageDevice.PDF_CONFORMANCE_X32002: + this.pdfConformance = PdfWriter.PDFX32002; + this.isPdfAFormat = false; + break; + case PDFPageDevice.PDF_CONFORMANCE_A1A: + this.pdfConformance = PdfWriter.PDFA1A; + this.isPdfAFormat = true; + break; + case PDFPageDevice.PDF_CONFORMANCE_A1B: + this.pdfConformance = PdfWriter.PDFA1B; + this.isPdfAFormat = true; + break; + default: + this.pdfConformance = PdfWriter.PDFXNONE; + this.isPdfAFormat = false; + break; } + this.setPdfConformance(this.pdfConformance); // PDFA: overwrite to get the document title independent of the openPDF // issue of PDF/A-conformance if (this.userProperties != null && this.userProperties.containsKey(PDFPageDevice.PDFA_ADD_DOCUMENT_TITLE)) { - String pdfaUseTitleOverwrite = this.userProperties.get(PDFPageDevice.PDFA_ADD_DOCUMENT_TITLE).toString() - .toLowerCase(); - if (pdfaUseTitleOverwrite.equals("true")) { - this.addPdfADocumentTitle = true; - } + this.addPdfADocumentTitle = Boolean.parseBoolean(this.userProperties.get(PDFPageDevice.PDFA_ADD_DOCUMENT_TITLE).toString()); + } else { + this.addPdfADocumentTitle = Boolean + .parseBoolean( + (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDFA_ADD_DOCUMENT_TITLE)); } } @@ -802,6 +805,11 @@ private void setPdfIccXmp() { if (this.userProperties != null && userProperties.containsKey(PDFPageDevice.PDF_ICC_PROFILE_EXTERNAL_FILE)) { fullFileNameIcc = userProperties.get(PDFPageDevice.PDF_ICC_PROFILE_EXTERNAL_FILE).toString().trim(); + } else { + fullFileNameIcc = ((String) getReportDesignConfiguration(this.report, + PDFPageDevice.PDF_ICC_PROFILE_EXTERNAL_FILE)).trim(); + } + if (fullFileNameIcc != null && fullFileNameIcc.length() > 0) { try { iccFile = new File(fullFileNameIcc); if (!iccFile.exists()) { @@ -820,9 +828,11 @@ private void setPdfIccXmp() { String iccColorType = PDFPageDevice.PDF_ICC_COLOR_RGB; if (this.userProperties != null && userProperties.containsKey(PDFPageDevice.PDF_ICC_COLOR_TYPE)) { iccColorType = userProperties.get(PDFPageDevice.PDF_ICC_COLOR_TYPE).toString().toUpperCase().trim(); - if (iccColorType.equals(PDFPageDevice.PDF_ICC_COLOR_CMYK)) { - colorSpace = ColorSpace.TYPE_CMYK; - } + } else { + iccColorType = (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDF_ICC_COLOR_TYPE); + } + if (iccColorType.equals(PDFPageDevice.PDF_ICC_COLOR_CMYK)) { + colorSpace = ColorSpace.TYPE_CMYK; } if (iccProfileExternal) { iccProfile = ICC_Profile.getInstance(iccFile.getAbsolutePath()); @@ -851,8 +861,9 @@ private void setPdfIccXmp() { */ private void setDefaultFontPdfA() { if (this.userProperties != null && this.userProperties.containsKey(PDFPageDevice.PDFA_FALLBACK_FONT)) { - String defaultFont = this.userProperties.get(PDFPageDevice.PDFA_FALLBACK_FONT).toString(); - this.defaultFontPdfA = defaultFont; + this.defaultFontPdfA = this.userProperties.get(PDFPageDevice.PDFA_FALLBACK_FONT).toString(); + } else { + this.defaultFontPdfA = (String) getReportDesignConfiguration(this.report, PDFPageDevice.PDFA_FALLBACK_FONT); } } @@ -862,7 +873,7 @@ private void setDefaultFontPdfA() { * @param defaultFont default font of PDF/A */ public void setDefaultFontPdfA(String defaultFont) { - this.defaultFontPdfA = defaultFont; + this.defaultFontPdfA = defaultFont.replace("\\", "\\\\"); } /** @@ -883,6 +894,10 @@ private void setIncludeCidSet() { if (this.userProperties != null && this.userProperties.containsKey(PDFPageDevice.PDF_FONT_CID_SET)) this.includeFontCidSet = Boolean .parseBoolean(this.userProperties.get(PDFPageDevice.PDF_FONT_CID_SET).toString()); + else + this.includeFontCidSet = Boolean + .parseBoolean((String) getReportDesignConfiguration(this.report, PDFPageDevice.PDF_FONT_CID_SET)); + } /** @@ -902,4 +917,40 @@ public void setIncludeCidSet(boolean includeFontCidSet) { public boolean isIncludeCidSet() { return this.includeFontCidSet; } + + /* + * Read the configuration from the report design if no user property is set + */ + private Object getReportDesignConfiguration(IReportContent reportContent, String name) { + Object value = null; + + if (name.equalsIgnoreCase(PDFPageDevice.PDF_VERSION)) { + value = reportContent.getDesign().getReportDesign().getPdfVersion(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDF_CONFORMANCE)) { + value = reportContent.getDesign().getReportDesign().getPdfConformance(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDF_ICC_COLOR_TYPE)) { + value = reportContent.getDesign().getReportDesign().getPdfIccColorType(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDF_ICC_PROFILE_EXTERNAL_FILE)) { + value = reportContent.getDesign().getReportDesign().getPdfIccColorProfileExternal(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDF_PREPEND_DOCUMENTS)) { + value = reportContent.getDesign().getReportDesign().getPdfDocumentsPrepend(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDF_APPEND_DOCUMENTS)) { + value = reportContent.getDesign().getReportDesign().getPdfDocumentsAppend(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDFA_FALLBACK_FONT)) { + value = reportContent.getDesign().getReportDesign().getPdfAFontFallback(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDF_FONT_CID_SET)) { + value = reportContent.getDesign().getReportDesign().getPdfFontCidEmbed(); + + } else if (name.equalsIgnoreCase(PDFPageDevice.PDFA_ADD_DOCUMENT_TITLE)) { + value = reportContent.getDesign().getReportDesign().getPdfAEmbedTitle(); + } + return value; + } } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java index f543d57872..f9d99929b3 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/ReportDesignHandleImpl.java @@ -1680,4 +1680,176 @@ public String getExcelTemplateFile() { public void setExcelTemplateFile(String templateFile) throws SemanticException { setStringProperty(EXCEL_TEMPLATE_FILE, templateFile); } + + /** + * Get the configuration for the used PDF version + * + * @return the configuration for the used PDF version + */ + public String getPdfVersion() { + return getStringProperty(PDF_VERSION); + } + + /** + * Set the configuration for the template file + * + * @param pdfVersion PDF version number + * @throws SemanticException + */ + public void setPdfVersion(String pdfVersion) throws SemanticException { + setStringProperty(PDF_VERSION, pdfVersion); + } + + /** + * Get the configuration for the used template file + * + * @return the configuration for used PDF conformance + */ + public String getPdfConformance() { + return getStringProperty(PDF_CONFORMANCE); + } + + /** + * Set the configuration for used PDF conformance + * + * @param pdfConformance PDF conformance + * @throws SemanticException + */ + public void setPdfConformance(String pdfConformance) throws SemanticException { + setStringProperty(PDF_CONFORMANCE, pdfConformance); + } + + /** + * Get the configuration for the used PDF color type + * + * @return the configuration for the used PDF color type + */ + public String getPdfIccColorType() { + return getStringProperty(PDF_ICC_COLOR_TYPE); + } + + /** + * Set the configuration for the ICC color type + * + * @param iccColorType ICC color type + * @throws SemanticException + */ + public void setPdfIccColorType(String iccColorType) throws SemanticException { + setStringProperty(PDF_ICC_COLOR_TYPE, iccColorType); + } + + /** + * Get the configuration for the used external color profile + * + * @return the configuration for the used external color profile + */ + public String getPdfIccColorProfileExternal() { + return getStringProperty(PDF_ICC_PROFILE_EXTERNAL); + } + + /** + * Set the configuration for the external color profile + * + * @param iccProfileExternal external color profile + * @throws SemanticException + */ + public void setPdfIccColorProfileExternal(String iccProfileExternal) throws SemanticException { + setStringProperty(PDF_ICC_PROFILE_EXTERNAL, iccProfileExternal); + } + + /** + * Get the configuration to prepend document(s) to the PDF document + * + * @return the configuration to prepend document(s) to the PDF document + */ + public String getPdfDocumentsPrepend() { + return getStringProperty(PDF_DOCUMENTS_PREPEND); + } + + /** + * Set the configuration to prepend document(s) to the PDF document + * + * @param prependDocuments document(s) to prepend + * @throws SemanticException + */ + public void setPdfDocumentsPrepend(String prependDocuments) throws SemanticException { + setStringProperty(PDF_DOCUMENTS_PREPEND, prependDocuments); + } + + /** + * Get the configuration to append document(s) to the PDF document + * + * @return the configuration to append document(s) to the PDF document + */ + public String getPdfDocumentsAppend() { + return getStringProperty(PDF_DOCUMENTS_APPEND); + } + + /** + * Set the configuration to append document(s) to the PDF document + * + * @param appendDocuments document(s) to append + * @throws SemanticException + */ + public void setPdfDocumentsAppend(String appendDocuments) throws SemanticException { + setStringProperty(PDF_DOCUMENTS_APPEND, appendDocuments); + } + + /** + * Get the configuration for the fallback font of PDF/A + * + * @return the configuration for the fallback font of PDF/A + */ + public String getPdfAFontFallback() { + return getStringProperty(PDFA_FONT_FALLBACK); + } + + /** + * Set the configuration for the fallback font of PDF/A + * + * @param pdfaFontFallback PDF/A fallback font + * @throws SemanticException + */ + public void setPdfAFontFallback(String pdfaFontFallback) throws SemanticException { + setStringProperty(PDFA_FONT_FALLBACK, pdfaFontFallback); + } + + /** + * Get the configuration for the used CIDSet embed option + * + * @return the configuration for the used CIDSet embed option + */ + public String getPdfFontCidEmbed() { + return getStringProperty(PDF_FONT_CID_SET); + } + + /** + * Set the configuration for the CIDSet embed option + * + * @param embedCID font embed CIDSet + * @throws SemanticException + */ + public void setPdfFontCidEmbed(String embedCID) throws SemanticException { + setStringProperty(PDF_FONT_CID_SET, embedCID); + } + + /** + * Get the configuration to the embed the title + * + * @return the configuration to the embed the title + */ + public String getPdfAEmbedTitle() { + return getStringProperty(PDFA_DOCUMENT_EMBED_TITLE); + } + + /** + * Set the configuration to the embed the title + * + * @param embedTitle embed title + * @throws SemanticException + */ + public void setPdfAEmbedTitle(String embedTitle) throws SemanticException { + setStringProperty(PDFA_DOCUMENT_EMBED_TITLE, embedTitle); + } + } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java index ad78cba2c8..dbc415e40d 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/interfaces/IInternalReportDesignModel.java @@ -288,4 +288,49 @@ public interface IInternalReportDesignModel { */ String EXCEL_TEMPLATE_FILE = "excelTemplateFile"; //$NON-NLS-1$ + /** + * PDF option, version number + */ + String PDF_VERSION = "pdfVersion"; //$NON-NLS-1$ + + /** + * PDF option, conformance + */ + String PDF_CONFORMANCE = "pdfConformance"; //$NON-NLS-1$ + + /** + * PDF option, ICC color type profile (RGB/CMYK) + */ + String PDF_ICC_COLOR_TYPE = "pdfIccColorType"; //$NON-NLS-1$ + + /** + * PDF option, ICC external color profile file + */ + String PDF_ICC_PROFILE_EXTERNAL = "pdfIccProfileExternal"; //$NON-NLS-1$ + + /** + * PDF option, prepend document(s) + */ + String PDF_DOCUMENTS_PREPEND = "pdfDocuemntPrepend"; //$NON-NLS-1$ + + /** + * PDF option, append document(s) + */ + String PDF_DOCUMENTS_APPEND = "pdfDocuemntAppend"; //$NON-NLS-1$ + + /** + * PDF option, PDF/A fallback font + */ + String PDFA_FONT_FALLBACK = "pdfaFontFallback"; //$NON-NLS-1$ + + /** + * PDF option, PDF/A embed CIDSet font stream + */ + String PDF_FONT_CID_SET = "pdfaFontCidEmbed"; //$NON-NLS-1$ + + /** + * PDF option, PDF/A embed document title + */ + String PDFA_DOCUMENT_EMBED_TITLE = "pdfaDocumentTitleEmbed"; //$NON-NLS-1$ + } diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def index 373323a86d..5e0f2fc5b3 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/elements/rom.def @@ -685,7 +685,23 @@ - + + + + + + + + + + + + + + + + + @@ -1887,6 +1903,31 @@ + + + 1.5 + + + PDF.Standard + + + RGB + + + + + + + + + + + true + + + false + + diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties index 5e991d6ef2..bd5b528a38 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/i18n/Messages.properties @@ -758,6 +758,24 @@ Choices.referenceDateType.today=Today Choices.referenceDateType.fixedDate=Fixed Date Choices.referenceDateType.endingDateInDimension=Ending Date in Dimension +#95 emitterPdfVersion +Choices.emitterPdfVersion.1.3=Version 1.3 +Choices.emitterPdfVersion.1.4=Version 1.4 +Choices.emitterPdfVersion.1.5=Version 1.5 +Choices.emitterPdfVersion.1.6=Version 1.6 +Choices.emitterPdfVersion.1.7=Version 1.7 + +#96 emitterPdfConformance +Choices.emitterPdfConformance.X32002=PDF, X32002 +Choices.emitterPdfConformance.A1A=PDF, A1A +Choices.emitterPdfConformance.A1B=PDF, A1B +Choices.emitterPdfConformance.Standard=Standard PDF + +#97 emitterPdfIccColorType +Choices.emitterPdfIccColorType.rgb=RGB +Choices.emitterPdfIccColorType.cmyk=CMYC + + ########################################################### # Classes @@ -2627,7 +2645,7 @@ Element.ReportDesign.clientInitialize.toolTip=Load the client side java script l Element.ReportDesign.clientInitialize.this=Report design Element.ReportDesign.language=Language Element.ReportDesign.PDFAccessible=Accessible PDF -Element.ReportDesign.Emitter.excel=Emitter excel configuration +Element.ReportDesign.Emitter.excel=Emitter Excel configuration Element.ReportDesign.Emitter.excel.forceAutoColWidths=Force auto column width calculation Element.ReportDesign.Emitter.excel.singleSheet=Single sheet Element.ReportDesign.Emitter.excel.disableGrouping=Disable grouping @@ -2642,6 +2660,17 @@ Element.ReportDesign.Emitter.excel.printPagesHigh=Page high to fit printer page Element.ReportDesign.Emitter.excel.printPagesWide=Page wide to fit printer page (1 to 32,767) Element.ReportDesign.Emitter.excel.printScale=Scale page for printing (10% to 400%) Element.ReportDesign.Emitter.excel.templateFile=File name to template file (full qualified path) +Element.ReportDesign.Emitter.pdf=Emitter PDF configuration +Element.ReportDesign.Emitter.pdf.version=PDF version +Element.ReportDesign.Emitter.pdf.conformance=PDF conformance +Element.ReportDesign.Emitter.pdf.icc.color.type=PDF, ICC color type +Element.ReportDesign.Emitter.pdf.icc.profile.external=PDF, external ICC color profile (full qualified file name) +Element.ReportDesign.Emitter.pdf.document.prepend=PDF, document(s) prepend +Element.ReportDesign.Emitter.pdf.document.append=PDF, document(s) append +Element.ReportDesign.Emitter.pdfa.font.fallback=PDF/A, fallback font (full qualified file name) +Element.ReportDesign.Emitter.pdfa.font.cid.embed=PDF/A, include the CIDSet font stream +Element.ReportDesign.Emitter.pdfa.document.title.embed=PDF/A, embed title + #2. Report Element ( Prefix = Element.ReportElement ) Element.ReportElement.displayName=Display name diff --git a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java index 1a1d0460d9..5c53ae35b3 100644 --- a/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java +++ b/model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/writer/DesignWriterImpl.java @@ -140,6 +140,15 @@ protected void writeSimpleProperties(ReportDesign obj) { property(obj, IInternalReportDesignModel.EXCEL_PRINT_PAGES_WIDE); property(obj, IInternalReportDesignModel.EXCEL_PRINT_SCALE); property(obj, IInternalReportDesignModel.EXCEL_TEMPLATE_FILE); + property(obj, IInternalReportDesignModel.PDF_VERSION); + property(obj, IInternalReportDesignModel.PDF_CONFORMANCE); + property(obj, IInternalReportDesignModel.PDF_ICC_COLOR_TYPE); + property(obj, IInternalReportDesignModel.PDF_ICC_PROFILE_EXTERNAL); + property(obj, IInternalReportDesignModel.PDF_DOCUMENTS_PREPEND); + property(obj, IInternalReportDesignModel.PDF_DOCUMENTS_APPEND); + property(obj, IInternalReportDesignModel.PDFA_FONT_FALLBACK); + property(obj, IInternalReportDesignModel.PDF_FONT_CID_SET); + property(obj, IInternalReportDesignModel.PDFA_DOCUMENT_EMBED_TITLE); // include libraries and scripts