Alexios Giotis | 8 Feb 16:30
Picon
Gravatar

Producing & archiving FOP intermediate format

Hi,

I am already storing some millions per month of files containing FOP intermediate format (FOP_IF) using a
private patched branch based on FOP 1.0. The current use case is performance. If a document is found in the
store containing FOP_IF, then use it and create the final output format (typically PDF). If not, then
start from XML. The retention period of the FOP_IF files is 6 months to 1 year. The XML files are kept for at
least 10 years. In my tests, 85% of the time is spent on the layout and the rest for rendering. This has worked
well, especially for big documents (with thousands of pages). I have no worries about the FOP_IF format
and how it will evolve as I know that they will be gone after 6 months or one year max. And for sure, I can keep an
older version for that long. 

I am now planing to use FOP in different ways and use cases such as:

1. Bypassing FOP's layout engine and it's quirks in XSL:FO input, cpu-time and memory. This means directly
creating FOP_IF. With the same effort, I could use PDFBox (or iText 2.x) to create PDF files. But having
FOP_IF, I also produce AFP, PS and PCL which I need and I know no other open sources renderers.

2. Longer storage of FOP_IF. Compared to storing XML, it's faster, less components are involved until the
final output and it allows for easier versioning. For example, given the same XSL:FO input, FOP 2.0 will
not produce the *identical* content as FOP 1.0 (I hope somebody will disagree to this :) Compared to
storing PDF, the required space is much less as I have big volumes on expensive EMC storage. Secondly I
retain the flexibility on selecting parts to render. Not all users have the permissions to see all parts of
the documents. Also, some users see masked values (e.g. stars in place of a card number).

For both cases, I really need to know your thoughts and plans for FOP_IF. Watching the lists the last 2 years,
I have not noticed anything related to it.

Greetings,
Alexios Giotis
(Continue reading)

Picon

RE: Problem that could lose me my job

OK I think I have sorted out the image url issue now when I run the pdf it shows the following warnings

2012-02-08 09:37:39,131 [pool-1-thread-1] WARN  uk.co.inbrand.fopengine.FopEngine - Before Instantiation

2012-02-08 09:37:39,156 [pool-1-thread-1] WARN  uk.co.inbrand.fopengine.FopEngine - After Instantiation

2012-02-08 09:37:54,758 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Line 1 of a paragraph overflows the available area by 11339 millipoints. (See position 51:11)

2012-02-08 09:37:54,768 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Content overflows the viewport of an fo:block-container in block-progression direction by 17123 millipoints. (See position 50:90)

2012-02-08 09:37:54,794 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Content overflows the viewport of an fo:block-container in block-progression direction by 5784 millipoints. (See position 637:92)

2012-02-08 09:37:57,192 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Line 1 of a paragraph overflows the available area by 11339 millipoints. (See position 682:11)

2012-02-08 09:37:57,193 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Content overflows the viewport of an fo:block-container in block-progression direction by 17123 millipoints. (See position 681:91)

2012-02-08 09:37:57,487 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Line 1 of a paragraph overflows the available area by 11339 millipoints. (See position 1358:11)

2012-02-08 09:37:57,488 [pool-1-thread-2] WARN  org.apache.fop.apps.FOUserAgent - Content overflows the viewport of an fo:block-container in block-progression direction by 17123 millipoints. (See position 1357:91)

 

But it is still not creating a valid PDF

I am getting image errors in the info log still where it can’t find an importer or convertor. What jars do I need for jpg files?

I have batik and XMLGraphics-Commons-1.4

Is there any other jar I need – like JAI? And if so what are the maven dependencies I need?

 

 

 

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer


From: Craig Ringer [mailto:ringerc <at> ringerc.id.au]
Sent: 08 February 2012 03:56
To: fop-users <at> xmlgraphics.apache.org
Cc: Luis Ferro
Subject: Re: Problem that could lose me my job

 

On 08/02/12 03:23, Luis Ferro wrote:

