git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1862557 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_4
@@ -21,14 +21,16 @@ package org.apache.fop.pdf; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.io.Serializable; | |||
import org.apache.commons.io.output.CountingOutputStream; | |||
/** | |||
* Class representing a PDF name object. | |||
*/ | |||
public class PDFName extends PDFObject { | |||
public class PDFName extends PDFObject implements Serializable { | |||
private static final long serialVersionUID = -968412396459739925L; | |||
private String name; | |||
/** |
@@ -22,6 +22,7 @@ package org.apache.fop.pdf; | |||
import java.io.IOException; | |||
import java.io.OutputStream; | |||
import java.io.Serializable; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
@@ -35,8 +36,9 @@ import org.apache.fop.util.LanguageTags; | |||
* Class representing a PDF Structure Element. | |||
*/ | |||
public class PDFStructElem extends StructureHierarchyMember | |||
implements StructureTreeElement, CompressedObject { | |||
implements StructureTreeElement, CompressedObject, Serializable { | |||
private static final long serialVersionUID = -3055241807589202532L; | |||
private StructureType structureType; | |||
protected PDFStructElem parentElement; | |||
@@ -246,7 +248,7 @@ public class PDFStructElem extends StructureHierarchyMember | |||
} | |||
public int output(OutputStream stream) throws IOException { | |||
if (getDocument().getProfile().getPDFUAMode().isEnabled()) { | |||
if (getDocument() != null && getDocument().getProfile().getPDFUAMode().isEnabled()) { | |||
if (entries.containsKey("Alt") && "".equals(get("Alt"))) { | |||
put("Alt", "No alternate text specified"); | |||
} else if (kids != null) { | |||
@@ -275,6 +277,8 @@ public class PDFStructElem extends StructureHierarchyMember | |||
*/ | |||
public static class Placeholder extends PDFStructElem { | |||
private static final long serialVersionUID = -2397980642558372068L; | |||
@Override | |||
public void outputInline(OutputStream out, StringBuilder textBuffer) throws IOException { | |||
if (kids != null) { |
@@ -19,6 +19,7 @@ | |||
package org.apache.fop.pdf; | |||
import java.io.Serializable; | |||
import java.util.HashMap; | |||
import java.util.Map; | |||
@@ -98,8 +99,9 @@ public final class StandardStructureTypes { | |||
public static final StructureType FORM = new StructureTypeImpl("Form"); | |||
} | |||
private static class StructureTypeImpl implements StructureType { | |||
private static class StructureTypeImpl implements StructureType, Serializable { | |||
private static final long serialVersionUID = 8577475043360334210L; | |||
private final PDFName name; | |||
protected StructureTypeImpl(String name) { |
@@ -29,6 +29,7 @@ import org.apache.fop.pdf.StructureType; | |||
public class PageSequenceStructElem extends PDFStructElem { | |||
private static final long serialVersionUID = -9146602678931267198L; | |||
private List<PDFStructElem> regionBefores = new ArrayList<PDFStructElem>(); | |||
private List<PDFStructElem> regionAfters = new ArrayList<PDFStructElem>(); |
@@ -25,6 +25,7 @@ import org.apache.fop.pdf.StructureType; | |||
class TableStructElem extends PDFStructElem { | |||
private static final long serialVersionUID = -3550873504343680465L; | |||
private PDFStructElem tableFooter; | |||
public TableStructElem(PDFObject parent, StructureType structureType) { |
@@ -58,6 +58,7 @@ public class ConserveMemoryTestCase { | |||
FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI()); | |||
FOUserAgent userAgent = fopFactory.newFOUserAgent(); | |||
userAgent.setConserveMemoryPolicy(true); | |||
userAgent.setAccessibility(true); | |||
Fop fop = fopFactory.newFop("application/pdf", userAgent, new ByteArrayOutputStream()); | |||
Transformer transformer = TransformerFactory.newInstance().newTransformer(); | |||
Source src = new StreamSource(new ByteArrayInputStream(fo.getBytes())); |