Dear all,

It just works now, and I do not know why. I added some log.trace to the
source, recompiled, deployed, and "it" just worked. It finds the fonts now.
I suspect that I accidentally fixed jar problem in adding my code + traces
to the classpath of my app.

Thanks for your suggestions, this plus going into the source was really
helpful for my understanding of what fop does.
Cheers,
Wolfgang


On Sun, Sep 9, 2012 at 3:12 AM, Terence M. Bandoian <tere...@tmbsw.com>wrote:

> On 9/8/2012 5:22 PM, Müller, Wolfgang wrote:
>
>> Dear Sergiu, dear Terence,
>>
>> I am running grails in my home, so that is unfortunately not the problem.
>> I tried to set the home, which did not have any impact :-(.
>>
>> I am running the following code with log level trace for all classes org
>> and all classes com
>>
>> println "----START SHOWING JAVA-VISIBLE FONTS"
>> def l = java.awt.GraphicsEnvironment.**getLocalGraphicsEnvironment().**
>> getAllFonts();
>> for(def i:l){
>> println "FONT ${i}";
>> }
>> println "----START RUNNING TEST TRANSCODER"
>>         InputStream ins= new java.io.ByteArrayInputStream(**
>> svg.getBytes());
>> TranscoderInput transcoderInput = new TranscoderInput(ins);
>> TranscoderOutput transcoderOutput = new TranscoderOutput(new
>> ByteArrayOutputStream());// yes, i throw away the PDF
>> transcoder.transcode(**transcoderInput,**transcoderOutput);
>> println "----FINISH RUNNING TEST TRANSCODER"
>>
>>
>> The output I get is:
>>
>> ----START SHOWING JAVA-VISIBLE FONTS
>> FONT java.awt.Font[family=Serif,**name=Serif,style=plain,size=1]
>> FONT java.awt.Font[family=**SansSerif,name=SansSerif,**
>> style=plain,size=1]
>> [and much much more lines like that, effectively all my installed fonts]
>>
>> then
>>
>> ----START RUNNING TEST TRANSCODER
>> 2012-09-09 00:12:22,386 [pool-5-thread-1] TRACE pdf.PDFObject  -
>> Assigning org.apache.fop.pdf.PDFPages@**5196d617 object number 1
>> 2012-09-09 00:12:22,388 [pool-5-thread-1] TRACE pdf.PDFObject  -
>> Assigning org.apache.fop.pdf.PDFRoot@**40462f41 object number 2
>> 2012-09-09 00:12:22,389 [pool-5-thread-1] TRACE pdf.PDFObject  -
>> Assigning org.apache.fop.pdf.**PDFResources@4f1e7ad object number 3
>> 2012-09-09 00:12:22,390 [pool-5-thread-1] TRACE pdf.PDFObject  -
>> Assigning org.apache.fop.pdf.PDFInfo@**70f99830 object number 4
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.fop.image.loader.**batik.PreloaderWMF with
>> priority 1000
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.fop.image.loader.**batik.PreloaderSVG with
>> priority 1000
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.PreloaderTIFF with
>> priority 1000
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.PreloaderGIF with
>> priority 1000
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.PreloaderJPEG with
>> priority 1000
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.PreloaderBMP with
>> priority 1000
>> 2012-09-09 00:12:22,413 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.PreloaderEMF with
>> priority 1000
>> 2012-09-09 00:12:22,414 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.PreloaderEPS with
>> priority 1000
>> 2012-09-09 00:12:22,414 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**PreloaderImageIO
>> with priority 2000
>> 2012-09-09 00:12:22,419 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.fop.image.loader.**batik.ImageLoaderFactorySVG:
>> MIME = image/svg+xml, Flavor = text/xml;DOM;namespace=http://**
>> www.w3.org/2000/svg <http://www.w3.org/2000/svg>
>> 2012-09-09 00:12:22,419 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.fop.image.loader.**batik.ImageLoaderFactoryWMF:
>> MIME = image/x-wmf, Flavor = WMFRecordStore
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/jpeg, Flavor = RenderedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/jpeg, Flavor = BufferedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/png, Flavor = RenderedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/png, Flavor = BufferedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/x-png, Flavor = RenderedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/x-png, Flavor = BufferedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/vnd.wap.wbmp, Flavor = RenderedImage
>> 2012-09-09 00:12:22,428 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/vnd.wap.wbmp, Flavor = BufferedImage
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/bmp, Flavor = RenderedImage
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/bmp, Flavor = BufferedImage
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/gif, Flavor = RenderedImage
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.imageio.**ImageLoaderFactoryImageIO:
>> MIME = image/gif, Flavor = BufferedImage
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryRaw:
>> MIME = image/png, Flavor = image/png;Raw
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryRaw:
>> MIME = image/jpeg, Flavor = image/jpeg;Raw
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryRaw:
>> MIME = image/tiff, Flavor = image/tiff;Raw
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryRaw:
>> MIME = image/x-emf, Flavor = image/x-emf;Raw
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryRawCCITTFax:
>> MIME = image/tiff, Flavor = RawCCITTFax
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryEPS:
>> MIME = application/postscript, Flavor = application/postscript;Raw
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered org.apache.xmlgraphics.image.**loader.impl.**
>> ImageLoaderFactoryInternalTIFF**: MIME = image/tiff, Flavor =
>> RenderedImage
>> 2012-09-09 00:12:22,429 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered 
>> org.apache.xmlgraphics.image.**loader.impl.**ImageLoaderFactoryPNG:
>> MIME = image/png, Flavor = RenderedImage
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.fop.image.loader.**batik.ImageConverterSVG2G2D
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.fop.image.loader.**batik.ImageConverterG2D2SVG
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.fop.image.loader.**batik.ImageConverterWMF2G2D
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.xmlgraphics.image.**loader.impl.**
>> ImageConverterBuffered2Rendere**d
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.xmlgraphics.image.**loader.impl.**
>> ImageConverterG2D2Bitmap
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.xmlgraphics.image.**loader.impl.**
>> ImageConverterBitmap2G2D
>> 2012-09-09 00:12:22,433 [pool-5-thread-1] DEBUG spi.ImageImplRegistry  -
>> Registered: org.apache.xmlgraphics.image.**loader.impl.**
>> ImageConverterRendered2PNG
>> 2012-09-09 00:12:22,448 [pool-5-thread-1] DEBUG
>> fonts.DefaultFontConfigurator  - Starting font configuration...
>> 2012-09-09 00:12:22,449 [pool-5-thread-1] DEBUG
>> fonts.DefaultFontConfigurator  - Finished font configuration in 1ms
>> 2012-09-09 00:12:22,472 [pool-5-thread-1] DEBUG fonts.FontInfo  -
>> Registering: any,normal,400 under F5
>> 2012-09-09 00:12:22,472 [pool-5-thread-1] DEBUG fonts.FontInfo  -
>> Registering: any,italic,400 under F6
>> 2012-09-09 00:12:22,472 [pool-5-thread-1] DEBUG fonts.FontInfo  -
>> Registering: any,oblique,400 under F6
>> 2012-09-09 00:12:22,472 [pool-5-thread-1] DEBUG fonts.FontInfo  -
>> Registering: any,normal,700 under F7
>> 2012-09-09 00:12:22,472 [pool-5-thread-1] DEBUG fonts.FontInfo  -
>> Registering: any,italic,700 under F8
>> [...]
>>
>> These are the PDF default fonts, AFAICS.
>> In any case I am noting that I do not see any cache building in the trace
>> log.
>>
>> Any more suggestions?
>>
>> Many thanks for your help so far :-)
>>
>> Cheers,
>> Wolfgang
>>
>>
>> On Sat, Sep 8, 2012 at 5:42 PM, Terence M. Bandoian 
>> <tere...@tmbsw.com<mailto:
>> tere...@tmbsw.com>> wrote:
>>
>>     On 9/8/2012 9:08 AM, Sergiu Dumitriu wrote:
>>
>>         On 09/08/2012 04:10 AM, Müller, Wolfgang wrote:
>>
>>             Hi all,
>>             I want to generate some PDF from SVG via fop/batik from
>>             inside a web
>>             application. I am using the Grails framework, BTW. Grails
>>             runs its
>>             webapps inside a tomcat.
>>
>>             Exec summary: Something works as a script, does not work
>>             in the tomcat,
>>             need idea where things could go wrong. PDF gets generated
>>             both times,
>>             but no custom fonts when using webapp.
>>
>>             Long version: I took some of the sample code, wrote a
>>             small Groovy
>>             script that creates a transformer (no, i.e. default
>>             configuration),
>>             feeds it with the proper input/output streams and creates
>>             the output.
>>             Fonts are correct in the file generated. I also get plenty
>>             of output
>>             that shows that fop is configuring its fonts from the
>>             fonts on my
>>             machine. Great stuff.
>>
>>             It also generates a .fop directory in my home and puts
>>             font caches in there.
>>
>>             Great.
>>
>>             Webapp: Now, for testing, I put a subset of the code into the
>>             bootstrapping code of the  webapp. It creates a transcoder and
>>             transcodes an example svg string. It does a default font
>>             configuration,
>>             but completely ignores the fonts on my machine and also
>>             does not create
>>             anywhere a .fop directory.
>>
>>
>>         Depending on how your tomcat is configured, one problem that
>>         I've encountered in the past is that on some Linux
>>         distributions Tomcat runs as the "tomcat" user, and that user
>>         doesn't have a home folder where it can write. FOP tries to
>>         create a .fop directory in the home folder of the current
>>         user, and since that's not possible, it fails to register fonts.
>>
>>         Just to check if this is what's happening in your case, you
>>         could configure tomcat to run as the root user. However, for
>>         security reasons don't just leave it running as root, switch
>>         back to the tomcat user and try configure a writable home
>>         directory for it.
>>
>>         Another possible cause is that you didn't specify an absolute
>>         path to the custom fonts, and FOP looks for them starting from
>>         a different directory.
>>
>>              From the documentation I did not really understand what
>>             happens. Also
>>             setting log level to trace does not help.
>>
>>             Any suggestions? I would also be thankful for points of
>>             documentation
>>             where I could learn more. I thought "fontconfig" would be
>>             the place, but
>>             I don't see my problem represented there.
>>
>>             Cheers,
>>             Wolfgang
>>
>>
>>
>>
>>     Hi, Wolfgang-
>>
>>     You might also try defining user.home as a system property of the
>>     Tomcat JVM (e.g. -Duser.home=c:\fop) and checking to ensure the
>>     Tomcat user has write access to that directory.
>>
>>     -Terence Bandoian
>>
>>
>>
>>     ------------------------------**------------------------------**
>> ---------
>>     To unsubscribe, e-mail:
>>     
>> fop-users-unsubscribe@**xmlgraphics.apache.org<fop-users-unsubscr...@xmlgraphics.apache.org>
>>     
>> <mailto:fop-users-unsubscribe@**xmlgraphics.apache.org<fop-users-unsubscr...@xmlgraphics.apache.org>
>> >
>>
>>     For additional commands, e-mail:
>>     
>> fop-users-help@xmlgraphics.**apache.org<fop-users-h...@xmlgraphics.apache.org>
>>     
>> <mailto:fop-users-help@**xmlgraphics.apache.org<fop-users-h...@xmlgraphics.apache.org>
>> >
>>
>>
>>
> Hi, Wolfgang-
>
> If FOP is building the font cache, I believe you should see a file named
> fop-fonts.cache in the home directory.
>
>
> -Terence Bandoian
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: 
> fop-users-unsubscribe@**xmlgraphics.apache.org<fop-users-unsubscr...@xmlgraphics.apache.org>
> For additional commands, e-mail: 
> fop-users-help@xmlgraphics.**apache.org<fop-users-h...@xmlgraphics.apache.org>
>
>

Reply via email to