Hmmm... why not installing those files in a local webserver?

That way you would have a proper uri (http://localhost/etc...)

file:/// is a proper URI, it's just not a URL. Fop only requires resolvable URIs and doesn't really care where they come from.

Using HTTP would add transfer overhead and slow things down for little if any benefit. I don't really see the point, when fixing the URI syntax to conform to correct file URI syntax is all that's required here.

--
Craig Ringer

Picon

RE: Generating a PDF by drawing to PDFDocumentGraphics2D

The usual way we create PDFs is via XML/XSL into a .fo file which is then "compiled" into the pdf.

Example of the code 
public File generatePDFFromXml(File xslFile,File xmlFile) {
        BufferedOutputStream out = null;
        File tempFile = null;
            fopFactory.setStrictValidation(false);
            DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
            Configuration cfg = cfgBuilder.buildFromFile(new File("fopconfig.xml"));
            fopFactory.setUserConfig(cfg);

            tempFile = File.createTempFile("W2P", ".pdf");
            out = new BufferedOutputStream(new FileOutputStream(tempFile));
            FOUserAgent useragent= fopFactory.newFOUserAgent();
            useragent.setOutputFile(tempFile);
            useragent.setTargetResolution(300);
            System.out.println("Creating New Fop");
            long timer = System.currentTimeMillis();
            Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
            System.out.println("Creation of Fop took "+(System.currentTimeMillis()-timer)+" Miliseconds");
            TransformerFactory factory = TransformerFactory.newInstance();
            Source xslt = new StreamSource(xslFile);
            Transformer transformer = factory.newTransformer(xslt);
            Source src = new StreamSource(xmlFile);
            Result res = new SAXResult(fop.getDefaultHandler());
            System.out.println("Creating PDF");
            timer = System.currentTimeMillis();            
            transformer.transform(src, res);
            System.out.println("Creation of PDF took "+(System.currentTimeMillis()-timer)+" Miliseconds");
           out.flush();
           out.close();
}

The XSL and xml can do most anything but a snippet is below of the xsl

<fo:page-sequence master-reference="propdetails">
	<fo:static-content flow-name="xsl-region-before">
		<fo:block-container position="absolute" top="0mm" left="0mm" width="210mm" height="49mm" >
			<xsl:call-template name="property_header">
				<xsl:with-param name="width">214</xsl:with-param>
				<xsl:with-param name="height">53</xsl:with-param>
			</xsl:call-template>
		</fo:block-container>
		<fo:block-container position="absolute" top="56mm" left="11mm" width="188mm" height="113mm" overflow="hidden">
			<fo:block>
				<xsl:variable name="picurl">
					<xsl:value-of select="/document/data/body/descendant-or-self::*[@id='large']/@src"/>
				</xsl:variable>
				<fo:external-graphic width="188mm" height="113mm" content-width="188mm"
content-height="auto" scaling-method="resample-any-method" src="{$picurl}" />
			</fo:block>
		</fo:block-container>
		<fo:block-container position="absolute" top="173mm" left="10mm" width="57mm" height="22mm">
			<fo:block>
				<fo:instream-foreign-object>
					<svg:svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
					 version="1.1" width="57mm" height="22mm" id="roundedbox" viewbox="0 0 57 22"> <g>
					 <rect x="0mm" y="0mm" width="57mm" height="22mm" rx="5" ry="5" style="stroke: white; fill: #005924;"/>
					</g>
				</svg:svg>
				</fo:instream-foreign-object>
			</fo:block>

Hope this helps.

Kindest regards

Theresa Forster
Senior Software Developer

-----Original Message-----
From: Konstantin Preißer [mailto:verlag.preisser <at> t-online.de] 
Sent: 07 February 2012 12:20
To: fop-users <at> xmlgraphics.apache.org
Subject: Generating a PDF by drawing to PDFDocumentGraphics2D

Hi all,

I'm sorry if this is the wrong place for my question.

I was seaching for a way to dynamically generate a PDF in Java code by drawing to a Graphics2D object. When I
googled this, I found Apache FOP 1.0 which has a org.apache.fop.svg.PDFDocumentGraphics2D class
(derived from Graphics2D), which seems to support dynamically generating a PDF by drawing to it.

E.g., I use code like this to generate a PDF and write it to an OutputStream (using Java 1.7):

    PDFDocumentGraphics2D g = new PDFDocumentGraphics2D(false, out, 842, 595);

    g.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());

    g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
    g.drawLine(10, 10, 100, 100);
    g.drawString("Hi!", 30, 30);

    g.nextPage(); // switch to next page

    g.drawString("This is the 2nd page.", 30, 30);

    g.finish();
    g.dispose();

