RE: Referring to a image file in a JAR file

2010-07-21 Thread Bernard Giannetti






I already have a URIResolver implemented to resolve the something such as

xsl:include href=pagesetup.xsl /

which is what the Javadoc says it's used for:

http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/javax/xml/transform/URIResolver.html

Unfortunately, the fo:external-graphic src=file://myapp.jar!/image.svg 
content-width=8 content-height=8 does not trigger the call to my URI 
resolver.  I have tried src=url() etc with no luck.  So either I've got the 
wrong format of the URL or it cannot be done this way.

I don't see how to use xls:include, xsl:import and document (as per the 
Javadoc) to refer to the graphic file.  In your example, did you refer to 
images using fo:external-graphic or using some other tag?

The other thing I noticed is I set my URIResolver on the TransformerFactory:

SAXTransformerFactory saxTransformerFactory = 
(SAXTransformerFactory)TransformerFactory.newInstance();
saxTransformerFactory.setURIResolver( myURIResolver );

instead of on the foUserAgent which you did...so dunno if that makes a 
difference.


 Date: Wed, 21 Jul 2010 17:16:03 +0200
 Subject: Re: Referring to a image file in a JAR file
 To: fop-users@xmlgraphics.apache.org
 
 Hi,
 
 we needed exactly that and implemented our own ResourceResolver for that.
 You can register it like the following:
 
 //Register a custom resolver
 foUserAgent.setURIResolver(new ClasspathResourceResolver());
 
 //The clas has to implement the URIResolver
 public class ClasspathResourceResolver implements URIResolver {
 
 //you overwrite the resolve method
 public InputStream resolve(String uri){
 
 //Resolves the path to a resource in the classpath (since that jar
 should be in the classpath
 this.getClass().getResourceAsStream(uri);
 
 Regards,
 ToM
  
_
Need a new place to live? Find it on Domain.com.au
http://clk.atdmt.com/NMN/go/157631292/direct/01/

RE: Referring to a image file in a JAR file

2010-07-23 Thread Bernard Giannetti

Thanks to all...managed to sort it out!

For future reference:

1) I found that I needed to set my URIResolver class in two places - 
foUserAgent.setURIResolver() and saxTransformerFactory.setURIResolver().

2) The XSL I used to refer to my image (in the same jar file as the Java code, 
in img/myImage.svg) is

fo:external-graphic src=url(''img/myImage.svg) content-width=... /


3) The URIResolver::resolve went something like this:

public Source resolve( String href, String base ) throws 
TransformerException
{
if( img/myImage.svg.equals( href ) )
return new StreamSource( 
getClass().getClassLoader().getResourceAsStream( img/myImage.svg );

return null;
}


Thanks again for all your help!


 From: tvtre...@nepatec.de
 Date: Fri, 23 Jul 2010 13:48:34 +0200
 Subject: Re: Referring to a image file in a JAR file
 To: fop-users@xmlgraphics.apache.org
 
 Hi,
 
 since the jar with our images was on the classpath we could reference
 the image directly:
 
 fo:external-graphic src=urn:some_logo.gif/
 
 - urn: was the trigger for us in our resource resolver...
 
 Regards,
 ToM
 
 2010/7/22 Bernard Giannetti thebernmeis...@hotmail.com:
  I already have a URIResolver implemented to resolve the something such as
 
  xsl:include href=pagesetup.xsl /
 
  which is what the Javadoc says it's used for:
 
  http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/javax/xml/transform/URIResolver.html
 
  Unfortunately, the fo:external-graphic src=file://myapp.jar!/image.svg
  content-width=8 content-height=8 does not trigger the call to my URI
  resolver.  I have tried src=url() etc with no luck.  So either I've got
  the wrong format of the URL or it cannot be done this way.
 
  I don't see how to use xls:include, xsl:import and document (as per the
  Javadoc) to refer to the graphic file.  In your example, did you refer to
  images using fo:external-graphic or using some other tag?
 
  The other thing I noticed is I set my URIResolver on the TransformerFactory:
 
  SAXTransformerFactory saxTransformerFactory =
  (SAXTransformerFactory)TransformerFactory.newInstance();
  saxTransformerFactory.setURIResolver( myURIResolver );
 
  instead of on the foUserAgent which you did...so dunno if that makes a
  difference.
 
 
  Date: Wed, 21 Jul 2010 17:16:03 +0200
  Subject: Re: Referring to a image file in a JAR file
  To: fop-users@xmlgraphics.apache.org
 
  Hi,
 
  we needed exactly that and implemented our own ResourceResolver for
  that.
  You can register it like the following:
 
  //Register a custom resolver
  foUserAgent.setURIResolver(new ClasspathResourceResolver());
 
  //The clas has to implement the URIResolver
  public class ClasspathResourceResolver implements URIResolver {
 
  //you overwrite the resolve method
  public InputStream resolve(String uri){
 
  //Resolves the path to a resource in the classpath (since that jar
  should be in the classpath
  this.getClass().getResourceAsStream(uri);
 
  Regards,
  ToM
 
  
  Find it on Domain.com.au Need a new place to live?
 
 -
 To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
 For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
 
  
_
New, Used, Demo, Dealer or Private? Find it at CarPoint.com.au
http://clk.atdmt.com/NMN/go/206222968/direct/01/

RE: Referring to a image file in a JAR file

2010-07-23 Thread Bernard Giannetti






Thanks to all...managed to sort it out!

For future reference:

1) I found that I needed to set my URIResolver class in two places - 
foUserAgent.setURIResolver() and saxTransformerFactory.setURIResolver().

2) The XSL I used to refer to my image (in the same jar file as the Java code, 
in img/myImage.svg) is

fo:external-graphic src=url(''img/myImage.svg) content-width=... /


3) The URIResolver::resolve went something like this:

