xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arian Hojat <armyofda12mnk...@gmail.com>
Subject Re: SVG Xlink:href element within a Document.... <image> tags doesnt seem to render in Batik?
Date Wed, 06 Apr 2005 05:17:27 GMT
hey,
Thomas was right about the broken links...
[very weird since it does not report a fileNotFoundException].
when i use a full url path like below, it works...
image1.setAttributeNS(
org.apache.batik.util.XMLConstants.XLINK_NAMESPACE_URI , "xlink:href",
"file:\\\\\\C:\\Documents and
Settings\\Administrator\\Desktop\\SVGTest\\build\\a.jpg");

this is kinda 'ghetto' though and i am gonna be maybe sending these
svg and pics files to the user with a saveSVGAandSourcePicsZip()
function probably.so i need to work with relative urls...

this is a simple 'create svg' and 'save Jpeg' program. but it will be
used in a larger school project i am doing and i am a bit frustrated
since my groupmates depend on me for the SVG parts.

my last request is if anyone wants to solve my problem...
if anyone is very good at java, maybe Main.java which creates the svg
Doc and jpegs is phoeey somewhere or maybe my build script is fudging
up by not having a correct classpath (which i doubt since its in same
dir as the /build/Main.class file), who knows?
http://www.pages.drexel.edu/~ah49/SVGTest.zip (i left out the
batik*.jars from /lib since thats a hefty download; if u want to point
to your directory in the build.xml file's $lib property or copy and
paste your batik*.jars to /lib)

run 'ant run' or just click run if u know how to run ant scripts
within your java IDE to compile and run (saves the svg and jpeg to
/build, notice how the full-pathUrl image shows up but the
relative-url image does not)

thanx in advance if anyone can help more.














On Apr 5, 2005 8:56 PM, Thomas DeWeese <Thomas.DeWeese@kodak.com> wrote:
> Arian Hojat wrote:
> 
> > thanx for the help. my code compiles now, but the image that shows up
> > seems to be a default Batik image instead of the ones i use. Batik
> > seems to find my images as no 'FileNotFoundException' gets returned
> > but i get this broken link? vector-y image?....
> 
>    The 'broken link' image is used when it can't load the referenced
> image.  So it is very possible that it can't find the referenced image.
> 
> > http://www.pages.drexel.edu/~ah49/blah.jpg
> > when it should look like this (exported from my svg editor from the
> > svg source that is creating the image, saved in my java program so i
> > know batik has good code to work with):
> 
>    Actually this is not a very good indicator that the DOM is
> good.  Many errors in the DOM can be fixed by writing it out and
> reading it back in.  In this case however I would suspect that
> something funky is going on with the reference to the
> external files.  Can you provide the SVG content?
> 
> > http://www.pages.drexel.edu/~ah49/source.png
> >
> > my Batik code if it helps is @
> > http://www.pages.drexel.edu/~ah49/Main.java
> > and the images i overlay are:
> > http://www.pages.drexel.edu/~ah49/a.jpg
> > http://www.pages.drexel.edu/~ah49/w.png
> >
> > thanx if anyone can help me understand what is being made by batik here.
> >
> >
> >
> >
> > Tonny Kohar <tonny@kiyut.com> wrote:
> > Hi,
> >
> > On Mon, 2005-04-04 at 02:10 -0400, Arian Hojat wrote:
> >
> >>[snip]
> >>
> >>Element image1 =
> >>svgDoc.createElementNS(SVGDOMImplementation.SVG_NAMESPACE_URI,
> >>"image");
> >>image1.setAttributeNS(null, "xlink:href", "a.jpg");
> >
> >
> > Change this to image1.setAttributeNS(xlinkNS,"xlink:href", "a.jpg");
> > Note: for this part do not use null as namespace.
> > You could use the defined constants at
> > org.apache.batik.util.XMLConstants.XLINK_NAMESPACE_URI or just type the
> > whole namespace.
> >
> >
> >>image1.setAttributeNS(null, "x", "0");
> >>image1.setAttributeNS(null, "y", "0");
> >>image1.setAttributeNS(null, "width", "100%");
> >>image1.setAttributeNS(null, "height","100%");
> >
> >
> > Regards
> > Tonny Kohar
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message