git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@744874 13f79535-47bb-0310-9956-ffa450edef68tags/fop-1_0
@@ -128,14 +128,8 @@ public class AFPDocumentHandler extends AbstractBinaryWritingIFDocumentHandler | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
if (getUserAgent() == null) { | |||
throw new IllegalStateException( | |||
"User agent must be set before starting PostScript generation"); | |||
} | |||
if (this.outputStream == null) { | |||
throw new IllegalStateException("OutputStream hasn't been set through setResult()"); | |||
} | |||
paintingState.setColor(Color.WHITE); | |||
this.dataStream = resourceManager.createDataStream(paintingState, outputStream); |
@@ -111,15 +111,8 @@ public class TIFFDocumentHandler extends AbstractBinaryWritingIFDocumentHandler | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
if (getUserAgent() == null) { | |||
throw new IllegalStateException( | |||
"User agent must be set before starting PDF generation"); | |||
} | |||
if (this.outputStream == null) { | |||
throw new IllegalStateException("OutputStream hasn't been set through setResult()"); | |||
} | |||
// Creates writer | |||
this.imageWriter = ImageWriterRegistry.getInstance().getWriterFor(getMimeType()); | |||
if (this.imageWriter == null) { |
@@ -106,6 +106,14 @@ public abstract class AbstractBinaryWritingIFDocumentHandler extends AbstractIFD | |||
setFontInfo(fi); | |||
} | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
if (this.outputStream == null) { | |||
throw new IllegalStateException("OutputStream hasn't been set through setResult()"); | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
public void endDocument() throws IFException { | |||
if (this.ownOutputStream) { |
@@ -63,6 +63,14 @@ public abstract class AbstractIFDocumentHandler implements IFDocumentHandler { | |||
return null; //By default, this is not supported | |||
} | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
if (getUserAgent() == null) { | |||
throw new IllegalStateException( | |||
"User agent must be set before starting document generation"); | |||
} | |||
} | |||
/** {@inheritDoc} */ | |||
public void startDocumentHeader() throws IFException { | |||
//nop |
@@ -143,6 +143,7 @@ public class IFSerializer extends AbstractXMLWritingIFDocumentHandler | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
handler.startDocument(); | |||
handler.startPrefixMapping("", NAMESPACE); |
@@ -125,15 +125,8 @@ public class PCLDocumentHandler extends AbstractBinaryWritingIFDocumentHandler | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
if (getUserAgent() == null) { | |||
throw new IllegalStateException( | |||
"User agent must be set before starting PDF generation"); | |||
} | |||
if (this.outputStream == null) { | |||
throw new IllegalStateException("OutputStream hasn't been set through setResult()"); | |||
} | |||
log.debug("Rendering areas to PCL..."); | |||
this.gen = new PCLGenerator(this.outputStream, getResolution()); | |||
if (!pclUtil.isPJLDisabled()) { |
@@ -120,14 +120,8 @@ public class PDFDocumentHandler extends AbstractBinaryWritingIFDocumentHandler { | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
if (getUserAgent() == null) { | |||
throw new IllegalStateException( | |||
"User agent must be set before starting PDF generation"); | |||
} | |||
if (this.outputStream == null) { | |||
throw new IllegalStateException("OutputStream hasn't been set through setResult()"); | |||
} | |||
this.pdfDoc = pdfUtil.setupPDFDocument(this.outputStream); | |||
} catch (IOException e) { | |||
throw new IFException("I/O error in startDocument()", e); |
@@ -138,14 +138,8 @@ public class PSDocumentHandler extends AbstractBinaryWritingIFDocumentHandler { | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
if (getUserAgent() == null) { | |||
throw new IllegalStateException( | |||
"User agent must be set before starting PostScript generation"); | |||
} | |||
if (this.outputStream == null) { | |||
throw new IllegalStateException("OutputStream hasn't been set through setResult()"); | |||
} | |||
OutputStream out; | |||
if (psUtil.isOptimizeResources()) { | |||
this.tempFile = File.createTempFile("fop", null); |
@@ -98,6 +98,7 @@ public class SVGDocumentHandler extends AbstractSVGDocumentHandler { | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); | |||
builderFactory.setNamespaceAware(true); | |||
builderFactory.setValidating(false); |
@@ -65,6 +65,7 @@ public class SVGPrintDocumentHandler extends AbstractSVGDocumentHandler { | |||
/** {@inheritDoc} */ | |||
public void startDocument() throws IFException { | |||
super.startDocument(); | |||
try { | |||
handler.startDocument(); | |||
handler.startPrefixMapping("", NAMESPACE); |