This seems to be working really well, using the integrated PDF Fonts.

However, I now have the problem that these integrated fonts seem not to support Unicode characters, e.g. if
I use

g.drawString("\u263a", 30, 30);

then the Character is substituted by a "#" and a warning is printed:

Feb 07, 2012 1:10:11 PM org.apache.fop.fonts.Typeface warnMissingGlyph
Warnung: Glyph 9786 (0x263a, smileface) not available in font Helvetica

So, I was searching for a way to embed a TTF font in the PDF. However, I wasn't successful finding information
about it, as it seems the FOP documentation and examples are only about XSL-FO (which I don't know much
about, as I only need to generate PDFs by drawing to a Graphics2D), but using a PDFDocumentGraphics2D
seems not to be well-documented. So I'm not sure if this is even an intended way to use FOP, or if there are
other/better solutions to generate a PDF by drawing to a Graphics2D object in Java.

My questions are:
Is using FOP for generating a PDF by drawing to a Graphics2D a recommended way?
Is it possible to embed TTF fonts when drawing to a PDFDocumentGraphics2D object? If yes, how?

Thanks!

Best Regards,
Konstantin Preißer

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe <at> xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help <at> xmlgraphics.apache.org
Picon
Favicon
Gravatar

Generating a PDF by drawing to PDFDocumentGraphics2D

Hi all,

I'm sorry if this is the wrong place for my question.

I was seaching for a way to dynamically generate a PDF in Java code by drawing to a Graphics2D object. When I
googled this, I found Apache FOP 1.0 which has a org.apache.fop.svg.PDFDocumentGraphics2D class
(derived from Graphics2D), which seems to support dynamically generating a PDF by drawing to it.

E.g., I use code like this to generate a PDF and write it to an OutputStream (using Java 1.7):

    PDFDocumentGraphics2D g = new PDFDocumentGraphics2D(false, out, 842, 595);

    g.setGraphicContext(new org.apache.xmlgraphics.java2d.GraphicContext());

    g.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
    g.drawLine(10, 10, 100, 100);
    g.drawString("Hi!", 30, 30);

    g.nextPage(); // switch to next page

    g.drawString("This is the 2nd page.", 30, 30);

    g.finish();
    g.dispose();

This seems to be working really well, using the integrated PDF Fonts.

However, I now have the problem that these integrated fonts seem not to support Unicode characters, e.g. if
I use

g.drawString("\u263a", 30, 30);

then the Character is substituted by a "#" and a warning is printed:

Feb 07, 2012 1:10:11 PM org.apache.fop.fonts.Typeface warnMissingGlyph
Warnung: Glyph 9786 (0x263a, smileface) not available in font Helvetica

So, I was searching for a way to embed a TTF font in the PDF. However, I wasn't successful finding information
about it, as it seems the FOP documentation and examples are only about XSL-FO (which I don't know much
about, as I only need to generate PDFs by drawing to a Graphics2D), but using a PDFDocumentGraphics2D
seems not to be well-documented. So I'm not sure if this is even an intended way to use FOP, or if there are
other/better solutions to generate a PDF by drawing to a Graphics2D object in Java.

My questions are:
Is using FOP for generating a PDF by drawing to a Graphics2D a recommended way?
Is it possible to embed TTF fonts when drawing to a PDFDocumentGraphics2D object? If yes, how?

