The XSL-FO Call
If you are using <fo:external-graphic> element, you can use it in the same way
to load a non-file image just by replacing the URN of the image by the url of
the Servlet. Here is the example,
<fo:external-graphic src=http://localhhost:8080/servlet/MediaServlet?
attachmentURN=IM293>
</fo:external-graphic>
Notice that we are passing the attachment URN as a request parameter. If you
need to you can parameterize this URN by passing the data as part of the XML
that will be processed. Do not forget, we are doing all these to process an XML
data with this XSL-FO and pass through FOP to produce output in a desired format
such as PDF etc.
Conclusion
This brings us to the end of this article and this series on FOP and Java. We
have in total covered the basics of XSL-FO, converted XML Data to PDF, created
print solutions using FOP and finally seen how to use images with FOP from a
local file resource and also from non-file resource. This almost covers all
the aspects you need to know when using FOP with Java. As FOP uses
XSL-FO, you will eventually need to know more about XSL-FO that I have not
covered in this series. With this I shall draw an end to this series.
Good-bye and Happy Coding.
Samudra Gupta has six
years of Java related application development experience. He has
been involved in various research based projects in Java
including e-commerce based and application design and
development projects. He is based in the United Kingdom. In his
free time, he is a columnist in different Java Magazines and
Journals and loves to play contract bridge.
New on the Java Boutique:
New Review:
Time Management Made Easy with the Quartz Enterprise Job Scheduler
Why not just use the Java timer API? This open source scheduling
API boasts simplicity, ease-of-integration, a well-rounded feature
set, and it's free!
New Applet:
Reverse Complement
Reverse Complement is a simple applet that converts DNA or RNA
sequences into three useful formats.
Elsewhere on internet.com:
WebDeveloper Java
Lots of Java information on webdeveloper.com
WDVL Java
Thorough Java resource at the Web Developer's Virtual Library.
ScriptSearch Java
Hundreds of free Java code files to download.
jGuru: Your View of the Java Universe
Customizable portal with online training, FAQs, regular news updates, and tutorials.