2.) Version.getVersion() moved to Fop.getVersion(). 3.) Validation added for fo:region-body. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197743 13f79535-47bb-0310-9956-ffa450edef68pull/30/head
} else if (args[i].equals("-at")) { | } else if (args[i].equals("-at")) { | ||||
i = i + parseAreaTreeOption(args, i); | i = i + parseAreaTreeOption(args, i); | ||||
} else if (args[i].equals("-v")) { | } else if (args[i].equals("-v")) { | ||||
System.out.println("FOP Version " + Version.getVersion()); | |||||
System.out.println("FOP Version " + Fop.getVersion()); | |||||
} else if (args[i].equals("-param")) { | } else if (args[i].equals("-param")) { | ||||
if (i + 2 < args.length) { | if (i + 2 < args.length) { | ||||
if (xsltParams == null) { | if (xsltParams == null) { |
if (renderer instanceof AWTRenderer) { | if (renderer instanceof AWTRenderer) { | ||||
rendererType = RENDER_AWT; | rendererType = RENDER_AWT; | ||||
} | } | ||||
renderer.setProducer(Version.getVersion()); | |||||
renderer.setUserAgent(getUserAgent()); | renderer.setUserAgent(getUserAgent()); | ||||
userAgent.setProducer("FOP Version" + Fop.getVersion()); | |||||
this.renderer = renderer; | this.renderer = renderer; | ||||
} | } | ||||
throws IllegalArgumentException { | throws IllegalArgumentException { | ||||
try { | try { | ||||
renderer = (Renderer)Class.forName(rendererClassName).newInstance(); | renderer = (Renderer)Class.forName(rendererClassName).newInstance(); | ||||
renderer.setProducer(Version.getVersion()); | |||||
renderer.setUserAgent(getUserAgent()); | renderer.setUserAgent(getUserAgent()); | ||||
userAgent.setProducer("FOP Version" + Fop.getVersion()); | |||||
} catch (ClassNotFoundException e) { | } catch (ClassNotFoundException e) { | ||||
throw new IllegalArgumentException("Could not find " | throw new IllegalArgumentException("Could not find " | ||||
+ rendererClassName); | + rendererClassName); |
package org.apache.fop.apps; | package org.apache.fop.apps; | ||||
// Java | // Java | ||||
import java.util.Date; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.Map; | import java.util.Map; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
private float px2mm = 0.35277777777777777778f; //72dpi (=25.4/dpi) | private float px2mm = 0.35277777777777777778f; //72dpi (=25.4/dpi) | ||||
private HashMap rendererOptions = new java.util.HashMap(); | private HashMap rendererOptions = new java.util.HashMap(); | ||||
/** Producer: Metadata element for the system/software that produces | |||||
* the document. (Some renderers can store this in the document.) | |||||
*/ | |||||
protected String producer = "FOP " + Fop.getVersion(); | |||||
/** Creator: Metadata element for the user that created the | |||||
* document. (Some renderers can store this in the document.) | |||||
*/ | |||||
protected String creator = null; | |||||
/** Creation Date: Override of the date the document was created. | |||||
* (Some renderers can store this in the document.) | |||||
*/ | |||||
protected Date creationDate = null; | |||||
/** | |||||
* Sets the producer of the document. | |||||
* @param producer source of document | |||||
*/ | |||||
public void setProducer(String producer) { | |||||
this.producer = producer; | |||||
} | |||||
/** | |||||
* Returns the producer of the document | |||||
* @return producer name | |||||
*/ | |||||
public String getProducer() { | |||||
return producer; | |||||
} | |||||
/** | |||||
* Sets the creator of the document. | |||||
* @param creator of document | |||||
*/ | |||||
public void setCreator(String creator) { | |||||
this.creator = creator; | |||||
} | |||||
/** | |||||
* Returns the creator of the document | |||||
* @return creator name | |||||
*/ | |||||
public String getCreator() { | |||||
return creator; | |||||
} | |||||
/** | |||||
* Sets the creation date of the document. | |||||
* @param creation date of document | |||||
*/ | |||||
public void setCreationDate(Date creationDate) { | |||||
this.creationDate = creationDate; | |||||
} | |||||
/** | |||||
* Returns the creation date of the document | |||||
* @return creation date of document | |||||
*/ | |||||
public Date getCreationDate() { | |||||
return creationDate; | |||||
} | |||||
/** | /** | ||||
* Returns the renderer options | * Returns the renderer options | ||||
* @return renderer options | * @return renderer options |
CommandLineOptions options = null; | CommandLineOptions options = null; | ||||
InputHandler inputHandler = null; | InputHandler inputHandler = null; | ||||
BufferedOutputStream bos = null; | BufferedOutputStream bos = null; | ||||
String version = Version.getVersion(); | |||||
try { | try { | ||||
Driver driver = new Driver(); | Driver driver = new Driver(); | ||||
System.exit(1); | System.exit(1); | ||||
} | } | ||||
} | } | ||||
/** | |||||
* Get the version of FOP | |||||
* @return the version string | |||||
*/ | |||||
public static String getVersion() { | |||||
return "1.0dev"; | |||||
} | |||||
} | } | ||||
/* | |||||
* Copyright 1999-2004 The Apache Software Foundation. | |||||
* | |||||
* Licensed under the Apache License, Version 2.0 (the "License"); | |||||
* you may not use this file except in compliance with the License. | |||||
* You may obtain a copy of the License at | |||||
* | |||||
* http://www.apache.org/licenses/LICENSE-2.0 | |||||
* | |||||
* Unless required by applicable law or agreed to in writing, software | |||||
* distributed under the License is distributed on an "AS IS" BASIS, | |||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||||
* See the License for the specific language governing permissions and | |||||
* limitations under the License. | |||||
*/ | |||||
/* $Id$ */ | |||||
package org.apache.fop.apps; | |||||
/** | |||||
* Class representing the version of FOP. | |||||
*/ | |||||
public class Version { | |||||
/** | |||||
* Get the version of FOP | |||||
* | |||||
* @return the version string | |||||
*/ | |||||
public static String getVersion() { | |||||
return "1.0dev"; | |||||
} | |||||
} |
package org.apache.fop.fo.pagination; | package org.apache.fop.fo.pagination; | ||||
// Java | |||||
import java.awt.Rectangle; | import java.awt.Rectangle; | ||||
// XML | |||||
import org.xml.sax.Attributes; | |||||
import org.xml.sax.Locator; | |||||
// FOP | |||||
import org.apache.fop.datatypes.ColorType; | import org.apache.fop.datatypes.ColorType; | ||||
import org.apache.fop.datatypes.FODimension; | import org.apache.fop.datatypes.FODimension; | ||||
import org.apache.fop.fo.FONode; | import org.apache.fop.fo.FONode; | ||||
super(parent, Region.BODY_CODE); | super(parent, Region.BODY_CODE); | ||||
} | } | ||||
/** | |||||
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) | |||||
* XSL/FOP Content Model: empty | |||||
*/ | |||||
protected void validateChildNode(Locator loc, String nsURI, String localName) { | |||||
invalidChildError(loc, nsURI, localName); | |||||
} | |||||
/** | /** | ||||
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) | * @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension) | ||||
*/ | */ |
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
//FOP | //FOP | ||||
import org.apache.fop.apps.Version; | |||||
import org.apache.fop.apps.Fop; | |||||
import org.apache.fop.fonts.type1.PFMFile; | import org.apache.fop.fonts.type1.PFMFile; | ||||
/** | /** | ||||
PFMReader app = new PFMReader(); | PFMReader app = new PFMReader(); | ||||
System.out.println("PFM Reader for Apache FOP " + Version.getVersion() + "\n"); | |||||
System.out.println("PFM Reader for Apache FOP " + Fop.getVersion() + "\n"); | |||||
if (options.get("-ef") != null) { | if (options.get("-ef") != null) { | ||||
embFile = (String)options.get("-ef"); | embFile = (String)options.get("-ef"); |
import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.LogFactory; | ||||
//FOP | //FOP | ||||
import org.apache.fop.apps.Version; | |||||
import org.apache.fop.apps.Fop; | |||||
import org.apache.fop.fonts.truetype.FontFileReader; | import org.apache.fop.fonts.truetype.FontFileReader; | ||||
import org.apache.fop.fonts.truetype.TTFCmapEntry; | import org.apache.fop.fonts.truetype.TTFCmapEntry; | ||||
import org.apache.fop.fonts.truetype.TTFFile; | import org.apache.fop.fonts.truetype.TTFFile; | ||||
TTFReader app = new TTFReader(); | TTFReader app = new TTFReader(); | ||||
System.out.println("TTF Reader for Apache FOP " + Version.getVersion() + "\n"); | |||||
System.out.println("TTF Reader for Apache FOP " + Fop.getVersion() + "\n"); | |||||
if (options.get("-enc") != null) { | if (options.get("-enc") != null) { | ||||
String enc = (String)options.get("-enc"); | String enc = (String)options.get("-enc"); |
*/ | */ | ||||
protected static Log logger = LogFactory.getLog("FOP"); | protected static Log logger = LogFactory.getLog("FOP"); | ||||
/** | |||||
* producer (usually "FOP") | |||||
*/ | |||||
protected String producer = "FOP"; | |||||
/** | |||||
* creator of document | |||||
*/ | |||||
protected String creator = null; | |||||
/** | |||||
* creation time | |||||
*/ | |||||
protected Date creationDate = null; | |||||
/** | /** | ||||
* block progression position | * block progression position | ||||
*/ | */ | ||||
return logger; | return logger; | ||||
} | } | ||||
/** @see org.apache.fop.render.Renderer */ | |||||
public void setProducer(String inProducer) { | |||||
producer = inProducer; | |||||
} | |||||
/** @see org.apache.fop.render.Renderer */ | |||||
public void setCreator(String inCreator) { | |||||
creator = inCreator; | |||||
} | |||||
/** | /** | ||||
* @see org.apache.fop.render.Renderer | * @see org.apache.fop.render.Renderer | ||||
*/ | */ | ||||
userAgent = agent; | userAgent = agent; | ||||
} | } | ||||
/** | |||||
* @param date | |||||
*/ | |||||
public void setCreationDate(Date date) { | |||||
creationDate = date; | |||||
} | |||||
/** @see org.apache.fop.render.Renderer */ | /** @see org.apache.fop.render.Renderer */ | ||||
public void startRenderer(OutputStream outputStream) | public void startRenderer(OutputStream outputStream) | ||||
throws IOException { } | throws IOException { } | ||||
*/ | */ | ||||
protected void renderRegion(RegionReference region) { | protected void renderRegion(RegionReference region) { | ||||
List blocks = region.getBlocks(); | List blocks = region.getBlocks(); | ||||
renderBlocks(null, blocks); | renderBlocks(null, blocks); | ||||
} | } | ||||
/** | /** |
*/ | */ | ||||
void setupFontInfo(FontInfo fontInfo); | void setupFontInfo(FontInfo fontInfo); | ||||
/** | |||||
* Set the producer of the rendering. If this method isn't called the | |||||
* renderer uses a default. Note: Not all renderers support this feature. | |||||
* | |||||
* @param producer The name of the producer (normally "FOP") to be | |||||
* embedded in the generated file. | |||||
*/ | |||||
void setProducer(String producer); | |||||
/** | |||||
* Set the creator of the document to be rendered. | |||||
* If this method isn't called the renderer uses a default. | |||||
* Note: Not all renderers support this feature. | |||||
* | |||||
* @param creator The name of the document creator | |||||
*/ | |||||
void setCreator(String creator); | |||||
/** | |||||
* Set the creator date/timeof the document to be rendered. | |||||
* If this method isn't called the renderer uses the current date/time | |||||
* as default. | |||||
* Note: Not all renderers support this feature. | |||||
* | |||||
* @param date The name of the document creator | |||||
*/ | |||||
void setCreationDate(Date date); | |||||
/** | /** | ||||
* Reports if out of order rendering is supported. <p> | * Reports if out of order rendering is supported. <p> | ||||
* | * |
import java.awt.event.ActionEvent; | import java.awt.event.ActionEvent; | ||||
//FOP | //FOP | ||||
import org.apache.fop.apps.Version; | |||||
import org.apache.fop.apps.Fop; | |||||
/** | /** | ||||
* AWT Viewer's "About" dialog. | * AWT Viewer's "About" dialog. | ||||
imageControl1.setIcon(new ImageIcon(getClass().getResource("images/fop.gif"))); | imageControl1.setIcon(new ImageIcon(getClass().getResource("images/fop.gif"))); | ||||
JLabel label1 = new JLabel(translator.getString("About.Product")); | JLabel label1 = new JLabel(translator.getString("About.Product")); | ||||
JLabel label2 = new JLabel(translator.getString("About.Version") | JLabel label2 = new JLabel(translator.getString("About.Version") | ||||
+ " " + Version.getVersion()); | |||||
+ " " + Fop.getVersion()); | |||||
JLabel label3 = new JLabel(translator.getString("About.Copyright")); | JLabel label3 = new JLabel(translator.getString("About.Copyright")); | ||||
panel1.setLayout(new BorderLayout()); | panel1.setLayout(new BorderLayout()); | ||||
panel2.setLayout(new BorderLayout()); | panel2.setLayout(new BorderLayout()); |
// FOP | // FOP | ||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.apps.FOUserAgent; | import org.apache.fop.apps.FOUserAgent; | ||||
import org.apache.fop.apps.Version; | |||||
import org.apache.fop.area.Area; | import org.apache.fop.area.Area; | ||||
import org.apache.fop.area.Block; | import org.apache.fop.area.Block; | ||||
import org.apache.fop.area.BlockViewport; | import org.apache.fop.area.BlockViewport; | ||||
*/ | */ | ||||
public void startRenderer(OutputStream stream) throws IOException { | public void startRenderer(OutputStream stream) throws IOException { | ||||
ostream = stream; | ostream = stream; | ||||
producer = "FOP " + Version.getVersion(); | |||||
this.pdfDoc = new PDFDocument(producer); | |||||
this.pdfDoc.setCreator(creator); | |||||
this.pdfDoc.setCreationDate(creationDate); | |||||
this.pdfDoc = new PDFDocument(userAgent.getProducer()); | |||||
this.pdfDoc.setCreator(userAgent.getCreator()); | |||||
this.pdfDoc.setCreationDate(userAgent.getCreationDate()); | |||||
this.pdfDoc.setFilterMap(filterMap); | this.pdfDoc.setFilterMap(filterMap); | ||||
this.pdfDoc.outputHeader(stream); | this.pdfDoc.outputHeader(stream); | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import org.apache.fop.apps.Version; | |||||
import org.apache.fop.apps.Fop; | |||||
/** | /** | ||||
* This class is a wrapper for the <tt>AbstractPSDocumentGraphics2D</tt> that | * This class is a wrapper for the <tt>AbstractPSDocumentGraphics2D</tt> that | ||||
//PostScript Header | //PostScript Header | ||||
gen.writeln(DSCConstants.PS_ADOBE_30 + " " + DSCConstants.EPSF_30); | gen.writeln(DSCConstants.PS_ADOBE_30 + " " + DSCConstants.EPSF_30); | ||||
gen.writeDSCComment(DSCConstants.CREATOR, | gen.writeDSCComment(DSCConstants.CREATOR, | ||||
new String[] {"Apache FOP " + Version.getVersion() | |||||
new String[] {"Apache FOP " + Fop.getVersion() | |||||
+ ": EPS Transcoder for SVG"}); | + ": EPS Transcoder for SVG"}); | ||||
gen.writeDSCComment(DSCConstants.CREATION_DATE, | gen.writeDSCComment(DSCConstants.CREATION_DATE, | ||||
new Object[] {new java.util.Date()}); | new Object[] {new java.util.Date()}); |
import java.io.IOException; | import java.io.IOException; | ||||
//FOP | //FOP | ||||
import org.apache.fop.apps.Version; | |||||
import org.apache.fop.apps.Fop; | |||||
import org.apache.fop.fonts.FontInfo; | import org.apache.fop.fonts.FontInfo; | ||||
import org.apache.fop.fonts.FontSetup; | import org.apache.fop.fonts.FontSetup; | ||||
//PostScript Header | //PostScript Header | ||||
gen.writeln(DSCConstants.PS_ADOBE_30); | gen.writeln(DSCConstants.PS_ADOBE_30); | ||||
gen.writeDSCComment(DSCConstants.CREATOR, | gen.writeDSCComment(DSCConstants.CREATOR, | ||||
new String[] {"Apache FOP " + Version.getVersion() | |||||
new String[] {"Apache FOP " + Fop.getVersion() | |||||
+ ": PostScript Transcoder for SVG"}); | + ": PostScript Transcoder for SVG"}); | ||||
gen.writeDSCComment(DSCConstants.CREATION_DATE, | gen.writeDSCComment(DSCConstants.CREATION_DATE, | ||||
new Object[] {new java.util.Date()}); | new Object[] {new java.util.Date()}); |
//PostScript Header | //PostScript Header | ||||
writeln(DSCConstants.PS_ADOBE_30); | writeln(DSCConstants.PS_ADOBE_30); | ||||
gen.writeDSCComment(DSCConstants.CREATOR, new String[] {"FOP " + this.producer}); | |||||
gen.writeDSCComment(DSCConstants.CREATOR, new String[] { userAgent.getProducer() }); | |||||
gen.writeDSCComment(DSCConstants.CREATION_DATE, new Object[] {new java.util.Date()}); | gen.writeDSCComment(DSCConstants.CREATION_DATE, new Object[] {new java.util.Date()}); | ||||
gen.writeDSCComment(DSCConstants.LANGUAGE_LEVEL, new Integer(gen.getPSLevel())); | gen.writeDSCComment(DSCConstants.LANGUAGE_LEVEL, new Integer(gen.getPSLevel())); | ||||
gen.writeDSCComment(DSCConstants.PAGES, new Object[] {PSGenerator.ATEND}); | gen.writeDSCComment(DSCConstants.PAGES, new Object[] {PSGenerator.ATEND}); |
userAgent.getRendererOptions().put("fineDetail", new Boolean(false)); | userAgent.getRendererOptions().put("fineDetail", new Boolean(false)); | ||||
userAgent.getRendererOptions().put("consistentOutput", new Boolean(true)); | userAgent.getRendererOptions().put("consistentOutput", new Boolean(true)); | ||||
driver.getRenderer().setProducer("Testsuite Converter"); | |||||
userAgent.setProducer("Testsuite Converter"); | |||||
String outname = res; | String outname = res; | ||||
if (outname.endsWith(".xml") || outname.endsWith(".pdf")) { | if (outname.endsWith(".xml") || outname.endsWith(".pdf")) { |