Thanks!

Best Regards,
Konstantin Preißer
Picon

RE: Problem that could lose me my job

Thank you for all your time guys,  I was being a clutz, Unbeknown to me all ERRORS were being pushed into a separate file – (I didn’t put together the log.properties )

 

In the error log I am getting an exception as below. So it is having problems getting the images, so at least I have somewhere to look

 

 

2012-02-03 15:20:41,503 [pool-1-thread-2] ERROR org.apache.fop.apps.FopFactory - Attempt to resolve URI 'C:\InBrand\preprocessor\filestore\img3525450795559698480.jpg' failed:

javax.xml.transform.TransformerException: Error with URL; base 'file:/C:/InBrand/preprocessor/filestore/' href 'C:\InBrand\preprocessor\filestore\img3525450795559698480.jpg'

                at org.apache.fop.apps.FOURIResolver.handleException(FOURIResolver.java:141)

                at org.apache.fop.apps.FOURIResolver.resolve(FOURIResolver.java:272)

                at org.apache.fop.apps.FopFactory.resolveURI(FopFactory.java:753)

                at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:425)

                at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:398)

                at org.apache.fop.apps.FOUserAgent$1.resolveURI(FOUserAgent.java:141)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:77)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:280)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:122)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:123)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:282)

                at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)

                at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)

                at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)

                at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)

                at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)

                at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

                at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

                at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

                at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

                at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

                at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

                at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

                at uk.co.inbrand.fopengine.FopEngine.generatePDFromFO(FopEngine.java:197)

                at uk.co.inbrand.fopengine.FopProcessor.run(FopProcessor.java:50)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:619)

Caused by: java.net.MalformedURLException: unknown protocol: c

                at java.net.URL.<init>(URL.java:574)

                at java.net.URL.<init>(URL.java:464)

                at org.apache.fop.apps.FOURIResolver.resolve(FOURIResolver.java:270)

                ... 28 more

---------

java.net.MalformedURLException: unknown protocol: c

                at java.net.URL.<init>(URL.java:574)

                at java.net.URL.<init>(URL.java:464)

                at org.apache.fop.apps.FOURIResolver.resolve(FOURIResolver.java:270)

                at org.apache.fop.apps.FopFactory.resolveURI(FopFactory.java:753)

                at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:425)

                at org.apache.fop.apps.FOUserAgent.resolveURI(FOUserAgent.java:398)

                at org.apache.fop.apps.FOUserAgent$1.resolveURI(FOUserAgent.java:141)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.newSource(AbstractImageSessionContext.java:77)

                at org.apache.xmlgraphics.image.loader.impl.AbstractImageSessionContext.needSource(AbstractImageSessionContext.java:280)

                at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:123)

                at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:122)

                at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)

                at org.apache.fop.fo.FObj.processNode(FObj.java:123)

                at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:282)

                at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:171)

                at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)

                at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)

                at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)

                at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)

                at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)

                at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)

                at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

                at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)

                at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)

                at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)

                at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)

                at uk.co.inbrand.fopengine.FopEngine.generatePDFromFO(FopEngine.java:197)

                at uk.co.inbrand.fopengine.FopProcessor.run(FopProcessor.java:50)

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)

                at java.lang.Thread.run(Thread.java:619)

2012-02-03 15:20:41,511 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: C:\InBrand\preprocessor\filestore\img3525450795559698480.jpg. (See position 1306:199)

2012-02-03 15:20:41,672 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not available. URI: . Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for  (See position 1336:137)

2012-02-03 15:20:41,687 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: . (See position 1341:137)

 

Kindest regards

 


Theresa Forster

Senior Software Developer

Pascal Sancho | 6 Feb 17:38
Picon
Favicon

Re: crop marks in apache fop...

Hi Philip,

Unless there is copyright limitation, please don't ask privately a
question that can help everyone on Fop User list, *all* FOP usage
related questions are relevant there.

