Niladri,

 

So you fonr file is contained inside a WAR file, do I have that right?
Any reason you cannot move it outside the WAR?

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Niladri Bhattacharyya
Sent: 03 January 2008 03:33 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Problem with Font creation.

 

No Sir,

           if you check the api for this method this does not work for
any file inside war. My file is inside the war.

----- Original Message ----
From: Schalk Neethling <[EMAIL PROTECTED]>
To: Post all your questions about iText here
<[email protected]>
Sent: Thursday, 3 January, 2008 6:59:42 PM
Subject: Re: [iText-questions] Problem with Font creation.

Ok, how about ServletContext.getRealPath(fileLoc);

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Niladri Bhattacharyya
Sent: 03 January 2008 03:28 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Problem with Font creation.

 

Thats right sir, i tried that see below the code i written

 

public class PrintServlet extends HttpServlet {

 

public void init(ServletConfig config) {

    String fileLoc = config.getInitParameter("fontlocation");

    System.out.println("File loc " + fileLoc);

}

 

Now this code gives the path from the webapp location like :
/font/AZ.ttf

 

But I want the full path for the existing file in the system, i.e.

C:\Workspace\CARAT_PL\res\LombardBusiness\webapp\font\AZ.ttf

 

This is the problem.

 

How can I get the path : C:\Workspace\CARAT_PL\res\LombardBusiness  ??

 

Thanks

Niladri.

 

----- Original Message ----
From: Schalk Neethling <[EMAIL PROTECTED]>
To: Post all your questions about iText here
<[email protected]>
Sent: Thursday, 3 January, 2008 6:42:18 PM
Subject: Re: [iText-questions] Problem with Font creation.

Ok great! Then what you can do is create an init parameter for your
servlet that provides the location of the font. The in your servlet you
can use servlet context to get to that parameter as follows:

String pathToFont =
ServletContext.getInitParameter("nameOfFontInitParameter");

 

Regards,

Schalk Neethling

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Niladri Bhattacharyya
Sent: 03 January 2008 03:09 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Problem with Font creation.

 

yes...absolutely...

----- Original Message ----
From: Schalk Neethling <[EMAIL PROTECTED]>
To: Post all your questions about iText here
<[email protected]>
Sent: Thursday, 3 January, 2008 6:33:48 PM
Subject: Re: [iText-questions] Problem with Font creation.

Do you have access to your web.xml?

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Niladri Bhattacharyya
Sent: 03 January 2008 02:50 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Problem with Font creation.

 

yes, the font file is located inside my webapp folder of my web
application

 

The actual path is :

 

C:\Workspace\CARAT_PL\res\LombardBusiness\webapp\font\AZ.ttf

 

Please let me know if u have some solution I am still trying. thanks a
lot for your interest.

 

Thanks

Niladri.

 

----- Original Message ----
From: Schalk Neethling <[EMAIL PROTECTED]>
To: Post all your questions about iText here
<[email protected]>
Sent: Thursday, 3 January, 2008 5:51:55 PM
Subject: Re: [iText-questions] Problem with Font creation.

Do you know where the font is located on your system?

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Niladri Bhattacharyya
Sent: 03 January 2008 02:10 PM
To: Post all your questions about iText here
Subject: Re: [iText-questions] Problem with Font creation.

 

Hi Schalk,

                Thanks a lot for your solution provided but for me that
s of no use becayse for my application I do not have any access to the
build files of my application. Is there any other way to create the Font
for PDFs using iText ?

 

Thanks

Niladri.

----- Original Message ----
From: Schalk Neethling <[EMAIL PROTECTED]>
To: Post all your questions about iText here
<[email protected]>
Sent: Thursday, 3 January, 2008 4:23:27 PM
Subject: Re: [iText-questions] Problem with Font creation.

Greetings Nilardi,

 

I created a properties file with an entry such as:

wealthReportWeb.plugins.dir=${wealthReportWeb.webContent.dir}/WEB-INF/pl
atform/plugins

wealthReportWeb.fonts.dir=${wealthReportWeb.plugins.dir}/org.eclipse.bir
t...report.engine.fonts_2.2.1.v20070823/fonts/

 

Inside my build.xml Ant script, I then have the following:

<target name="createBirtConfigProperties">

<propertyfile
file="${wealthReportWeb.gensrc.dir}/BirtConfig.properties">

<entry key="verdana" value="${wealthReportWeb.fonts.dir}/verdana.ttf" />

</propertyfile>

</target>

 

Then inside my code I do the following:

BaseFont bf = BaseFont.createFont(configProps.getString("verdana"),
BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);

 

HTH!

Schalk Neethling

 

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Niladri Bhattacharyya
Sent: 03 January 2008 12:47 PM
To: [email protected]
Subject: [iText-questions] Problem with Font creation.

 

Hi 

   I am unable to create the Font inside my servlet and my page events
class. How to get the actual path of the Font file , can somebody help
me ?

 

the code written is :

 

BaseFont bf = BaseFont.createFont(fontPathName, BaseFont..IDENTITY_H,

BaseFont.EMBEDDED);

 

Now this font path name must be the actual path of the file in the
system. The file is put inside webapp folder, hence inside the .war
file. This is required inside my page events class also.

 

Please help me if possible.

 

Thanks

Niladri.

 

________________________________

Save all your chat conversations. Find them online.
<http://in.rd.yahoo.com/tagline_webmessenger_3/*http:/in.messenger.yahoo
.com/webmessengerpromo.php> 

This email and all content are subject to the following disclaimer:

 

http://content.momentum.co.za/content/legal/disclaimer_email.htm

 

 

 

 

________________________________

Now you can chat without downloading messenger. Click here
<http://in.rd.yahoo.com/tagline_webmessenger_5/*http:/in.messenger.yahoo
.com/webmessengerpromo.php>  to know how.

 

 

________________________________

Get the freedom to save as many mails as you wish. Click here to know
how.
<http://in.rd.yahoo.com/tagline_mail_5/*http:/help.yahoo.com/l/in/yahoo/
mail/yahoomail/tools/tools-08.html/> 

 

 

________________________________

Explore your hobbies and interests. Click here to begin.
<http://in.rd.yahoo.com/tagline_groups_6/*http:/in.promos.yahoo.com/grou
ps> 

 

 

________________________________

Unlimited freedom, unlimited storage. Get it now
<http://in.rd.yahoo.com/tagline_mail_2/*http:/help.yahoo.com/l/in/yahoo/
mail/yahoomail/tools/tools-08.html/> 

 





________________________________

Why delete messages? Unlimited storage is just a click away.
<http://in.rd.yahoo.com/tagline_mail_1/*http:/help.yahoo.com/l/in/yahoo/
mail/yahoomail/tools/tools-08.html/> 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to