PDF template processor external font paths

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

PDF template processor external font paths

VG-3
Hi,
I managed to refer to external fonts in PDF template processor config file á
la

 <group ref="/foo"
font-family="/usr/local/jboss/server/default/deploy/ops.war/WEB-INF/resources/apps/projectx/fonts/myfont.ttf">

Using absolute path is not so handy when transferring ops.war to another
machine...

From what I understood from the Java code, the path is passed directly to iText
stuff.

It looks like relative font-paths or oxf: -type paths are not recognized.

My question is, could somebody
a) tell me why relative path does not work (may working directory issue?)
b) advise how I could add oxf: -support to font-family attribute ?

Thx in advance for your insights,
VG


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: PDF template processor external font paths

Erik Bruchez
Administrator
I don't have an answer to these questions. I see the API for this here:

   http://www.docjar.com/docs/api/com/lowagie/text/pdf/BaseFont.html#createFont

Try to ask the question on the iText forums. It would be good to be  
able to resolve font paths relatively.

-Erik

On Jul 22, 2008, at 5:05 AM, VG wrote:

> Hi,
> I managed to refer to external fonts in PDF template processor  
> config file á
> la
>
> <group ref="/foo"
> font-family="/usr/local/jboss/server/default/deploy/ops.war/WEB-INF/
> resources/apps/projectx/fonts/myfont.ttf">
>
> Using absolute path is not so handy when transferring ops.war to  
> another
> machine...
>
> From what I understood from the Java code, the path is passed  
> directly to iText
> stuff.
>
> It looks like relative font-paths or oxf: -type paths are not  
> recognized.
>
> My question is, could somebody
> a) tell me why relative path does not work (may working directory  
> issue?)
> b) advise how I could add oxf: -support to font-family attribute ?
>
> Thx in advance for your insights,
> VG
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: PDF template processor external font paths

David McIntyre
FWIW we use the following approach to load fonts with iText without compiling in the absolute path:

    private static final File JRE_FONT_DIR = new File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "fonts");
...
        for (final File fontFile JRE_FONT_DIR.listFiles()) {
           if (fontFile.getName().endsWith(".ttf")) {
              pdfRenderer.getFontResolver().addFont(fontFile.getAbsolutePath(), true);
           }
        }

where pdfRenderer is an instance of ITextRenderer.  I'm not sure how you'd adapt this to refer to .tff files in a webapp...

Dave

Erik Bruchez wrote:
I don't have an answer to these questions. I see the API for this here:

  http://www.docjar.com/docs/api/com/lowagie/text/pdf/BaseFont.html#createFont

Try to ask the question on the iText forums. It would be good to be able to resolve font paths relatively.

-Erik

On Jul 22, 2008, at 5:05 AM, VG wrote:

Hi,
I managed to refer to external fonts in PDF template processor config file á
la

<group ref="/foo"
font-family="/usr/local/jboss/server/default/deploy/ops.war/WEB-INF/resources/apps/projectx/fonts/myfont.ttf">

Using absolute path is not so handy when transferring ops.war to another
machine...

From what I understood from the Java code, the path is passed directly to iText
stuff.

It looks like relative font-paths or oxf: -type paths are not recognized.

My question is, could somebody
a) tell me why relative path does not work (may working directory issue?)
b) advise how I could add oxf: -support to font-family attribute ?

Thx in advance for your insights,
VG

--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: [hidden email]
For general help: [hidden email]
OW2 mailing lists service home page: http://www.ow2.org/wws

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/


--
Orion Signature
Dave McIntyre
Software Developer
2nd Floor, Orion House, cnr Enfield & Mary St, Mt Eden, PO Box 8273, Auckland, New Zealand
M.+64 21 212 8087 P.+64 9 638 0600 F.+64 9 638 0699
S.<a href="callto:dave.mcintyre">dave.mcintyre E.[hidden email] W.www.orionhealth.com