public Source resolve( String href, String base ) throws 
TransformerException
{
if( img/myImage.svg.equals( href ) )
return new StreamSource( 
getClass().getClassLoader().getResourceAsStream( img/myImage.svg );

return null;
}


Thanks again for all your help!


 From: tvtre...@nepatec.de
 Date: Fri, 23 Jul 2010 13:48:34 +0200
 Subject: Re: Referring to a image file in a JAR file
 To: fop-users@xmlgraphics.apache.org
 
 Hi,
 
 since the jar with our images was on the classpath we could reference
 the image directly:
 
 fo:external-graphic src=urn:some_logo.gif/
 
 - urn: was the trigger for us in our resource resolver...
 
 Regards,
 ToM
 
 2010/7/22 Bernard Giannetti thebernmeis...@hotmail.com:
  I already have a URIResolver implemented to resolve the something such as
 
  xsl:include href=pagesetup.xsl /
 
  which is what the Javadoc says it's used for:
 
  http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/javax/xml/transform/URIResolver.html
 
  Unfortunately, the fo:external-graphic src=file://myapp.jar!/image.svg
  content-width=8 content-height=8 does not trigger the call to my URI
  resolver.  I have tried src=url() etc with no luck.  So either I've got
  the wrong format of the URL or it cannot be done this way.
 
  I don't see how to use xls:include, xsl:import and document (as per the
  Javadoc) to refer to the graphic file.  In your example, did you refer to
  images using fo:external-graphic or using some other tag?
 
  The other thing I noticed is I set my URIResolver on the TransformerFactory:
 
  SAXTransformerFactory saxTransformerFactory =
  (SAXTransformerFactory)TransformerFactory.newInstance();
  saxTransformerFactory.setURIResolver( myURIResolver );
 
  instead of on the foUserAgent which you did...so dunno if that makes a
  difference.
 
 
  Date: Wed, 21 Jul 2010 17:16:03 +0200
  Subject: Re: Referring to a image file in a JAR file
  To: fop-users@xmlgraphics.apache.org
 
  Hi,
 
  we needed exactly that and implemented our own ResourceResolver for
  that.
  You can register it like the following:
 
  //Register a custom resolver
  foUserAgent.setURIResolver(new ClasspathResourceResolver());
 
  //The clas has to implement the URIResolver
  public class ClasspathResourceResolver implements URIResolver {
 
  //you overwrite the resolve method
  public InputStream resolve(String uri){
 
  //Resolves the path to a resource in the classpath (since that jar
  should be in the classpath
  this.getClass().getResourceAsStream(uri);
 
  Regards,
  ToM
 
  
  Find it on Domain.com.au Need a new place to live?
 
 -
 To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
 For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
 
  
_
If It Exists, You'll Find it on SEEK. Australia's #1 job site
http://clk.atdmt.com/NMN/go/157639755/direct/01/

Minimising FOP footprint...

2010-07-23 Thread Bernard Giannetti

Hi,

I've noticed there's a lot of 3rd party JAR files bundled with FOP 1.0, notably:

avalon-framework-4.2.0.jar
batik-all-1.7.jar
commons-io-1.3.1.jar
commons-logging-1.0.4.jar
serializer-2.7.0.jar
xalan-2.7.0.jar
xercesImpl-2.7.1.jar
xml-apis-1.3.04.jar
xml-apis-ext-1.3.04.jar
xmlgraphics-commons-1.3.1.jar

and was wondering how many do I actually need?  If all I'm doing is using FOP 
to render an XML file using XSL template to a PDF, is there a way to trim out 
the unwanted JARs?

I can do a clean compile of my application, minus the JARs above listed in the 
classpath.  If I can the run my application and exercise the FOP part of it, 
does that tell me which JARs I can drop or am I being too naive?


On a somewhat related note, in doing an ANT build and setting the compiler args 
as follows:

compilerarg value=-Xlint:deprecation,fallthrough,finally,path,unchecked /

I get a few path warnings:

[javac] warning: [path] bad path element /lib/fop-hyph.jar: no such file 
or directory
[javac] warning: [path] bad path element /lib/xml-apis.jar: no such file 
or directory
[javac] warning: [path] bad path element /lib/xercesImpl.jar: no such 
file or directory
[javac] warning: [path] bad path element /lib/serializer.jar: no such 
file or directory
[javac] warning: [path] bad path element /lib/log4j.jar: no such file or 
directory

So are these old manifest entries that have not been updated to the new 
versions?  Can I safely remove these from the mainfests in the FOP JAR files?



Thanks,

Bernard.
  
_
Browse profiles for FREE! Meet local singles online.
http://clk.atdmt.com/NMN/go/150855801/direct/01/

Inclusing of a dynmaically generated SVG into XSL

2011-05-01 Thread Bernard Giannetti

Hi,

I have a dynamically generated SVG image (using Batik included with the FOP 
distribution) and I want to pass the SVG (say as a bytearrayoutputstream) into 
the render process.  The render process is typical: 

bufferedOutputStream = new BufferedOutputStream( new FileOutputStream( 
outputPDFFile ) );
fop = fopFactory.newFop( org.apache.xmlgraphics.util.MimeConstants.MIME_PDF, 
foUserAgent, bufferedOutputStream );
transformer = TransformerFactory.newInstance().newTransformer( new 
StreamSource( xslStylesheet ) );
source = new StreamSource( xmlData );
result = new SAXResult( fop.getDefaultHandler() );
transformer.transform( source, result );

I've found the following two articles which have given me a bit of an idea:

http://old.nabble.com/How-to-transform-embedded-FO--td31231565.html
http://old.nabble.com/Embedding-SVG-dynamically-into-fo-file-td30691616.html

but I can't seem to figure out once I have my SVG as a bytearraystream what to 
do with it:

SAXSource saxSource = new SAXSource( new InputSource( new ByteArrayInputStream( 
byteArrayOutputStream.toByteArray() ) ) );

Where do I put the saxSource?

At the other end, what tag/block do I use in the XSL file to place the SVG?  
Currently I pull in an SVG file using the tag

fo:block background-image=url('background.svg') background-repeat=repeat 
background-position-horizontal=center background-position-vertical=center 

which is fine for the file version...but not sure what to do for a dynamically 
generated version.

From what I've read it should be possible to create an SVG on the fly and pass 
it into the render process...just can't join all the dots!


Thanks in advance,

Bernard.


  

Missing render messages

2011-05-06 Thread Bernard Giannetti

Hi,

Having trouble capturing all logging from a FOP render.  I am using log4j and 
have configured it using the XML file (see the end of this post).  

Normally I find that all logging goes to my log file and console as per the 
logging level I set.

However I found by accident I had mistyped an attribute in an XSL file: instead 
of 

  xsl:param name=page-height value= / 

I had 

  xsl:param n ame=page-height value= / 

I noticed on the console after doing a render (in Eclipse) the following 
messages (the first two were in red):

[Fatal Error] pagesetup.xsl:6:16: Attribute name n associated with an element 
type xsl:param must be followed by the ' = ' character.
file:/home/bernard/reports/pagesetup.xsl; Line #6; Column #16; 
org.xml.sax.SAXParseException: Attribute name n associated with an element 
type xsl:param must be followed by the ' = ' character.
2011-05-07 14:11:08,228 [Thread-1] PrintToPDF - 
PrintToPDF$PrintToPDFUsingFOP.run(PrintToPDF.java:2025) - 
java.lang.NullPointerException

However in my log file only the third error (the exception) was present.  The 
first two lines were NOT in the log file.

My log4j configuration file is below.  I've tried specifying different classes 
to get different levels and to coax out the error message.  Even trying with 
all logging set to 'all' does not show the first two error messages.

Any ideas on how to capture all the information from the render?


?xml version=1.0 encoding=UTF-8 ?
!DOCTYPE log4j:configuration SYSTEM log4j.dtd

log4j:configuration xmlns:log4j=http://jakarta.apache.org/log4j/;

  appender name=rollingFileAppender 
class=org.apache.log4j.RollingFileAppender
param name=File value=log.txt/
param name=Append value=true/
param name=MaxBackupIndex value=0/
param name=MaxFileSize value=500KB/
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%d [%t] %c - %l - %m%n/
/layout
  /appender

  appender name=consoleAppender class=org.apache.log4j.ConsoleAppender
layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=%d [%t] %c - %l - %m%n/
/layout
  /appender

!--
  logger name=FOP
level value=error/ 
  /logger

  logger name=org.apache.fop
level value=error/ 
  /logger

  logger name=org.apache.fop.render
level value=error/ 
  /logger

  logger name=org.apache.xmlgraphics
level value=error/ 
  /logger

  logger name=org.xml.sax
level value=error/ 
  /logger
--

  root
priority value=all/
appender-ref ref=consoleAppender/
appender-ref ref=rollingFileAppender/
  /root

/log4j:configuration


Thanks in advance,

Bernard.
  

RE: fop not handling svn rotated text on linux

2011-06-24 Thread Bernard Giannetti

Something which happened to me (unrelated to rotating text) but I noticed a 
difference between the PDF viewing engines of Adobe and Ubuntu's Document 
Viewer.

There is some bug in the way the underlying library (used by Document Viewer) 
does rendering - I cannot remember the specifics but the bug was there still a 
few months ago.

So perhaps look at your PDF using Adobe PDF viewer on Linux?


 Date: Fri, 24 Jun 2011 17:08:20 -0600
 From: rsarg...@xmission.com
 To: fop-users@xmlgraphics.apache.org
 Subject: fop not handling svn rotated text on linux
 
 Using fop-0.95 in this case.  We generate a small svg file for the
 outside edge of each page and put the section name and page number (et
 al).  The text is rotated +/-90 degrees for the section name.  We're
 using Helvetica.  Certain character combinations are just wrongly spaced
 but especially Jo  which actually touch each other in the final pdf. 
 Worse yet, this only happens on our linux boxes: OpenSuse 11.2 and 11.4
 and Ubuntu.  Windows boxes print just fine.  How embarrassing is that!?
 
 Any pointers appreciated,
 
 
 -
 To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
 For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
 
  

Interrupt/cancel/abort a render

2011-09-18 Thread Bernard Giannetti

Hi,

I'm wondering if it's possible to interrupt/cancel/abort a render once it has 
been started.  I'm embedding FOP into a Java desktop application in a similar 
way which is described here: 
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleXML2PDF.java?view=markup.
  

I've looked at the API and nothing is immediately obvious.  I found this old 
forum post (http://www.mail-archive.com/fop-user@xml.apache.org/msg05146.html) 
which didn't help.

I am running the rendering process in a thread but not sure how I'd go about 
cleanly/gracefully aborting a render.

Thanks,

Bernard.  

RE: Still having trouble loading fonts at runtime - suggestions?

2012-06-12 Thread Bernard Giannetti

Hi Phillip,
I have written a desktop application which, on start up, refreshes a cache of 
fonts (using FOP code) and subsequently allows the user to refresh that cache 
by hitting a button (again, calls the same FOP code).
See attached.
When the application starts up I call FOPManager.refreshFonts( false );

Before allowing the user to initiate a print, I call FOPManager.isReady()
 When the user forces a cache update, I call FOPManager.refreshFonts( true );
My fopConfiguration.xml is standard and doesn't do anything fancy.

Cheers,
Bernard.

 From: phillip.old...@gmail.com
 Date: Tue, 12 Jun 2012 16:58:49 +0100
 Subject: Still having trouble loading fonts at runtime - suggestions?
 To: fop-users@xmlgraphics.apache.org
 
 Hi All
 
 I'm still having trouble loading  using fonts while my app is
 running. I can load fonts without issue when configuring them via the
 XML config, but unfortunately the fonts are provided by a 3rd party at
 runtime and I therefore need to find a way to load them via java.
 
 Here's my current process (not working):
 
 1. create a new FOP instance
 2. load a number of default settings from an XML file
 3. override some of these settings (eg. resolution) based on certain
 preferences passed in at runtime
 
 then, specifically regarding fonts:
 
 4. create a temporary directory to store the font(s) that the 3rd
 party is providing
 5. write each font to the temp directory
 6. pass the temp dir to FontManager.getFontBaseURL()
 7. process the FO file
 
 However, even though the FontBaseURL is changed, the fonts aren't
 loaded/used during processing. Is there a way to tell FOP/the
 FontManager to refresh it's cache/search the new directory and load
 the fonts? Is there a better approach to this?
 
 -- 
 Phillip B Oldham
 phillip.old...@gmail.com
 
 -
 To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
 For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
 
  import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.SortedMap;
import java.util.Vector;

import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.fonts.FontEventListener;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.fonts.autodetect.FontFileFinder;
import org.apache.fop.tools.fontlist.FontListGenerator;
import org.apache.log4j.Logger;


public class FOPManager
{
	private static final String PROPERTY_FONT_LIST = FontList; //$NON-NLS-1$
	private static final String PROPERTY_FONT_FILES = FontFiles; //$NON-NLS-1$

	protected static final FopFactory ms_fopFactory = FopFactory.newInstance();
	protected static final Logger ms_logger = Logger.getLogger( FOPManager.class.getName() );

	public static final boolean IS_MAC_OS_X = System.getProperty( os.name ).startsWith( Mac OS X ); //$NON-NLS-1$ //$NON-NLS-2$

	protected static VectorString ms_fonts = null;
	protected static boolean ms_ready = false;

	protected static final HashMapString, String ms_fontsForMacOSX = new HashMapString, String();
	protected static final HashMapString, String ms_fontsForWindows = new HashMapString, String();


	static
{
		try { ms_fopFactory.setUserConfig( new File( fopConfiguration.xml ) ); } //$NON-NLS-1$
		catch( Exception exception ) { throw new RuntimeException( exception ); }

		ms_fontsForMacOSX.put( en, Arial ); //$NON-NLS-1$ //$NON-NLS-2$
		ms_fontsForWindows.put( en, Arial ); //$NON-NLS-1$ //$NON-NLS-2$

		// http://www.pinyinjoe.com/pinyin/pinyin_xpfonts.htm
		// http://www.yale.edu/chinesemac/pages/fonts.html
		ms_fontsForMacOSX.put( zh, Hei ); //$NON-NLS-1$ //$NON-NLS-2$
		ms_fontsForWindows.put( zh, SimHei ); //$NON-NLS-1$ //$NON-NLS-2$
}


	public static FopFactory getFOPFactory() { return ms_fopFactory; }


public static VectorString getFontList() { return ms_fonts; }


public static boolean isReady() { return ms_ready; }


	public static void refreshFonts( boolean flush )
	{
		ms_ready = false;

		if( flush )
		{
			new InitialiseFonts().start();
			return;
		}

		// Get the list of cached font names...
		ms_fonts = PropertiesManager.getInstance().getList( PROPERTY_FONT_LIST );
		if( ms_fonts.isEmpty() )
		{
			new InitialiseFonts().start();
			return;
		}

		// We have a list of font names, assume it's good.
		// Now check the cached font files list against the actual font files list.
		VectorString fontFilesFromProperties = PropertiesManager.getInstance().getList( PROPERTY_FONT_FILES );
		VectorString fontFiles = loadFontFiles();
		if( fontFilesFromProperties.size() != fontFiles.size() )
		{
			new InitialiseFonts().start();
			return;
		}

		// Compare the font files lists, element by element...
		for( String fontFile : fontFiles )
			for( int i = 0; i  

RE: Still having trouble loading fonts at runtime - suggestions?

2012-06-13 Thread Bernard Giannetti

Hi Phill,
The PropertiesManager is a class of mine which basically extends 
java.util.Properties and essentially reads/writes a hash table of key/value 
pairs.  I store in the properties a list of the font names and their respective 
font files (as discovered via FOP).  For me on Ubuntu 12.04 I get:
FontList=Andale Mono,Arial,Arial Black,Bitstream Charter,Century Schoolbook 
L,Comic Sans 
MS,Courier,...FontFiles=file\:/usr/share/fonts/truetype/openoffice/opens___.ttf,file\:/usr/share/fonts/truetype/ttf-khmeros-core/KhmerOS.ttf,...
I cannot remember precisely why I had to implement this cache but I think it 
had to do with supporting i18n.  Originally I simply used the hard coded 
default fonts which FOP provided but I found on some non-English machines I'd 
get the 'square' symbol and so wanted to provide a way for a user to specify a 
font to use for the render.  To do this I got FOP to tell me what fonts were 
available and present that to the user.  I just cache that information so I 
don't have to ask FOP each time (which can take a few minutes).
When I do the render I pass the font name as one of the transformer parameters:

xslParams.put( font-family, (String)m_fontName.getSelectedItem() );
where m_fontName is the selected font name in the JComboBox shown to the user. 

Cheers,
Bernard.

 Date: Wed, 13 Jun 2012 06:41:58 -0700
 From: phillip.old...@gmail.com
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Still having trouble loading fonts at runtime - suggestions?
 
 
 Hi Bernard
 
 Thanks for that code - that's really helpful.
 
 However, from what I can tell (java isn't one of my main languages, I'm a
 Python dev) it seems as though it doesn't actually tell FOP to reload any
 fonts, but rather gathers a list of fonts and then asks `PropertiesManager`
 to set the fonts. I can't see a reference to `PropertiesManager` in the FOP
 docs; is that a class in your app, or am I missing something?
 
 Cheers,
 Phill
  

RE: Still having trouble loading fonts at runtime - suggestions?

2012-06-13 Thread Bernard Giannetti

Hi Phill,
I make a call to FOP itself to find the fonts - see FOPManager::InitialiseFonts 
in the code from my first reply.  The magic line is
SortedMap?,? fontFamilies = new FontListGenerator().listFonts( ms_fopFactory, 
org.apache.xmlgraphics.util.MimeConstants.MIME_PDF, fontEventListener );
I've looked at the FOP internal code and they simply squirrel through various 
directories, based on the current OS, to find font files.  I call this code and 
then simply cache that information.
I suspect to add a font in at runtime you'd need to configure that in the FOP 
configuration file - never had to do this myself.

Cheers,
Bernard.

 Date: Wed, 13 Jun 2012 07:20:46 -0700
 From: phillip.old...@gmail.com
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Still having trouble loading fonts at runtime - suggestions?
 
 
 Hi Bernard
 
 Thanks for that explanation; that makes a lot of sense now.
 
 I think I'm still having a little trouble working out which are the line(s)
 where you're telling FOP which fonts are available, though.
 
 Specifically what I have is a byte-array containing a font's data, and I
 need to make FOP use that font when it renders an FO (there's no XSL
 translation - that has already been done).
 
 I've been through the docs a number of times now, but I can't see where I
 can add a font manually to FOP's runtime config, or tell it to refresh it's
 font cache after providing a directory of fonts, or anything like that. :(
  

Getting a list of font names without the memory hit...

2013-07-30 Thread Bernard Giannetti
Hi,
I'm making a call to org.apache.fop.tools.fontlist.FontListGenerator.listFonts( 
... ) to get a list of font names for my desktop application.  To get the font 
names, I take the keys from the returned fontFamilies SortedMap; the actual 
data is junked.
I hadn't realised just how much memory is used by listfont( ... ) - on some 
platforms such as Windows 7, in excess of 250 MB.  In this case I'm hitting out 
of memory errors.
I was wondering if there's a simpler way (uses less memory) to get just the 
font names (first family names)?  As I said, I don't make use of the metrics 
and other font details...just the first family name for each font.  Digging 
down into  listfont( ... ), I was wondering if it's safe to take the 
firstFamilyName and place it into a list say and then drop the following lines 
for the containers/sort?
Iterator iter = fontInfo.getFontTriplets().entrySet().iterator();while 
(iter.hasNext()) {Map.Entry entry = (Map.Entry)iter.next();FontTriplet 
triplet = (FontTriplet)entry.getKey();String key = 
(String)entry.getValue();FontSpec container;if (keyBag.contains(key)) { 
   keyBag.remove(key);
FontMetrics metrics = (FontMetrics)fonts.get(key);
container = new FontSpec(key, metrics);
container.addFamilyNames(metrics.getFamilyNames());keys.put(key, 
container);String firstFamilyName = 
(String)container.getFamilyNames().first();List containers = 
(List)fontFamilies.get(firstFamilyName);if (containers == null) {   
 containers = new java.util.ArrayList();
fontFamilies.put(firstFamilyName, containers);}
containers.add(container);Collections.sort(containers);} else { 
   container = (FontSpec)keys.get(key);}container.addTriplet(triplet);}
I'm guessing a lot of memory is chewed up in the containers/sort section...but 
really I can't be sure as I don't fully follow what's going on!
Ideally I'd just up the amount of memory supplied to the desktop application, 
but I don't have that option and besides, it just delays the problem of running 
out of memory.

Thanks in advance,Bernard.

Getting a list of font names without the memory hit...‏

2013-07-30 Thread Bernard Giannetti
(apologies for the double post...somehow my email got tagged to the end of an 
unrelated post)

Hi,
I'm making a call to org.apache.fop.tools.fontlist.FontListGenerator.listFonts( 
... ) to get a list of font names for my desktop application.  To get the font 
names, I take the keys from the returned fontFamilies SortedMap; the actual 
data is junked.I hadn't realised just how much memory is used by listfont( ... 
) - on some platforms such as Windows 7, in excess of 250 MB.  In this case I'm 
hitting out of memory errors.
I was wondering if there's a simpler way (uses less memory) to get just the 
font names (first family names)?  As I said, I don't make use of the metrics 
and other font details...just the first family name for each font.  Digging 
down into  listfont( ... ), I was wondering if it's safe to take the 
firstFamilyName and place it into a list say and then drop the following lines 
for the containers/sort?Iterator iter = 
fontInfo.getFontTriplets().entrySet().iterator();while (iter.hasNext()) {
Map.Entry entry = (Map.Entry)iter.next();FontTriplet triplet = 
(FontTriplet)entry.getKey();String key = (String)entry.getValue();
FontSpec container;if (keyBag.contains(key)) {keyBag.remove(key);   
 FontMetrics metrics = (FontMetrics)fonts.get(key);container = new 
FontSpec(key, metrics);
container.addFamilyNames(metrics.getFamilyNames());keys.put(key, 
container);String firstFamilyName = 
(String)container.getFamilyNames().first();List containers = 
(List)fontFamilies.get(firstFamilyName);if (containers == null) {   
 containers = new java.util.ArrayList();
fontFamilies.put(firstFamilyName, containers);}
containers.add(container);Collections.sort(containers);} else { 
   container = (FontSpec)keys.get(key);}
container.addTriplet(triplet);}I'm guessing a lot of memory is chewed up in the 
containers/sort section...but really I can't be sure as I don't fully follow 
what's going on!Ideally I'd just up the amount of memory supplied to the 
desktop application, but I don't have that option and besides, it just delays 
the problem of running out of memory.
Thanks in advance,Bernard.

RE: Getting a list of font names without the memory hit...‏

2013-07-30 Thread Bernard Giannetti
I'm using FOP inside my desktop app.  I use FOP to combine .xml data files and 
.xsl template files into PDFs.  I wanted to give the user the choice of font to 
use for the PDF text and so I am calling FOP code to get that list of fonts.

Date: Tue, 30 Jul 2013 21:41:10 -0500
From: lmpmberna...@gmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Re: Getting a list of font names without the memory hit...‏


  

  
  
Are you using FOP in your Desktop app
  (meaning you feed and FO file and output one of the supported
  formats) or you just want to use some classes to get the list of
  fonts in your system?

  

  On 7/30/13 5:42 PM, Bernard Giannetti wrote:



  
  
(apologies for the double post...somehow
my email got tagged to the end of an unrelated post)


  

  


  Hi,


  

  I'm making a call to 
org.apache.fop.tools.fontlist.FontListGenerator.listFonts(
  ... ) to get a list of font names
  for my desktop application.  To get the font names, I take the 
keys from the
  returned fontFamilies
  SortedMap; the actual data is
  junked.
  
  
  I hadn't
realised just how much memory is used by listfont(
... ) - on some platforms such as Windows 7, in
excess of 250 MB.  In this case I'm hitting out of
memory errors.
  

  
  I was
wondering if there's a simpler way (uses less memory) to
get just the font names (first family names)?  As I
said, I don't make use of the metrics and other font
details...just the first family name for each font.  Digging 
down into  listfont(
... ), I was wondering if it's safe to take the firstFamilyName 
and place it
  into a list say and then drop the following lines for the 
containers/sort?
  

  
Iterator iter =
fontInfo.getFontTriplets().entrySet().iterator();
while (iter.hasNext()) {
 
Map.Entry
  entry = (Map.Entry)iter.next();
 
FontTriplet
  triplet = (FontTriplet)entry.getKey();
 
String
  key = (String)entry.getValue();
 
FontSpec
  container;
 
if
  (keyBag.contains(key)) {
 
   
  keyBag.remove(key);

  
 
   
  FontMetrics metrics = (FontMetrics)fonts.get(key);

  
 
container = new FontSpec(key,
  metrics);
 
container.addFamilyNames(metrics.getFamilyNames());
 
keys.put(key, container);
 
String firstFamilyName =
  (String)container.getFamilyNames().first();
 
List containers =
  (List)fontFamilies.get(firstFamilyName);
 
if (containers == null) {
 
 
containers = new
  java.util.ArrayList();
 
 
fontFamilies.put(firstFamilyName,
  containers);
 
}
 
containers.add(container);
 
Collections.sort(containers);
 
} else {
 
container =
  (FontSpec)keys.get(key);
 
}
 
container.addTriplet(triplet);
}
  
  

  I'm guessing a lot
  of memory is chewed up in the containers/sort
  section...but really I can't be sure as I don't fully
  follow what's going on!
  

  Ideally I'd just up
  the amount of memory supplied to the desktop application,
  but I don't have that option and besides, it just delays
  the problem of running out of memory.
  

  

  
  
Thanks in advance,

  
Bernard.
  

  


  

RE: Getting a list of font names without the memory hit...‏

2013-07-31 Thread Bernard Giannetti
I've done some more digging/testing and noticed that when I get the fonts 
map... 
FontInfo fontInfo = new FontInfo();configurator.setupFontInfo( documentHandler, 
fontInfo );Map fonts = fontInfo.getFonts();
(the above essentially comes straight out of listfonts() and its subcalls)
the fontInfo.getFonts() was returning a Collections.unmodifiableMap(this.fonts) 
which I initially thought was the memory hog.  Well it sort of is, but it is 
not the main culprit.
Noticing that this.fonts is private, I used reflection to access the this.fonts 
directly (so no copy took place) and still the memory was excessive 
(essentially little difference to what I've initially seen).
On digging deeper, the big memory hit is happening within 
configurator.setupFontInfo( documentHandler, fontInfo );.
Let me back up and ask a couple of sanity questions...first, to reiterate: my 
desktop Java application allows a user to create PDF reports (from XML and XSL) 
by making direct Java calls to FOP (that is, I do NOT invoke FOP from the 
command line).
1) I want the user to be able to choose the name of a font for a given report.  
Should I be getting the font names by calling FontListGenerator.listFonts()?
2) I noticed in the guts of configurator.setupFontInfo(),  there is a font 
cache file which is written.  Is it possible to get the fonts names from this 
file instead?
In short, I am not fussed on how I get the font names so long as the memory 
doesn't go through the roof!


From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: RE: Getting a list of font names without the memory hit...‏
Date: Wed, 31 Jul 2013 13:17:32 +1000




I'm using FOP inside my desktop app.  I use FOP to combine .xml data files and 
.xsl template files into PDFs.  I wanted to give the user the choice of font to 
use for the PDF text and so I am calling FOP code to get that list of fonts.

Date: Tue, 30 Jul 2013 21:41:10 -0500
From: lmpmberna...@gmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Re: Getting a list of font names without the memory hit...‏


  

  
  
Are you using FOP in your Desktop app
  (meaning you feed and FO file and output one of the supported
  formats) or you just want to use some classes to get the list of
  fonts in your system?

  

  On 7/30/13 5:42 PM, Bernard Giannetti wrote:



  
  
(apologies for the double post...somehow
my email got tagged to the end of an unrelated post)


  

  


  Hi,


  

  I'm making a call to 
org.apache.fop.tools.fontlist.FontListGenerator.listFonts(
  ... ) to get a list of font names
  for my desktop application.  To get the font names, I take the 
keys from the
  returned fontFamilies
  SortedMap; the actual data is
  junked.
  
  
  I hadn't
realised just how much memory is used by listfont(
... ) - on some platforms such as Windows 7, in
excess of 250 MB.  In this case I'm hitting out of
memory errors.
  

  
  I was
wondering if there's a simpler way (uses less memory) to
get just the font names (first family names)?  As I
said, I don't make use of the metrics and other font
details...just the first family name for each font.  Digging 
down into  listfont(
... ), I was wondering if it's safe to take the firstFamilyName 
and place it
  into a list say and then drop the following lines for the 
containers/sort?
  

  
Iterator iter =
fontInfo.getFontTriplets().entrySet().iterator();
while (iter.hasNext()) {
 
Map.Entry
  entry = (Map.Entry)iter.next();
 
FontTriplet
  triplet = (FontTriplet)entry.getKey();
 
String
  key = (String)entry.getValue();
 
FontSpec
  container;
 
if
  (keyBag.contains(key)) {
 
   
  keyBag.remove(key);

  
 
   
  FontMetrics metrics = (FontMetrics)fonts.get(key);

  
 
container = new FontSpec(key,
  metrics);
 
container.addFamilyNames(metrics.getFamilyNames());
 
keys.put(key, container);
 
String firstFamilyName =
  (String)container.getFamilyNames().first

RE: Getting a list of font names without the memory hit...‏

2013-07-31 Thread Bernard Giannetti
The config file or the cache file?
My config file has no fonts listed for PDF:
renderer mime=application/pdf  filterListvalueflate/value  
/filterList
  fontsauto-detect/  /fonts/renderer

 Date: Wed, 31 Jul 2013 04:26:33 -0700
 From: djs...@yahoo.com
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Getting a list of font names without the memory hit...‏
 
 Why don't you just read the config file which list all the available fonts?

  

RE: Getting a list of font names without the memory hit...‏

2013-07-31 Thread Bernard Giannetti
I'm reading org.apache.fop.fonts.FontCache now...red-faced and fingers crossed!



From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: RE: Getting a list of font names without the memory hit...‏
Date: Wed, 31 Jul 2013 21:29:59 +1000




The config file or the cache file?
My config file has no fonts listed for PDF:
renderer mime=application/pdf  filterListvalueflate/value  
/filterList
  fontsauto-detect/  /fonts/renderer

 Date: Wed, 31 Jul 2013 04:26:33 -0700
 From: djs...@yahoo.com
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Getting a list of font names without the memory hit...‏
 
 Why don't you just read the config file which list all the available fonts?


  

RE: Getting a list of font names without the memory hit...‏

2013-07-31 Thread Bernard Giannetti
Now I'm chasing my tail...looking at FontCache has gotten me back to 
FontInfo.getFonts()!
Any other ideas please?!

From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: RE: Getting a list of font names without the memory hit...‏
Date: Wed, 31 Jul 2013 21:33:14 +1000




I'm reading org.apache.fop.fonts.FontCache now...red-faced and fingers crossed!



From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: RE: Getting a list of font names without the memory hit...‏
Date: Wed, 31 Jul 2013 21:29:59 +1000




The config file or the cache file?
My config file has no fonts listed for PDF:
renderer mime=application/pdf  filterListvalueflate/value  
/filterList
  fontsauto-detect/  /fonts/renderer

 Date: Wed, 31 Jul 2013 04:26:33 -0700
 From: djs...@yahoo.com
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Getting a list of font names without the memory hit...‏
 
 Why don't you just read the config file which list all the available fonts?


  

RE: Getting a list of font names without the memory hit...‏

2013-08-01 Thread Bernard Giannetti



Thanks Chris - simplest solution is often the best:
String fonts[] = 
GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
Getting a list of fonts this way does NOT appear to impact memory at all...so 
much better!
I don't have the use-cache tag in my config file, so I assume the cache is on 
by default.  I did a test run of creating a PDF:
With no use-cache present: memory used 111 MBWith 
use-cachefalse/use-cache present: memory used 330 MB
I think I'll stick with the default!
Thanks again,
Bernard.

 Date: Thu, 1 Aug 2013 13:58:57 +0100
 From: bowditch_ch...@hotmail.com
 To: fop-users@xmlgraphics.apache.org
 Subject: Re: Getting a list of font names without the memory hit...‏
 
 The auto-detect feature creates the font cache, to save time on 
 sunsequent calls to FOP, you can disable the cache using the setting: 
 use-cachefalse/use-cache in your fop.xconf.
 
 I suspect the reason for the high memory consumption is your use of 
 auto-detect feature. Though I've not replicated the issue. If your 
 intention  is to allow the user to pick any font installed on the 
 Operating System, why not use the java.awt classes to list the available 
 fonts instead? I've not tried it but I suspect it will use less memory 
 as it doesn't need to load the full contents of every font in the system.


  

Memory usage and page numbering...

2013-08-08 Thread Bernard Giannetti
Hi,
I have a Java desktop application, using embedded FOP to create PDFs from a 
data XML file and an XSLT file.  I wanted to see how much memory is being used, 
given the point about memory usage, page numbers and page totals 
(http://xmlgraphics.apache.org/fop/1.1/running.html#memory).
My PDF reports have a page N of TOTAL at the bottom right of each page and I 
wanted to see the memory usage and compare to no page numbers and just page 
numbers without totals.  I also used the two variations for page number totals 
(XSL 1.0 and XSL 1.1).
To work out the memory usage I computed the difference when calling 
Runtime.getRuntime().freeMemory() at the start and end of the render process.  
I ran each render variation 5 times from a shell script and each render kicked 
off a separate JVM to avoid any caching.  Regardless of whether I had page 
numbers or not, and page totals or not, it seemed the result is that there is 
no difference between having page numbers/totals or not.  Sometimes the memory 
usage was 50 MB and sometimes 200 MB.
I then used the sample code and data files from embedded FOP, 
http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_1/examples/embedding/.  
I modified the data XML file to contain lots of entries, giving a data file 
size of about 1 MB.  I also modified the XLST file to include pages numbers and 
then also page totals.  Again, I noticed no difference in memory usage.
Given the varying values for memory usage I'm seeing, I assume my quick and 
dirty method is inadequate.  I expected variation, but mostly to see far less 
memory usage when no page totals were used, but that's not the case.
Has anyone seen similar results?  Does using page totals really use THAT much 
more memory compared to not using page totals?
Thanks in advance,Bernard.

RE: Memory usage and page numbering...

2013-08-09 Thread Bernard Giannetti
Thanks Robert - I found https://code.google.com/a/eclipselabs.org/p/jvmmonitor/ 
which I managed to get running in a few minutes and has pretty realtime graphs! 
 Good enough to get started :-)

From: rme...@hotmail.co.uk
To: fop-users@xmlgraphics.apache.org
Subject: RE: Memory usage and page numbering...
Date: Fri, 9 Aug 2013 09:02:44 +




Hi Bernard,

From my experience of trying to study the memory impact between builds, the 
getRuntime().freeMemory() method I found was very unreliable due to the nature 
of the JVM. I was getting back different results each time I ran it and even 
after purposefully modifying one build to run inefficiently, it returned the 
opposite to what I was expecting. As such, I ended up using a profiler which 
allowed me to break it down to see what was being run and identify memory hot 
spots and differences without being hampered by the somewhat random garbage 
collection.

Another method would be to generate and compare hprof dump output. There are a 
few tools out there to do this like the Eclipse Memory Analyzer [1]. To 
generate the dump, I just add the following to the FOP args:

-Xrunhprof:heap=sites,depth=depth required

Regards,

Robert Meyer

[1] http://www.eclipse.org/mat/

From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Memory usage and page numbering...
Date: Fri, 9 Aug 2013 15:20:15 +1000




Hi,
I have a Java desktop application, using embedded FOP to create PDFs from a 
data XML file and an XSLT file.  I wanted to see how much memory is being used, 
given the point about memory usage, page numbers and page totals 
(http://xmlgraphics.apache.org/fop/1.1/running.html#memory).
My PDF reports have a page N of TOTAL at the bottom right of each page and I 
wanted to see the memory usage and compare to no page numbers and just page 
numbers without totals.  I also used the two variations for page number totals 
(XSL 1.0 and XSL 1.1).
To work out the memory usage I computed the difference when calling 
Runtime.getRuntime().freeMemory() at the start and end of the render process.  
I ran each render variation 5 times from a shell script and each render kicked 
off a separate JVM to avoid any caching.  Regardless of whether I had page 
numbers or not, and page totals or not, it seemed the result is that there is 
no difference between having page numbers/totals or not.  Sometimes the memory 
usage was 50 MB and sometimes 200 MB.
I then used the sample code and data files from embedded FOP, 
http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_1/examples/embedding/.  
I modified the data XML file to contain lots of entries, giving a data file 
size of about 1 MB.  I also modified the XLST file to include pages numbers and 
then also page totals.  Again, I noticed no difference in memory usage.
Given the varying values for memory usage I'm seeing, I assume my quick and 
dirty method is inadequate.  I expected variation, but mostly to see far less 
memory usage when no page totals were used, but that's not the case.
Has anyone seen similar results?  Does using page totals really use THAT much 
more memory compared to not using page totals?
Thanks in advance,Bernard.  
  

RE: Memory usage and page numbering...

2013-08-09 Thread Bernard Giannetti
Having now done a few runs using JVM Monitor on both Ubuntu 32 bit and 64 bit, 
I've found that the heap memory is slightly less when page numbers with totals 
are used compared to no page numbers at all.  Slightly less, but really nothing 
worth howling about.
From the FOP section on Memory Usage, specifically Forward References, it 
just doesn't seem to add up that page totals uses far more memory than not 
using page totals.  Is the note about extra memory usage perhaps a hangover 
from an older version of FOP?
Has anyone else found memory to be no different whether page numbers/totals are 
used or not?

From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: RE: Memory usage and page numbering...
Date: Fri, 9 Aug 2013 21:40:06 +1000




Thanks Robert - I found https://code.google.com/a/eclipselabs.org/p/jvmmonitor/ 
which I managed to get running in a few minutes and has pretty realtime graphs! 
 Good enough to get started :-)

From: rme...@hotmail.co.uk
To: fop-users@xmlgraphics.apache.org
Subject: RE: Memory usage and page numbering...
Date: Fri, 9 Aug 2013 09:02:44 +




Hi Bernard,

From my experience of trying to study the memory impact between builds, the 
getRuntime().freeMemory() method I found was very unreliable due to the nature 
of the JVM. I was getting back different results each time I ran it and even 
after purposefully modifying one build to run inefficiently, it returned the 
opposite to what I was expecting. As such, I ended up using a profiler which 
allowed me to break it down to see what was being run and identify memory hot 
spots and differences without being hampered by the somewhat random garbage 
collection.

Another method would be to generate and compare hprof dump output. There are a 
few tools out there to do this like the Eclipse Memory Analyzer [1]. To 
generate the dump, I just add the following to the FOP args:

-Xrunhprof:heap=sites,depth=depth required

Regards,

Robert Meyer

[1] http://www.eclipse.org/mat/

From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Memory usage and page numbering...
Date: Fri, 9 Aug 2013 15:20:15 +1000




Hi,
I have a Java desktop application, using embedded FOP to create PDFs from a 
data XML file and an XSLT file.  I wanted to see how much memory is being used, 
given the point about memory usage, page numbers and page totals 
(http://xmlgraphics.apache.org/fop/1.1/running.html#memory).
My PDF reports have a page N of TOTAL at the bottom right of each page and I 
wanted to see the memory usage and compare to no page numbers and just page 
numbers without totals.  I also used the two variations for page number totals 
(XSL 1.0 and XSL 1.1).
To work out the memory usage I computed the difference when calling 
Runtime.getRuntime().freeMemory() at the start and end of the render process.  
I ran each render variation 5 times from a shell script and each render kicked 
off a separate JVM to avoid any caching.  Regardless of whether I had page 
numbers or not, and page totals or not, it seemed the result is that there is 
no difference between having page numbers/totals or not.  Sometimes the memory 
usage was 50 MB and sometimes 200 MB.
I then used the sample code and data files from embedded FOP, 
http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_1/examples/embedding/.  
I modified the data XML file to contain lots of entries, giving a data file 
size of about 1 MB.  I also modified the XLST file to include pages numbers and 
then also page totals.  Again, I noticed no difference in memory usage.
Given the varying values for memory usage I'm seeing, I assume my quick and 
dirty method is inadequate.  I expected variation, but mostly to see far less 
memory usage when no page totals were used, but that's not the case.
Has anyone seen similar results?  Does using page totals really use THAT much 
more memory compared to not using page totals?
Thanks in advance,Bernard.  

  

Processing selected nodes...

2013-09-29 Thread Bernard Giannetti
Hi,
I'm using FOP, embedded in a desktop application, to create PDFs from a single 
data XML file using an XSLT file.
Say the data XML file is a list of items, for example:
items  itemapple  /item  itemorange  /item  itemwater 
melon  /item.../items
I want to be able to tell the XSLT to only process specific items (say apple 
and orange).
I've created a java.util.ArrayList and passed that to the transformer using 
setParameter( theList, theList ).  In the XSLT, when I use xsl:value-of 
select=$theList /, I'll get in the output  [apple, orange].  Fair enough.
However, what I really want (I think) is to take the array and iterate over it, 
calling a template for each item.  Is this possible?
From what I've managed to deduce from a lot of searching/reading is that it's 
possible even to pass in a Java object and somehow get XSLT to access that 
Java object.  I'm not sure if that is overkill for what I want to do, but I 
cannot even achieve processing a list of items one by one.

Thanks in advance,
Bernard.  

RE: Processing selected nodes...

2013-09-29 Thread Bernard Giannetti
Thanks Tim, et al - I was thinking that since I was passing a parameter from my 
FOP code, this was something to do with FOP.


From: t...@hillcountrysoftware.com
To: fop-users@xmlgraphics.apache.org
Subject: RE: Processing selected nodes...
Date: Sun, 29 Sep 2013 16:54:47 -0500

While this is the wrong list, I don’t see anything in your request that cannot 
be done using relatively simple XSLT. I would invite you to post your question 
on the XML Forum at Tek-Tips, where I have answered XSLT questions for years.  
That way, the answer might (might!) help someone else.  Registration is free, 
and it is absolutely the most spam-free environment you can 
imagine.http://www.tek-tips.com/threadminder.cfm?pid=426 Tom MorrisonHill 
Country Software From: Bernard Giannetti [mailto:thebernmeis...@hotmail.com] 
Sent: Sunday, September 29, 2013 1:23 AM
To: fop-users@xmlgraphics.apache.org
Subject: Processing selected nodes... Hi, I'm using FOP, embedded in a desktop 
application, to create PDFs from a single data XML file using an XSLT file. Say 
the data XML file is a list of items, for example: items  itemapple  
/item  itemorange  /item  itemwater melon  /item.../items
I want to be able to tell the XSLT to only process specific items (say apple 
and orange). I've created a java.util.ArrayList and passed that to the 
transformer using setParameter( theList, theList ).  In the XSLT, when I use 
xsl:value-of select=$theList /, I'll get in the output  [apple, orange].  
Fair enough. However, what I really want (I think) is to take the array and 
iterate over it, calling a template for each item.  Is this possible? From what 
I've managed to deduce from a lot of searching/reading is that it's possible 
even to pass in a Java object and somehow get XSLT to access that Java object.  
I'm not sure if that is overkill for what I want to do, but I cannot even 
achieve processing a list of items one by one.

Thanks in advance, Bernard.   

RE: Processing selected nodes...

2013-10-02 Thread Bernard Giannetti
FYI, I posted a question (and solution) at 
http://www.tek-tips.com/viewthread.cfm?qid=1719206.

From: thebernmeis...@hotmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Processing selected nodes...
Date: Sun, 29 Sep 2013 16:23:24 +1000




Hi,
I'm using FOP, embedded in a desktop application, to create PDFs from a single 
data XML file using an XSLT file.
Say the data XML file is a list of items, for example:
items  itemapple  /item  itemorange  /item  itemwater 
melon  /item.../items
I want to be able to tell the XSLT to only process specific items (say apple 
and orange).
I've created a java.util.ArrayList and passed that to the transformer using 
setParameter( theList, theList ).  In the XSLT, when I use xsl:value-of 
select=$theList /, I'll get in the output  [apple, orange].  Fair enough.
However, what I really want (I think) is to take the array and iterate over it, 
calling a template for each item.  Is this possible?
From what I've managed to deduce from a lot of searching/reading is that it's 
possible even to pass in a Java object and somehow get XSLT to access that 
Java object.  I'm not sure if that is overkill for what I want to do, but I 
cannot even achieve processing a list of items one by one.

Thanks in advance,
Bernard.
  

RE: png vs. jpg

2013-10-17 Thread Bernard Giannetti
Hi Luis,
I went to the page you provided (ImageLoaderRawPNG) and noticed in the config 
for application/pdf
xmlHandler mime=text/svg+xml/
I searched for xmlhandler and cannot find any reference to this tag (other than 
the page you gave).
I'm generating PDFs using embedded FOP (which include a small SVG image).  As a 
test, I generated a PDF with the tag in the FOP config and then without and I 
noticed no (obvious) difference in timing/memory.  Is this tag necessary...what 
does it do?

Thanks in advance,Bernard.

Date: Wed, 16 Oct 2013 23:44:52 +0100
From: lmpmberna...@gmail.com
To: fop-users@xmlgraphics.apache.org
Subject: Re: png vs. jpg


  

  
  

snip

  Yes, there is a difference. By default FOP uses a native image
  loader for JPG but not for PNG. There is however a native image
  loader for PNG too, which you can enable in the configuration
  file. See
  http://wiki.apache.org/xmlgraphics-fop/HowTo/ImageLoaderRawPNG for
  more info. Try it and I expect that you will see a performance
  improvement.
/snip   

RE: Table of Content

2014-03-19 Thread Bernard Giannetti
Hi Anastasya,
After a bit of Googling I found these...
http://stackoverflow.com/questions/7159747/xsl-fo-creating-dynamic-table-of-contents
http://stackoverflow.com/questions/7284236/xsl-fo-how-to-generate-table-of-contents
http://www.data2type.de/en/xml-xslt-xslfo/xsl-fo/examples-of-application/tables-of-contents-example-20/
http://www.xmlpdf.com/tableofcontents.html

Cheers,Bernard.

 Date: Mon, 17 Mar 2014 10:52:08 +0400
 From: anasta...@pdf3d.com
 To: fop-u...@xml.apache.org
 CC: supp...@pdf3d.com
 Subject: Table of Content
 
 Good Day!
 
 We are interested in using the FOP Apache application. But we require 
 the function of making Table of Contents and Index in the document. 
 Could you please tell us, is there a way to create a table of contents 
 and index in your program? As the only way to implement it, that we see, 
 is to create a simple table. Thank you for your answer!
 
 -- 
 Best regards, Anastasya.