That said, what you cited is a short snippet that should be used in
XSLT, within a static region:
<fo:static-content flow-name="xsl-region-start">
  <!-- put normal static content here -->
  <xsl:call-template name="cropAndCenterMark"/>
</fo:static-content>

You can use the file attached in cited thread directly, by using a
xsl:include statement in your favorite XSLT:
the file RO_bogst_N.xsl, reading your command line args.

Le 06/02/2012 15:53, Philip Diderichsen a écrit :
> Hi Pascal,
> I read your comments at gmane about crop marks in fop (here:
> http://comments.gmane.org/gmane.text.xml.fop.user/32541).
>  
> Well - I'm a newbie at this! You posted an xsl file, and I kind of
> understand what it does - ALMOST. (Generates svgs of crop marks, puts
> them in the right place..) What I don't understand is how/when do you
> actually employ that file in the generation of a pdf file?
>  
> So basically, my question is this... I run fop with the standard
> command, like so:
> fop -c C:\Programs\fop-1.0\conf\fop-conf.xml -xml RO_bogst_N.xml -xsl
> RO_bogst_N.xsl -pdf N.pdf
>  
> When in the process is your xsl file employed? Should it be embedded in
> my xsl file, or what?
>  
> I hope my question is a dumb one so that it will be easy to answer... ;-)
>  
> Appreciate it,
> Philip
>  
> I pasted your xsl here for convenience:
>  
>  
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:transform version="1.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:fo="http://www.w3.org/1999/XSL/Format">
>  
> <xsl:variable name="pageWidth" select="210"/>
> <xsl:variable name="pageHeight" select="297"/>
>  
> <xsl:template name="cropAndCenterMark">
>   <xsl:variable name="Wmm" select="concat($pageWidth,'mm')"/>
>   <xsl:variable name="Hmm" select="concat($pageHeight,'mm')"/>
>   <!-- bottom-right -->
>   <xsl:call-template name="cropMark">
>     <xsl:with-param name="x" select="$Wmm"/>
>     <xsl:with-param name="y" select="$Hmm"/>
>     <xsl:with-param name="rotation" select="0"/>
>   </xsl:call-template>
>   <!-- top-right -->
>   <xsl:call-template name="cropMark">
>     <xsl:with-param name="x" select="$Wmm"/>
>     <xsl:with-param name="y" select="'0mm'"/>
>     <xsl:with-param name="rotation" select="90"/>
>   </xsl:call-template>
>   <!-- top-left -->
>   <xsl:call-template name="cropMark">
>     <xsl:with-param name="x" select="'0mm'"/>
>     <xsl:with-param name="y" select="'0mm'"/>
>     <xsl:with-param name="rotation" select="180"/>
>   </xsl:call-template>
>   <!-- bottom-left -->
>   <xsl:call-template name="cropMark">
>     <xsl:with-param name="x" select="'0mm'"/>
>     <xsl:with-param name="y" select="$Hmm"/>
>     <xsl:with-param name="rotation" select="270"/>
>   </xsl:call-template>
>   <!-- bottom -->
>   <xsl:call-template name="centerMark">
>     <xsl:with-param name="x" select="'0mm'"/>
>     <xsl:with-param name="y" select="$Hmm"/>
>     <xsl:with-param name="w" select="$Wmm"/>
>     <xsl:with-param name="rotation" select="0"/>
>   </xsl:call-template>
>   <!-- right -->
>   <xsl:call-template name="centerMark">
>     <xsl:with-param name="x" select="$Wmm"/>
>     <xsl:with-param name="y" select="$Hmm"/>
>     <xsl:with-param name="w" select="$Hmm"/>
>     <xsl:with-param name="rotation" select="90"/>
>   </xsl:call-template>
>   <!-- top -->
>   <xsl:call-template name="centerMark">
>     <xsl:with-param name="x" select="$Wmm"/>
>     <xsl:with-param name="y" select="'0mm'"/>
>     <xsl:with-param name="w" select="$Wmm"/>
>     <xsl:with-param name="rotation" select="180"/>
>   </xsl:call-template>
>   <!-- left -->
>   <xsl:call-template name="centerMark">
>     <xsl:with-param name="x" select="'0mm'"/>
>     <xsl:with-param name="y" select="'0mm'"/>
>     <xsl:with-param name="w" select="$Hmm"/>
>     <xsl:with-param name="rotation" select="270"/>
>   </xsl:call-template>
> </xsl:template>
>  
> <xsl:template name="cropMark">
>   <xsl:param name="x" select="'0mm'"/>
>   <xsl:param name="y" select="'0mm'"/>
>   <xsl:param name="rotation" select="0"/>
>   <xsl:variable name="offsetX">
>     <xsl:if test="$rotation=180 or $rotation=270"> - 30pt</xsl:if>
>   </xsl:variable>
>   <xsl:variable name="offsetY">
>     <xsl:if test="$rotation=90 or $rotation=180"> - 30pt</xsl:if>
>   </xsl:variable>
>   <fo:block-container absolute-position="absolute"
>       left="{$x}{$offsetX}" top="{$y}{$offsetY}"
>       width="30pt" height="30pt" reference-orientation="{$rotation}">
>     <fo:block font-size="0pt">
>       <fo:instream-foreign-object content-width="30pt"
> content-height="30pt">
>         <svg xmlns="http://www.w3.org/2000/svg"
>           width="30" height="30" viewBox="0 0 30 30">
>           <g style="stroke:black;stroke-width:0.25">
>             <line x1="6" y1="0" x2="30" y2="0"/>
>             <line x1="0" y1="6" x2="0" y2="30"/>
>           </g>
>         </svg>
>       </fo:instream-foreign-object>
>     </fo:block>
>   </fo:block-container>
> </xsl:template>
>  
> <xsl:template name="centerMark">
>   <xsl:param name="x" select="'0mm'"/>
>   <xsl:param name="y" select="'0mm'"/>
>   <xsl:param name="w" select="'0mm'"/>
>   <xsl:param name="rotation" select="0"/>
>   <xsl:variable name="offsetX">
>     <xsl:choose>
>       <xsl:when test="$rotation=180">
>         <xsl:text> - </xsl:text>
>         <xsl:value-of select="$w"/>
>       </xsl:when>
>       <xsl:when test="$rotation=270"> - 30pt</xsl:when>
>     </xsl:choose>
>   </xsl:variable>
>   <xsl:variable name="offsetY">
>     <xsl:choose>
>       <xsl:when test="$rotation=90">
>         <xsl:text> - </xsl:text>
>         <xsl:value-of select="$w"/>
>       </xsl:when>
>       <xsl:when test="$rotation=180"> - 30pt</xsl:when>
>     </xsl:choose>
>   </xsl:variable>
>   <fo:block-container absolute-position="absolute"
>       left="{$x}{$offsetX}" top="{$y}{$offsetY}"
>       width="{$w}" height="30pt" reference-orientation="{$rotation}"
>       text-align="center" display-align="after">
>     <fo:block font-size="0pt">
>       <fo:instream-foreign-object content-width="48pt"
> content-height="24pt">
>         <svg xmlns="http://www.w3.org/2000/svg"
>           width="48" height="24" viewBox="0 0 48 24">
>           <g style="fill: none; stroke:black; stroke-width:0.25;">
>             <line x1="0" y1="12" x2="48" y2="12"/>
>             <line x1="24" y1="0" x2="24" y2="24"/>
>             <circle cx="24" cy="12" r="6"/>
>           </g>
>         </svg>
>       </fo:instream-foreign-object>
>     </fo:block>
>   </fo:block-container>
> </xsl:template>
> </xsl:transform>

