aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/render')
-rw-r--r--src/java/org/apache/fop/render/AbstractRenderer.java22
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRenderer.java8
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java48
3 files changed, 60 insertions, 18 deletions
diff --git a/src/java/org/apache/fop/render/AbstractRenderer.java b/src/java/org/apache/fop/render/AbstractRenderer.java
index 5c3e73ee0..ebff5323b 100644
--- a/src/java/org/apache/fop/render/AbstractRenderer.java
+++ b/src/java/org/apache/fop/render/AbstractRenderer.java
@@ -54,7 +54,6 @@ import org.apache.fop.area.RegionReference;
import org.apache.fop.area.RegionViewport;
import org.apache.fop.area.Span;
import org.apache.fop.area.Trait;
-import org.apache.fop.area.inline.Character;
import org.apache.fop.area.inline.Container;
import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Image;
@@ -405,7 +404,7 @@ public abstract class AbstractRenderer
for (int count = 0; count < spans.size(); count++) {
span = (Span) spans.get(count);
for (int c = 0; c < span.getColumnCount(); c++) {
- NormalFlow flow = (NormalFlow) span.getNormalFlow(c);
+ NormalFlow flow = span.getNormalFlow(c);
if (flow != null) {
currentBPPosition = saveSpanBPPos;
@@ -638,15 +637,6 @@ public abstract class AbstractRenderer
}
}
- /**
- * Render the given Character.
- * @param ch the character to render
- * @deprecated Only TextArea should be used. This method will be removed eventually.
- */
- protected void renderCharacter(Character ch) {
- currentIPPosition += ch.getAllocIPD();
- }
-
/**
* Common method to render the background and borders for any inline area.
* The all borders and padding are drawn outside the specified area.
@@ -754,6 +744,8 @@ public abstract class AbstractRenderer
renderContainer((Container) content);
} else if (content instanceof ForeignObject) {
renderForeignObject((ForeignObject) content, contpos);
+ } else if (content instanceof InlineBlockParent) {
+ renderInlineBlockParent((InlineBlockParent) content);
}
currentIPPosition += viewport.getAllocIPD();
currentBPPosition = saveBP;
@@ -792,7 +784,7 @@ public abstract class AbstractRenderer
* @param pos The target position of the foreign object
* (todo) Make renderForeignObject() protected
*/
- public void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
+ protected void renderForeignObject(ForeignObject fo, Rectangle2D pos) {
// Default: do nothing.
// Some renderers (ex. Text) don't support foreign objects.
}
@@ -817,8 +809,9 @@ public abstract class AbstractRenderer
handler.handleXML(ctx, doc, namespace);
} catch (Exception e) {
// could not handle document
- ResourceEventProducer eventProducer = ResourceEventProducer.Provider.get(
- ctx.getUserAgent().getEventBroadcaster());
+ ResourceEventProducer eventProducer
+ = ResourceEventProducer.Provider.get(
+ ctx.getUserAgent().getEventBroadcaster());
eventProducer.foreignXMLProcessingError(this, doc, namespace, e);
}
} else {
@@ -871,5 +864,4 @@ public abstract class AbstractRenderer
matrix[5] = matrix[5] * 1000;
return new AffineTransform(matrix);
}
-
}
diff --git a/src/java/org/apache/fop/render/pdf/PDFRenderer.java b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
index 0723d62f0..ff0e64806 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRenderer.java
@@ -1842,5 +1842,13 @@ public class PDFRenderer extends AbstractPathOrientedRenderer {
public void setFilterMap(Map filterMap) {
this.filterMap = filterMap;
}
+
+ /**
+ * Sets the encryption parameters used by the PDF renderer.
+ * @param encryptionParams the encryption parameters
+ */
+ public void setEncryptionParams(PDFEncryptionParams encryptionParams) {
+ this.encryptionParams = encryptionParams;
+ }
}
diff --git a/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java b/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java
index 2fce8859a..51e13dde1 100644
--- a/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java
+++ b/src/java/org/apache/fop/render/pdf/PDFRendererConfigurator.java
@@ -28,6 +28,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.pdf.PDFAMode;
+import org.apache.fop.pdf.PDFEncryptionParams;
import org.apache.fop.pdf.PDFFilterList;
import org.apache.fop.pdf.PDFXMode;
import org.apache.fop.render.PrintRendererConfigurator;
@@ -78,13 +79,54 @@ public class PDFRendererConfigurator extends PrintRendererConfigurator {
if (s != null) {
pdfRenderer.setXMode(PDFXMode.valueOf(s));
}
+ Configuration encryptionParamsConfig = cfg.getChild(PDFRenderer.ENCRYPTION_PARAMS, false);
+ if (encryptionParamsConfig != null) {
+ PDFEncryptionParams encryptionParams = new PDFEncryptionParams();
+ Configuration ownerPasswordConfig = encryptionParamsConfig.getChild(
+ PDFRenderer.OWNER_PASSWORD, false);
+ if (ownerPasswordConfig != null) {
+ String ownerPassword = ownerPasswordConfig.getValue(null);
+ if (ownerPassword != null) {
+ encryptionParams.setOwnerPassword(ownerPassword);
+ }
+ }
+ Configuration userPasswordConfig = encryptionParamsConfig.getChild(
+ PDFRenderer.USER_PASSWORD, false);
+ if (userPasswordConfig != null) {
+ String userPassword = userPasswordConfig.getValue(null);
+ if (userPassword != null) {
+ encryptionParams.setUserPassword(userPassword);
+ }
+ }
+ Configuration noPrintConfig = encryptionParamsConfig.getChild(
+ PDFRenderer.NO_PRINT, false);
+ if (noPrintConfig != null) {
+ encryptionParams.setAllowPrint(false);
+ }
+ Configuration noCopyContentConfig = encryptionParamsConfig.getChild(
+ PDFRenderer.NO_COPY_CONTENT, false);
+ if (noCopyContentConfig != null) {
+ encryptionParams.setAllowCopyContent(false);
+ }
+ Configuration noEditContentConfig = encryptionParamsConfig.getChild(
+ PDFRenderer.NO_EDIT_CONTENT, false);
+ if (noEditContentConfig != null) {
+ encryptionParams.setAllowEditContent(false);
+ }
+ Configuration noAnnotationsConfig = encryptionParamsConfig.getChild(
+ PDFRenderer.NO_ANNOTATIONS, false);
+ if (noAnnotationsConfig != null) {
+ encryptionParams.setAllowEditAnnotations(false);
+ }
+ pdfRenderer.setEncryptionParams(encryptionParams);
+ }
s = cfg.getChild(PDFRenderer.KEY_OUTPUT_PROFILE, true).getValue(null);
if (s != null) {
pdfRenderer.setOutputProfileURI(s);
}
- Configuration child = cfg.getChild(PDFRenderer.KEY_DISABLE_SRGB_COLORSPACE, false);
- if (child != null) {
- pdfRenderer.disableSRGBColorSpace = child.getValueAsBoolean(false);
+ Configuration disableColorSpaceConfig = cfg.getChild(PDFRenderer.KEY_DISABLE_SRGB_COLORSPACE, false);
+ if (disableColorSpaceConfig != null) {
+ pdfRenderer.disableSRGBColorSpace = disableColorSpaceConfig.getValueAsBoolean(false);
}
}
}