Skip to content

Commit

Permalink
Merge branch 'master' into release-7.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
teodord committed Nov 13, 2023
2 parents 3fe2196 + 5daf1a6 commit 124dad9
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 39 deletions.
4 changes: 2 additions & 2 deletions jasperreports/docs/config.reference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7589,9 +7589,9 @@ Flag that determines whether glyph substitution based on Apache FOP is enabled.
The flag is set to <code>false</code> by default, disabling glyph substitution.
<p>
When Apache FOP is present on the classpath, glyph substitution can only be disabled
by using a patched version of OpenPDF (1.3.30.jaspersoft.x from
when using OpenPDF 1.3.32 and newer, or a version patched by Jaspersoft (1.3.30.jaspersoft.x from
<a href="https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/github/librepdf/openpdf/">https://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/com/github/librepdf/openpdf/</a>).
The property needs to be explicitly set to <code>true</code> when using a standard/unpatched version of OpenPDF together with Apache FOP.
The property needs to be explicitly set to <code>true</code> when using an unpatched version of OpenPDF older than 1.3.32 together with Apache FOP.
</p>
<p>
Also see the <a href="#net.sf.jasperreports.export.pdf.classic.document.language">net.sf.jasperreports.export.pdf.classic.document.language</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ else if (this.conformance == PdfaConformanceEnum.PDFA_3U)
}

xmp.setProperty(XMPConst.NS_XMP, XMP_CREATE_DATE, ((PdfDate) info.get(PdfName.CREATIONDATE)).getW3CDate());
xmp.setProperty(XMPConst.NS_XMP, XMP_MODIFY_DATE, ((PdfDate) info.get(PdfName.MODDATE)).getW3CDate());
PdfDate modifiedDate = (PdfDate) info.get(PdfName.MODDATE);
if (modifiedDate != null)
{
xmp.setProperty(XMPConst.NS_XMP, XMP_MODIFY_DATE, modifiedDate.getW3CDate());
}

String title = extractInfo(PdfName.TITLE);
if (title != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@
import java.awt.geom.Rectangle2D;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.AttributedCharacterIterator.Attribute;
import java.util.HashMap;
import java.util.Locale;
Expand Down Expand Up @@ -61,7 +59,6 @@
import net.sf.jasperreports.engine.JRPrintImage;
import net.sf.jasperreports.engine.JRPrintText;
import net.sf.jasperreports.engine.JRPropertiesUtil;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.PrintPageFormat;
import net.sf.jasperreports.engine.type.ModeEnum;
import net.sf.jasperreports.engine.util.JRStyledText;
Expand Down Expand Up @@ -125,21 +122,6 @@ public class ClassicPdfProducer implements PdfProducer
)
public static final String PROPERTY_DOCUMENT_LANGUAGE = JRPropertiesUtil.PROPERTY_PREFIX + "export.pdf.classic.document.language";

private final static Method SET_GLYPH_SUBSTITUTION_ENABLED_METHOD;
static
{
Method setGlyphSubstitutionEnabledMethod = null;
try
{
setGlyphSubstitutionEnabledMethod = Document.class.getMethod("setGlyphSubstitutionEnabled", Boolean.TYPE);
}
catch (NoSuchMethodException | SecurityException e)
{
log.debug("Failed to detect com.lowagie.text.Document.setGlyphSubstitutionEnabled method: " + e);
}
SET_GLYPH_SUBSTITUTION_ENABLED_METHOD = setGlyphSubstitutionEnabledMethod;
}

private PdfProducerContext context;

private ClassicPdfStructure pdfStructure;
Expand Down Expand Up @@ -206,19 +188,7 @@ protected void setDocumentProperties(Document pdfDocument)
PROPERTY_FOP_GLYPH_SUBSTITUTION_ENABLED, false);
if (!glyphSubstitutionEnabled && FopGlyphProcessor.isFopSupported())
{
if (SET_GLYPH_SUBSTITUTION_ENABLED_METHOD == null)
{
throw new PatchedPdfLibraryUnavailableException();
}

try
{
SET_GLYPH_SUBSTITUTION_ENABLED_METHOD.invoke(pdfDocument, false);
}
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
{
throw new JRRuntimeException("Failed to invoke com.lowagie.text.Document.setGlyphSubstitutionEnabled", e);
}
pdfDocument.setGlyphSubstitutionEnabled(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void add()
{
try
{
PdfFormField ck = radioCheckField.getCheckField();
PdfFormField ck = radioCheckField.getFullField();
pdfProducer.getPdfWriter().addAnnotation(ck);
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,15 @@
import net.sf.jasperreports.engine.JRConstants;
import net.sf.jasperreports.engine.JRRuntimeException;

//TODO delete?

/**
* <b>No longer used, OpenPDF 1.3.32 supports disabling glyph substitution.</b>
*
* <p>
* Exception raised when Apache FOP based glyph substitution is disabled, but
* the patched version OpenPDF library has not been detected.
* </p>
*
* <p>
* The OpenPDF library (used by the JasperReports PDF exporter) performs glyph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import net.sf.jasperreports.components.items.Item;
import net.sf.jasperreports.components.items.ItemData;
import net.sf.jasperreports.components.items.ItemProperty;
import net.sf.jasperreports.components.items.ItemXmlFactory;
import net.sf.jasperreports.components.list.ListComponent;
import net.sf.jasperreports.components.list.ListContents;
import net.sf.jasperreports.components.map.MapComponent;
Expand Down Expand Up @@ -285,7 +286,7 @@ private void writeMarkerItemDataContent(String name, MarkerItemData markerItemDa

private void writeItem(Item item, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
writer.startElement(MapXmlFactory.ELEMENT_item, namespace);
writer.startElement(ItemXmlFactory.ELEMENT_item, namespace);
List<ItemProperty> itemProperties = item.getProperties();
for(ItemProperty property : itemProperties)
{
Expand All @@ -296,7 +297,7 @@ private void writeItem(Item item, JRXmlWriteHelper writer, JRXmlWriter reportWri

private void writeItemProperty(ItemProperty itemProperty, JRXmlWriteHelper writer, JRXmlWriter reportWriter, XmlNamespace namespace, JRComponentElement componentElement) throws IOException
{
writer.startElement(MapXmlFactory.ELEMENT_itemProperty, namespace);
writer.startElement(ItemXmlFactory.ELEMENT_itemProperty, namespace);
writer.addEncodedAttribute(JRXmlConstants.ATTRIBUTE_name, itemProperty.getName());
if(itemProperty.getValue() != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
*/
public class ItemXmlFactory extends JRBaseFactory
{
public static final String ELEMENT_item = "item";
public static final String ELEMENT_itemProperty = "itemProperty";

@Override
public Object createObject(Attributes atts)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import org.xml.sax.Attributes;

import net.sf.jasperreports.components.items.ItemXmlFactory;
import net.sf.jasperreports.components.map.type.MapImageTypeEnum;
import net.sf.jasperreports.components.map.type.MapScaleEnum;
import net.sf.jasperreports.components.map.type.MapTypeEnum;
Expand All @@ -48,15 +49,21 @@ public class MapXmlFactory extends JRBaseFactory
public static final String ATTRIBUTE_onErrorType = "onErrorType";
public static final String ATTRIBUTE_markerClustering = "markerClustering";
public static final String ATTRIBUTE_markerSpidering = "markerSpidering";
public static final String ELEMENT_item = "item";
/**
* @deprecated Replaced by {@link ItemXmlFactory#ELEMENT_item}.
*/
public static final String ELEMENT_item = ItemXmlFactory.ELEMENT_item;
public static final String ELEMENT_markerData = "markerData";
public static final String ELEMENT_legendItem = "legendItem";
public static final String ELEMENT_resetMapItem = "resetMapItem";
public static final String ELEMENT_seriesNameExpression = "seriesNameExpression";
public static final String ELEMENT_markerClusteringExpression = "markerClusteringExpression";
public static final String ELEMENT_markerSpideringExpression = "markerSpideringExpression";
public static final String ELEMENT_legendIconExpression = "legendIconExpression";
public static final String ELEMENT_itemProperty = "itemProperty";
/**
* @deprecated Replaced by {@link ItemXmlFactory#ELEMENT_itemProperty}.
*/
public static final String ELEMENT_itemProperty = ItemXmlFactory.ELEMENT_itemProperty;
public static final String ELEMENT_pathStyle = "pathStyle";
public static final String ELEMENT_pathData = "pathData";

Expand Down

0 comments on commit 124dad9

Please sign in to comment.