Reopening this thread... curious if anyone could help...
I've made a simple java app (using FOP Trunk), and I point to a relative
location where my .xml config file is...
So in c:/dev/eclipse-workspace/pdf_project_test/, i have:
config/
xml_xsl_files/(where i load the xml and xsl files to form the
fo)
xml_xsl_files/images/ (for the xsl files images)
fonts/(for the ttf fonts the .fo file refers to)
images/(i had to copy the images folder here, more info
on this later)
[
src/
bin/ (Eclipse .java/.class files for the project)
]
Example:
fopFactory.setUserConfig(config/user_config.xml); //config file in the
c:/dev/eclipse-workspace/pdf_project_test/config folder
This works, however i point to abs dir that xml...
I changed the xml to point relatively in the folder via:
font-base./font-base !-- not needed it seems, but added it --
renderers
fonts
directory recursive=truefonts/directory !-- points
relatively now, was set to c:/dev/eclipse-workspace/pdf_project_test/fonts
before --
...
This now works ... But I dont want to use a .xml config file. I just want to
point to the fonts folder, (but I couldnt get that to work, hence why I went
the config file route above)?
Ive tried this relative path to no avail:
FOUserAgent userAgent = fopFactory.newFOUserAgent();
//
userAgent.setBaseURL(file:///c:/dev/eclipse-workspace/pdf_project_test/);
//? not sure if explicitly needed since .java is in that dir, but i tried
all combos i thought might be needed
fopFactory.getFontManager().setFontBaseURL( ./fonts/ );
I've even tried abs paths like: fopFactory.getFontManager().setFontBaseURL(
c:/dev/eclipse-workspace/pdf_project_test/fonts/ );
and various combos in there like
file:///c:/dev/eclipse-workspace/pdf_project_test/fonts/. Again didnt
work.
What kind of file uri's will resolve (just testing on windows for now) and
what is it relative too, the xsl file or the .java file?
A 2nd related question: I figured the .xsl file, which lies in
xml_xsl_files/... i got errors about the image locations, so the image
filepaths werent looking relative to the .xsl file but to the eclipse
projects location. So I had to move images/ out of xsl/ and into
pdf_project_test/. Not sure if this also is best solution, or can feed an
arg to make the xsl look in its own directory.
Thanks for any help on file paths,
PS I did read a few threads I saw but none worked for the setFontBaseURL
(one guy claimed the abs filepaths worked, and i used the same filepath
string structure he used (with file:///c:/to/my/fonts/) but didnt work),
Lates... I can attach code later if needed as its only 75 lines long,
Arian