FopFactory in Trunk

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

FopFactory in Trunk

Bonekrusher
Hi,

I am not sure if this is a change in 1.1 or the trunk, but on the newInstance() Method on the static class FopFactory, it now requires an argument that interfaces the FopFactoryConfig() class.

private FopFactory fopFactory = FopFactory.newInstance(new MyFopFactoryConfig());

By chance is there any sample code to do a simple transformation?

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Alexios Giotis
Hi,

I guess you are looking for something like this:

http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-1_1/examples/embedding/java/embedding/ExampleXML2PDF.java?revision=1398854&view=co

Alexios Giotis

On 7 Apr 2013, at 03:54, Bonekrusher <[hidden email]> wrote:

> Hi,
>
> I am not sure if this is a change in 1.1 or the trunk, but on the
> newInstance() Method on the static class FopFactory, it now requires an
> argument that interfaces the FopFactoryConfig() class.
>
> private FopFactory fopFactory = FopFactory.newInstance(new
> MyFopFactoryConfig());
>
> By chance is there any sample code to do a simple transformation?
>
> Thanks.
>
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/FopFactory-in-Trunk-tp38261.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Bonekrusher
Hi Alexios,

The link is outdated. The example will not compile using the trunk because there is no longer a method called newInstance that takes Zero arguments. This looks like a major change in the trunk.

FopFactory fopFactory = FopFactory.newInstance();

Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Luis Bernardo
Yes, this change was major and happened many months ago.

You have to do something like this:

        String contFile = "/path/to/fop.xconf";
        FopFactoryBuilder builder = new FopConfParser(new File(confFile)).getFopFactoryBuilder();
        builder.setStrictFOValidation(false);
        FopFactory fopFactory = builder.build();

I will update the example to have have at least one that uses the conf file.




On Tue, Apr 9, 2013 at 1:20 PM, Bonekrusher <[hidden email]> wrote:
Hi Alexios,

The link is outdated. The example will not compile using the trunk because
there is no longer a method called newInstance that takes Zero arguments.
This looks like a major change in the trunk.

FopFactory fopFactory = FopFactory.newInstance();





--
View this message in context: http://apache-fop.1065347.n5.nabble.com/FopFactory-in-Trunk-tp38261p38276.html
Sent from the FOP - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Bonekrusher
Thanks Luis.

By chance do you know what version for JAI is used to render graphics is trunk? I can not seem to find the right version.
Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Luis Bernardo
I assume you refer to the jai_imageio.jar file. FOP does not depend on a particular version. If the jar is available FOP may use it for some particular formats. If it is not available, then FOP falls back to the default image handler, if there is one, which may work or not (i.e., may work for some image subtypes but not others).

If you provide your image maybe we can investigate what the problem is.


On Tue, Apr 9, 2013 at 2:53 PM, Bonekrusher <[hidden email]> wrote:
Thanks Luis.

By chance do you know what version for JAI is used to render graphics is
trunk? I can not seem to find the right version.



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/FopFactory-in-Trunk-tp38261p38279.html
Sent from the FOP - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Bonekrusher
Hi Luis,

Yes I am talking about jai_imageio.jar. However I have put the jai file in my class path and get this error. I am also attaching the image. Thanks for the help.

SEVERE: Image not available. URI: file:/Users/Content/Media/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png. Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for file:/Users/Content/Media/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png (See position 1224:-1)
org.apache.xmlgraphics.image.loader.ImageException: The file format is not supported. No ImagePreloader found for file:/Users/Content/Media/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png
        at org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:181)
        at org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:128)
        at org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)
        at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
        at org.apache.fop.fo.FObj.processNode(FObj.java:128)
        at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)

Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Luis Bernardo
PNG is a format FOP can handle well without the need fop the jai_imageio.jar. In any case, the presence of the jar in the classpath should not cause a problem. I just tried your image with trunk and had no problems. I assume you have no constraints in the conf file (if using one) regarding image loading. 


On Wed, Apr 10, 2013 at 1:35 AM, Bonekrusher <[hidden email]> wrote:
Hi Luis,

Yes I am talking about jai_imageio.jar. However I have put the jai file in
my class path and get this error. I am also attaching the image. Thanks for
the help.

SEVERE: Image not available. URI:
file:/Users/Content/Media/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png.
Reason: org.apache.xmlgraphics.image.loader.ImageException: The file format
is not supported. No ImagePreloader found for
file:/Users/Content/Media/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png (See
position 1224:-1)
org.apache.xmlgraphics.image.loader.ImageException: The file format is not
supported. No ImagePreloader found for
file:/Users/Content/Media/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png
        at
org.apache.xmlgraphics.image.loader.ImageManager.preloadImage(ImageManager.java:181)
        at
org.apache.xmlgraphics.image.loader.cache.ImageCache.needImageInfo(ImageCache.java:128)
        at
org.apache.xmlgraphics.image.loader.ImageManager.getImageInfo(ImageManager.java:123)
        at org.apache.fop.fo.flow.ExternalGraphic.bind(ExternalGraphic.java:81)
        at org.apache.fop.fo.FObj.processNode(FObj.java:128)
        at
org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:280)
        at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)

<http://apache-fop.1065347.n5.nabble.com/file/n38283/ICN-LOGO-AAA-DA10000-0-U8025-00512-A-04-1.png>



--
View this message in context: http://apache-fop.1065347.n5.nabble.com/FopFactory-in-Trunk-tp38261p38283.html
Sent from the FOP - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: FopFactory in Trunk

Bonekrusher
Hi Luis,

Thank you for the help. Since the error is being thrown from "org.apache.xmlgraphics.image.loader.ImageException", I would have to assume this issue has to do with XML Graphics Common trunk. I'll do more investigating...