..
background-image="url('invoice-logo.png')"(The XSLFO is ephemeral, just living in an NSData object until the PDF is generated, so maybe a relative URL like that doesn't even make sense.) In this case, I get this logged:Sep 14 20:17:07 PBF[56565] DEBUG FOP - File not found: file:invoice-logo.pngSep 14 20:17:07 PBF[56565] DEBUG AbstractImageSessionContext - URI could not be resolved: invoice-logo.pngIt's not clear to me where FOP is looking for these resources, nor how to tell it to look in Resources. Does anyone know?
--
Seeya...Q
Quinton Dolan - qdo...@gmail.com
Gold Coast, QLD, Australia (GMT+10)
Am 14.09.2010 um 13:14 schrieb Paul Hoadley:
> Hello,
>
> I see some references to FOP in the archives over the years, so there are obviously people using it. I hope they're still subscribed. :-)
>
> I am trying to embed Apache FOP into an application. It's going quite well, but I have an outstanding issue: resolution of 'href' attributes in XSLT files and 'url' attributes in XSLFO files. For example, I have a 'driver.xsl' file which sets some app-specific params, and then imports the stylesheet proper:
>
> <xsl:import href="invoice.xsl"/>
>
> 'driver.xsl' and 'invoice.xsl' are both in Resources. Neither "/invoice.xsl" nor "/Resources/invoice.xsl" helped. The error is fairly non-specific:
>
> SystemId Unknown; Line #5; Column #35; Had IO Exception with stylesheet file: invoice.xsl
>
> (Line 5, Column 35 is the location in driver.xsl where the import element finishes.) Similarly, that transform generates some XSLFO which refers to an image:
>
> background-image="url('invoice-logo.png')"
>
> (The XSLFO is ephemeral, just living in an NSData object until the PDF is generated, so maybe a relative URL like that doesn't even make sense.) In this case, I get this logged:
>
> Sep 14 20:17:07 PBF[56565] DEBUG FOP - File not found: file:invoice-logo.png
> Sep 14 20:17:07 PBF[56565] DEBUG AbstractImageSessionContext - URI could not be resolved: invoice-logo.png
I'm only using straight FOP (w/o any XSLT). Ages ago, I set up an FOImage component. This is the .wod:
Image: WOXMLNode {
alt = ^alt;
border = ^border;
elementName = "fo:external-graphic";
mimetype = ^mimeType;
src = src;
height = ^height;
line-height = ^lineHeight;
width = ^width;
content-width = ^content-width;
content-height = ^content-height;
}
The src is:
public URL src() {
WOResourceManager resourceManager = application().resourceManager();
String filename = (String) valueForBinding("filename");
String framework = (String) valueForBinding("framework");
return resourceManager.pathURLForResourceNamed(filename, framework, null);
}
I'd guess you'll also have to get the URL from the resource manager and pass that in somehow. I'd also guess the same applies to the URLs for any xsl files.
cheers, Fabian
> It's not clear to me where FOP is looking for these resources, nor how to tell it to look in Resources. Does anyone know?
>
>
> --
> Paul.
>
> http://logicsquad.net/
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list (Webobje...@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/lists.fabian%40e-lumo.com
>
> This email sent to lists....@e-lumo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobje...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/webobjects-dev-garchive-31333%40googlegroups.com
This email sent to webobjects-dev...@googlegroups.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobje...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
Unless FOP supports some kind of resource resolution delegate
Have a look at the source for ERPDFGeneration in wonder for how this problem is currently handled. If you aren't tied to using FOP you may wish to try using it instead.
On 14/09/2010, at 10:04 PM, Fabian Peters wrote:
> I'm only using straight FOP (w/o any XSLT). Ages ago, I set up an FOImage component. This is the .wod:
>
> Image: WOXMLNode {
> alt = ^alt;
> border = ^border;
> elementName = "fo:external-graphic";
> mimetype = ^mimeType;
> src = src;
> height = ^height;
> line-height = ^lineHeight;
> width = ^width;
> content-width = ^content-width;
> content-height = ^content-height;
> }
>
> The src is:
>
> public URL src() {
> WOResourceManager resourceManager = application().resourceManager();
>
> String filename = (String) valueForBinding("filename");
> String framework = (String) valueForBinding("framework");
>
> return resourceManager.pathURLForResourceNamed(filename, framework, null);
> }
>
> I'd guess you'll also have to get the URL from the resource manager and pass that in somehow. I'd also guess the same applies to the URLs for any xsl files.
Thanks for that. I actually hadn't thought of generating the FO directly from a component. (I generate an XML document from a component, and transform that.) Nice idea.
--
Paul.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (Webobje...@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
On 02/10/2010, at 12:25 PM, Patrick Robinson wrote:
> I just saw this (late to the party). I solved this for one of our apps in a way very similar to what you have there:
>
> public class XSLURIResolver implements URIResolver {
>
> public Source resolve(String href, String base) throws TransformerException {
> StringBuffer path = new StringBuffer(WOApplication.application().path());
> path.append("/Contents/Resources/");
> path.append(href);
> File file = new File(path.toString());
> if(file.exists()) return new StreamSource(file);
> return null;
> }
>
> }
>
> This works whether it's running on development or deployment machine, and whether from Eclipse or from command line.
Thanks for that. Quite similar.