Closed GoogleCodeExporter closed 9 years ago
Hi,
Have you played with dynamic image samples that you can find on
"odtandvelocity-1.0.0-sample.zip" at
http://code.google.com/p/xdocreport/downloads/list?
It seems that you wish call directly "myImageLoaderObject.getImage(640, 480)"
instead use "myImageLoaderObject" ? Why?
If you do that, it will not work, you must write more complex velocity
directive with ImageRegistry (see on debug mode the velocity directive which
is generated).
I suggest you to attach your odt+java code to understand more your need.
Regards Angelo
Original comment by angelo.z...@gmail.com
on 8 Jan 2013 at 9:23
Hi,
unfortunately i cannot attach my code, but I will provide you with samples
where necessary. The idea behind all this is basically that I want to allow the
ODT-template to pass it's requirements to Java, which itself will then create
an image according to the requirements, putting it into an IImageProvider and
then pushing that back to the ODT document.
To be more precisely, I want to be able to fetch OpenStreetMap tiles with size,
zoom and latitude/longitude from inside the ODT.
What I could and have done as an alternative is the following: I downloaded
multiple tiles with preset Sizes like 640x640, 640x320, 320x640 etc and put
them into the Context. While this basically works out well, I would prefer to
change it to a more dynamic way as this will create a huge amount of traffic
and really increases the time that is required to process ODT templates.
I also brainstormed the following idea: I could use a velocity-method-call in
the ODT header to set width/height, which would then start to download those
tiles and put them in the context. But this might not work as the context
probably needs to persist when processing has started, also, it would increase
the difficulty for creating ODT templates.
Original comment by heyder.r...@gmail.com
on 8 Jan 2013 at 9:55
I'm really sorry, but it's very hard for me to understand your need.
I think if you attach a basic sample (without OpenStreetMap), but just a simple
example, I could understand your need.
I don't understand why you cannot uses IIMageProvider to set height, with like
explained at
http://code.google.com/p/xdocreport/wiki/ODTReportingJavaMainDynamicImage
Original comment by angelo.z...@gmail.com
on 8 Jan 2013 at 10:13
Okay, I have attached a little Test Class which basically does the same that I
am trying to achieve, although a lot more simpler. It will download some tiles
from Google Maps.
You might want to check the stdout to see what actually has happend in terms of
download: It will do 2 Downloads, one for the Velocity-call from the Input
field in the top, and one for the image in the context which is placed at the
bottom.
Original comment by heyder.r...@gmail.com
on 8 Jan 2013 at 11:32
Attachments:
Hi Heyder,
Many thank's to have attached your sample.
Your first problem is that you must do that:
------------------------------------------
metadata.addFieldAsImage("myImageLoaderObject.getImage(640,320)");
------------------------------------------
and not :
------------------------------------------
metadata.addFieldAsImage("myImageLoaderObject.getImage");
------------------------------------------
your second problem is that you must name your image in the ODT with the same
content :
------------------------------------------
myImageLoaderObject.getImage(640,320)
------------------------------------------
and not with
------------------------------------------
myImageLoaderObject.getImage(640x320)
------------------------------------------
But I agree with you, it's not very easy to use, because you must declare the
whole size in fields metadata
------------------------------------------
metadata.addFieldAsImage("myImageLoaderObject.getImage(640,320)");
metadata.addFieldAsImage("myImageLoaderObject.getImage(640,640)");
------------------------------------------
I had an idea (not only for image) to declare fields metadata with pattern. In
your case you could write :
------------------------------------------
metadata.addFieldAsImage("myImageLoaderObject.getImage*");
------------------------------------------
But this feature doesn't exists. I will see if it's easy to develop my idea.
If you other idea, don't hesitate to tell me.
But IMHO, I think it's bad idea to load image with ODT. I think it's better to
prepare data and generate your report. It's the same idea as JEE Web
Application like Struts2, Play! etc :
- you have a controller which load your data (for XDocReport, you populate your context).
- once data is loaded, JSP view is called to use it and generate HTML (for XDocReport view is ODT).
This mean gives you the capability to manage error correctly and it's not the
view which throws error (in this case it's not good because the JSP generate an
HTML fragment and throws error).
Regards Angelo
Original comment by angelo.z...@gmail.com
on 9 Jan 2013 at 8:12
None answer. I close this issue.
Original comment by angelo.z...@gmail.com
on 7 Aug 2014 at 9:17
cleanup
Original comment by pascal.leclercq
on 10 Oct 2014 at 7:37
Original issue reported on code.google.com by
heyder.r...@gmail.com
on 8 Jan 2013 at 9:15