From 4943e2fa10f39dfec27f22fe2ab4be59586d8e9d Mon Sep 17 00:00:00 2001 From: john Date: Mon, 13 Jan 2003 13:19:52 +0000 Subject: [PATCH] added some stuff to make sure xml is encoded properly... also added stuff to convert newlines to br's(without doing the rest of createHTML) so that these can be picked up and transformed to fo:block's --- .../producer/PDFPreFormattingProducerNode.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/source/mircoders/producer/PDFPreFormattingProducerNode.java b/source/mircoders/producer/PDFPreFormattingProducerNode.java index dca788a7..84e7e62c 100755 --- a/source/mircoders/producer/PDFPreFormattingProducerNode.java +++ b/source/mircoders/producer/PDFPreFormattingProducerNode.java @@ -39,6 +39,9 @@ import mir.producer.*; import mir.entity.*; import mir.entity.adapter.*; import mir.log.*; +import mir.misc.StringUtil; +import mir.util.HTMLRoutines; + import mircoders.entity.*; import mircoders.storage.*; @@ -77,12 +80,12 @@ public class PDFPreFormattingProducerNode implements ProducerNode { data = ParameterExpander.findValueForKey( aValueMap, contentKey ); if (! (data instanceof EntityAdapter)) { - throw new ProducerFailure("ContentMarkingProducerNode: value of '"+contentKey+"' is not an EntityAdapter, but an " + data.getClass().getName(), null); + throw new ProducerFailure("PDFPreFormattingProducerNode: value of '"+contentKey+"' is not an EntityAdapter, but an " + data.getClass().getName(), null); } entity = ((EntityAdapter) data).getEntity(); if (! (entity instanceof EntityContent)) { - throw new ProducerFailure("ContentMarkingProducerNode: value of '"+contentKey+"' is not a content EntityAdapter, but a " + entity.getClass().getName() + " adapter", null); + throw new ProducerFailure("PDFPreFormattingProducerNode: value of '"+contentKey+"' is not a content EntityAdapter, but a " + entity.getClass().getName() + " adapter", null); } int currentPosition = 0; @@ -101,6 +104,11 @@ public class PDFPreFormattingProducerNode implements ProducerNode { EntityList images=DatabaseContentToMedia.getInstance().getImages((EntityContent)entity); String theContent = ((EntityContent) entity).getValue("content_data"); + //remove pesky characters + theContent = HTMLRoutines.encodeXML(theContent); + //put in the
tags so we can turn them to empty blocks + theContent = StringUtil.convertNewline2Break(theContent); + if (images == null){ HashMap row = new HashMap(); row.put("text",theContent); @@ -131,9 +139,9 @@ public class PDFPreFormattingProducerNode implements ProducerNode { float img_height=(new Float(currentImage.getValue("img_height"))).floatValue(); //oversize images must be shrunk - if (img_width>400){ - img_height=(new Float((new Float(img_height*(400.0F/img_width))).intValue())).floatValue(); - img_width=400.0F; + if (img_width>250){ + img_height=(new Float((new Float(img_height*(250.0F/img_width))).intValue())).floatValue(); + img_width=250.0F; } -- 2.11.0