--

-- 
Pascal
Picon

Problem that could lose me my job

I have just come across a problem that may lose me my job unless I can resolve it.

1.       I am using Fop-1.0

2.       I create PDFs and then view them in Sumatra PDF – perfectly fine

3.       Try to open the same file in Adobe Acrobat – it reports that the file is corrupt and cannot be repaired..

 

Help please.

 

Kindest regards

 


Theresa Forster

Senior Software Developer

 

Mike Ferrando | 3 Feb 05:36
Picon
Favicon
Gravatar

(unknown)


http://schnorchel61.sc.funpic.de/dji/481353.html
vijay kumar | 2 Feb 20:56
Picon
Gravatar

is xmlgraphics-commons-1.4.jar compatible with FOP0.95

Hi Experts,
I would like to check,
is it ok to say, xmlgraphics-commons-1.4.jar is compatible with FOP0.95
by default FOP0.95 is packaged with xmlgraphics-commons-1.3.1.jar

But, i wanted to use xmlgraphics-commons-1.4  with FOP0.95

as i do not see any documentation that says,  any compatibility issues , also i do not see any issues in my usage.
could you please confirm this.

Thanks & Regards,
Vijay



Picon

Batik Problems

Ok I have solved my batik issue, apparently you cannot use one-jar to create a standalone jar as it cannot get the default CSS and XSD files from the library batik jars.

 

So changing to using maven assembly plugin it now puts the jars in unpacked, so the classes and files are available.

Now the images are not working….

 

2012-02-02 11:43:22,638 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: \InBrand\preprocessor\filestore\img3980813249191582957.jpg. (No context info available)

2012-02-02 11:43:22,638 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: \InBrand\preprocessor\filestore\img3980813249191582957.jpg. (No context info available)

 

I have the BASEURL set in the fopconfig.xml file as “/”

I also tried accessing them as explicit paths

 

2012-02-02 11:56:54,428 [pool-1-thread-4] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: C:\InBrand\preprocessor\filestore\img4930914128352311319.jpg. (No context info available)

2012-02-02 11:56:54,428 [pool-1-thread-4] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: C:\InBrand\preprocessor\filestore\img4930914128352311319.jpg. (No context info available)

 

I just saw the following in the logs… Why is it trying to load a jpg as an SVG?

 

2012-02-02 11:48:19,973 [pool-1-thread-2] DEBUG org.apache.fop.image.loader.batik.PreloaderSVG - Error while trying to load stream as an SVG file: Invalid byte 1 of 1-byte UTF-8 sequence.

2012-02-02 11:48:19,973 [pool-1-thread-2] DEBUG org.apache.fop.image.loader.batik.PreloaderSVG - Error while trying to load stream as an SVG file: Invalid byte 1 of 1-byte UTF-8 sequence.

2012-02-02 11:48:19,974 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not available. URI: \InBrand\preprocessor\filestore\img3970845222913192771.jpg. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for \InBrand\preprocessor\filestore\img3970845222913192771.jpg (See position 1296:195)

2012-02-02 11:48:19,974 [pool-1-thread-2] ERROR org.apache.fop.apps.FOUserAgent - Image not available. URI: \InBrand\preprocessor\filestore\img3970845222913192771.jpg. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for \InBrand\preprocessor\filestore\img3970845222913192771.jpg (See position 1296:195)

 

 

Can anyone suggest why this was working and now is not?

 

Kindest regards

 


Theresa Forster

Senior Software Developer


 

Picon

Problem with SVGs on different servers

I have an application being compiled with Maven and packaged by one-jar,

It works fine locally on Java 1.6.0_26

 

When I put it on the live server running Java 1.6.0_27 the PDFS are missing the SVG files,

 

I have batik 1.7 in the jar  and am using fop-1.0.jar in there as well,

Avalon-framework-impl/api 4.3.1

Avalon-framework-4.1.3

 

Why would it work on one machine and not on the other?

 

The fop is not running in tomcat but the one that is not working is 5.5 the local one is 7.0.14

 

Kindest regards

 


Theresa Forster

Senior Software Developer

 


Gmane