This e-mail and any attachments are intended only for the person to whom it is addressed and may contain privileged, proprietary, or other data protected from disclosure under applicable law. If you are not the addressee or the person responsible for delivering this to the addressee you are hereby notified that reading, copying or distributing this transmission is prohibited. If you have received this e-mail in error, please telephone us immediately and remove all copies of it from your system. Thank you for your co-operation.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: PDF template processor external font paths

Erik Bruchez
Administrator
Something like this could work for built-in fonts.

The original poster seems to have custom fonts. In that case, I guess  
that the idea would be to use the path:

   oxf:/apps/projectx/fonts/myfont.ttf

ResourceManager.getRealPath() could be used here I think.

-Erik

On Jul 23, 2008, at 2:08 PM, Dave McIntyre wrote:

> FWIW we use the following approach to load fonts with iText without  
> compiling in the absolute path:
>
>     private static final File JRE_FONT_DIR = new  
> File(System.getProperty("java.home") + File.separator + "lib" +  
> File.separator + "fonts");
> ...
>         for (final File fontFile JRE_FONT_DIR.listFiles()) {
>            if (fontFile.getName().endsWith(".ttf")) {
>                
> pdfRenderer.getFontResolver().addFont(fontFile.getAbsolutePath(),  
> true);
>            }
>         }
>
> where pdfRenderer is an instance of ITextRenderer.  I'm not sure how  
> you'd adapt this to refer to .tff files in a webapp...
>
> Dave
>
> Erik Bruchez wrote:
>>
>> I don't have an answer to these questions. I see the API for this  
>> here:
>>
>>   http://www.docjar.com/docs/api/com/lowagie/text/pdf/BaseFont.html#createFont
>>
>> Try to ask the question on the iText forums. It would be good to be  
>> able to resolve font paths relatively.
>>
>> -Erik
>>
>> On Jul 22, 2008, at 5:05 AM, VG wrote:
>>
>>> Hi,
>>> I managed to refer to external fonts in PDF template processor  
>>> config file á
>>> la
>>>
>>> <group ref="/foo"
>>> font-family="/usr/local/jboss/server/default/deploy/ops.war/WEB-
>>> INF/resources/apps/projectx/fonts/myfont.ttf">
>>>
>>> Using absolute path is not so handy when transferring ops.war to  
>>> another
>>> machine...
>>>
>>> From what I understood from the Java code, the path is passed  
>>> directly to iText
>>> stuff.
>>>
>>> It looks like relative font-paths or oxf: -type paths are not  
>>> recognized.
>>>
>>> My question is, could somebody
>>> a) tell me why relative path does not work (may working directory  
>>> issue?)
>>> b) advise how I could add oxf: -support to font-family attribute ?
>>>
>>> Thx in advance for your insights,
>>> VG
>>>
>>> --
>>> You receive this message as a subscriber of the [hidden email]  
>>> mailing list.
>>> To unsubscribe: mailto:[hidden email]
>>> For general help: mailto:[hidden email]?subject=help
>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
>>
>
> --
> <star.gif>Dave McIntyre
> Software Developer
> <orion150.gif>
> 2nd Floor, Orion House, cnr Enfield & Mary St, Mt Eden, PO Box 8273,  
> Auckland, New Zealand
> M.+64 21 212 8087 P.+64 9 638 0600 F.+64 9 638 0699
> S.dave.mcintyre [hidden email] W.www.orionhealth.com
>
>
>
>
> This e-mail and any attachments are intended only for the person to  
> whom it is addressed and may contain privileged, proprietary, or  
> other data protected from disclosure under applicable law. If you  
> are not the addressee or the person responsible for delivering this  
> to the addressee you are hereby notified that reading, copying or  
> distributing this transmission is prohibited. If you have received  
> this e-mail in error, please telephone us immediately and remove all  
> copies of it from your system. Thank you for your co-operation.
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws