You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by John T <jt...@ci.com> on 2008/08/05 19:52:15 UTC

Embedding Fonts

Hello. I am embedding fonts in my PDF and it seems to be working. However, it
only works the second  time I call my servlet and subsequet times. Has
anyone seen this behaviour before or know the cause of such a behaviour? The
servlet is runing on BEA Weblogic v8.1 on a Windows XP desktop. FOP version
is 0.94

Thanks
John
-- 
View this message in context: http://www.nabble.com/Embedding-Fonts-tp18836519p18836519.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Embedding Fonts

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Yes. You might also want to look at our demo servlet:
https://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/servlet/FopServlet.java?view=markup

On 06.08.2008 20:03:46 John T wrote:
> 
> This was the issue. I am now instantiating the FopFactory in the init()
> method of the servlet as well as setting the configuration there as well. Is
> this considered best practices for using Fop in a servlet?
> 
> 
> Jeremias Maerki-2 wrote:
> > 
> > Sounds as if the configuration isn't set soon enough. Please make sure
> > you instantiate the FopFactory at servlet startup and that you also set
> > the configuration on the FopFactory at this time. Then, each time the
> > servlet is called, just create a new Fop instance using that factory.
> > Without seeing your servlet code it's difficult to pinpoint. The above
> > is just wild guessing.
> > 
> > At any rate, it should not be necessary to run FOP twice just to get the
> > fonts embedded. That would be very bad.
> > 
> > On 06.08.2008 15:52:20 John T wrote:
> >> 
> >> 
> >> 
> >> Jeremias Maerki-2 wrote:
> >> > 
> >> > But then, what does
> >> > "it only works the second time" mean? Are there error messages the
> >> first
> >> > time? If yes, which? Have you tried with different browsers?  Please
> >> make
> >> > sure you've read the tips on this
> >> > page:http://xmlgraphics.apache.org/fop/0.95/servlets.html
> >> > 
> >> 
> >> Sorry for not being clear in my first post. What I mean to say is that
> >> the
> >> very first time it is called, the fonts I have embedded
> >> (CenturySchoolbook
> >> and Arial) do not show up in the generated PDF. Instead, the default font
> >> shows up. However, the second time I call the servlet, the correct font
> >> does
> >> show up. These error messages are being generated:
> >> 
> >> WARNING: Font 'CenturySchoolbook,normal,400' not found. Substituting with
> >> 'any,normal,400'.
> >> Aug 5, 2008 4:55:30 PM org.apache.fop.fonts.FontInfo
> >> notifyFontReplacement
> >> WARNING: Font 'CenturySchoolbook,normal,700' not found. Substituting with
> >> 'any,normal,700'.
> >> Aug 6, 2008 9:09:31 AM org.apache.fop.fonts.FontInfo
> >> notifyFontReplacement
> >> WARNING: Font 'Arial,normal,400' not found. Substituting with
> >> 'any,normal,400'.
> >> 
> >> I have tried with Firefox and IE - the behaviour is the same. The only
> >> solution I have found is to call the code (in the servlet) that generates
> >> the PDF twice; the first time using 
> >> org.apache.commons.io.output.NullOutputStream()  and the second time
> >> sending
> >> the output to the browser. While this solution works, I'd like to figure
> >> out
> >> why this behaviour is occuring.
> >> 
> >> Thanks,
> >> John
> >> 
> >> 
> >> 
> >> On 05.08.2008 19:52:15 John T wrote:
> >> > 
> >> > Hello. I am embedding fonts in my PDF and it seems to be working.
> >> However,
> >> > it
> >> > only works the second  time I call my servlet and subsequet times. Has
> >> > anyone seen this behaviour before or know the cause of such a
> >> behaviour?
> >> > The
> >> > servlet is runing on BEA Weblogic v8.1 on a Windows XP desktop. FOP
> >> > version
> >> > is 0.94
> >> > 
> >> > Thanks
> >> > John
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Embedding-Fonts-tp18836519p18851689.html
> >> Sent from the FOP - Users mailing list archive at Nabble.com.
> >> 
> > 
> > 
> > Jeremias Maerki
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Embedding-Fonts-tp18836519p18856555.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 



Jeremias Maerki


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


Re: Embedding Fonts

Posted by John T <jt...@ci.com>.
This was the issue. I am now instantiating the FopFactory in the init()
method of the servlet as well as setting the configuration there as well. Is
this considered best practices for using Fop in a servlet?


Jeremias Maerki-2 wrote:
> 
> Sounds as if the configuration isn't set soon enough. Please make sure
> you instantiate the FopFactory at servlet startup and that you also set
> the configuration on the FopFactory at this time. Then, each time the
> servlet is called, just create a new Fop instance using that factory.
> Without seeing your servlet code it's difficult to pinpoint. The above
> is just wild guessing.
> 
> At any rate, it should not be necessary to run FOP twice just to get the
> fonts embedded. That would be very bad.
> 
> On 06.08.2008 15:52:20 John T wrote:
>> 
>> 
>> 
>> Jeremias Maerki-2 wrote:
>> > 
>> > But then, what does
>> > "it only works the second time" mean? Are there error messages the
>> first
>> > time? If yes, which? Have you tried with different browsers?  Please
>> make
>> > sure you've read the tips on this
>> > page:http://xmlgraphics.apache.org/fop/0.95/servlets.html
>> > 
>> 
>> Sorry for not being clear in my first post. What I mean to say is that
>> the
>> very first time it is called, the fonts I have embedded
>> (CenturySchoolbook
>> and Arial) do not show up in the generated PDF. Instead, the default font
>> shows up. However, the second time I call the servlet, the correct font
>> does
>> show up. These error messages are being generated:
>> 
>> WARNING: Font 'CenturySchoolbook,normal,400' not found. Substituting with
>> 'any,normal,400'.
>> Aug 5, 2008 4:55:30 PM org.apache.fop.fonts.FontInfo
>> notifyFontReplacement
>> WARNING: Font 'CenturySchoolbook,normal,700' not found. Substituting with
>> 'any,normal,700'.
>> Aug 6, 2008 9:09:31 AM org.apache.fop.fonts.FontInfo
>> notifyFontReplacement
>> WARNING: Font 'Arial,normal,400' not found. Substituting with
>> 'any,normal,400'.
>> 
>> I have tried with Firefox and IE - the behaviour is the same. The only
>> solution I have found is to call the code (in the servlet) that generates
>> the PDF twice; the first time using 
>> org.apache.commons.io.output.NullOutputStream()  and the second time
>> sending
>> the output to the browser. While this solution works, I'd like to figure
>> out
>> why this behaviour is occuring.
>> 
>> Thanks,
>> John
>> 
>> 
>> 
>> On 05.08.2008 19:52:15 John T wrote:
>> > 
>> > Hello. I am embedding fonts in my PDF and it seems to be working.
>> However,
>> > it
>> > only works the second  time I call my servlet and subsequet times. Has
>> > anyone seen this behaviour before or know the cause of such a
>> behaviour?
>> > The
>> > servlet is runing on BEA Weblogic v8.1 on a Windows XP desktop. FOP
>> > version
>> > is 0.94
>> > 
>> > Thanks
>> > John
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Embedding-Fonts-tp18836519p18851689.html
>> Sent from the FOP - Users mailing list archive at Nabble.com.
>> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Embedding-Fonts-tp18836519p18856555.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Embedding Fonts

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Sounds as if the configuration isn't set soon enough. Please make sure
you instantiate the FopFactory at servlet startup and that you also set
the configuration on the FopFactory at this time. Then, each time the
servlet is called, just create a new Fop instance using that factory.
Without seeing your servlet code it's difficult to pinpoint. The above
is just wild guessing.

At any rate, it should not be necessary to run FOP twice just to get the
fonts embedded. That would be very bad.

On 06.08.2008 15:52:20 John T wrote:
> 
> 
> 
> Jeremias Maerki-2 wrote:
> > 
> > But then, what does
> > "it only works the second time" mean? Are there error messages the first
> > time? If yes, which? Have you tried with different browsers?  Please make
> > sure you've read the tips on this
> > page:http://xmlgraphics.apache.org/fop/0.95/servlets.html
> > 
> 
> Sorry for not being clear in my first post. What I mean to say is that the
> very first time it is called, the fonts I have embedded (CenturySchoolbook
> and Arial) do not show up in the generated PDF. Instead, the default font
> shows up. However, the second time I call the servlet, the correct font does
> show up. These error messages are being generated:
> 
> WARNING: Font 'CenturySchoolbook,normal,400' not found. Substituting with
> 'any,normal,400'.
> Aug 5, 2008 4:55:30 PM org.apache.fop.fonts.FontInfo notifyFontReplacement
> WARNING: Font 'CenturySchoolbook,normal,700' not found. Substituting with
> 'any,normal,700'.
> Aug 6, 2008 9:09:31 AM org.apache.fop.fonts.FontInfo notifyFontReplacement
> WARNING: Font 'Arial,normal,400' not found. Substituting with
> 'any,normal,400'.
> 
> I have tried with Firefox and IE - the behaviour is the same. The only
> solution I have found is to call the code (in the servlet) that generates
> the PDF twice; the first time using 
> org.apache.commons.io.output.NullOutputStream()  and the second time sending
> the output to the browser. While this solution works, I'd like to figure out
> why this behaviour is occuring.
> 
> Thanks,
> John
> 
> 
> 
> On 05.08.2008 19:52:15 John T wrote:
> > 
> > Hello. I am embedding fonts in my PDF and it seems to be working. However,
> > it
> > only works the second  time I call my servlet and subsequet times. Has
> > anyone seen this behaviour before or know the cause of such a behaviour?
> > The
> > servlet is runing on BEA Weblogic v8.1 on a Windows XP desktop. FOP
> > version
> > is 0.94
> > 
> > Thanks
> > John
> 
> -- 
> View this message in context: http://www.nabble.com/Embedding-Fonts-tp18836519p18851689.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 


Jeremias Maerki


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


Re: Embedding Fonts

Posted by John T <jt...@ci.com>.


Jeremias Maerki-2 wrote:
> 
> But then, what does
> "it only works the second time" mean? Are there error messages the first
> time? If yes, which? Have you tried with different browsers?  Please make
> sure you've read the tips on this
> page:http://xmlgraphics.apache.org/fop/0.95/servlets.html
> 

Sorry for not being clear in my first post. What I mean to say is that the
very first time it is called, the fonts I have embedded (CenturySchoolbook
and Arial) do not show up in the generated PDF. Instead, the default font
shows up. However, the second time I call the servlet, the correct font does
show up. These error messages are being generated:

WARNING: Font 'CenturySchoolbook,normal,400' not found. Substituting with
'any,normal,400'.
Aug 5, 2008 4:55:30 PM org.apache.fop.fonts.FontInfo notifyFontReplacement
WARNING: Font 'CenturySchoolbook,normal,700' not found. Substituting with
'any,normal,700'.
Aug 6, 2008 9:09:31 AM org.apache.fop.fonts.FontInfo notifyFontReplacement
WARNING: Font 'Arial,normal,400' not found. Substituting with
'any,normal,400'.

I have tried with Firefox and IE - the behaviour is the same. The only
solution I have found is to call the code (in the servlet) that generates
the PDF twice; the first time using 
org.apache.commons.io.output.NullOutputStream()  and the second time sending
the output to the browser. While this solution works, I'd like to figure out
why this behaviour is occuring.

Thanks,
John



On 05.08.2008 19:52:15 John T wrote:
> 
> Hello. I am embedding fonts in my PDF and it seems to be working. However,
> it
> only works the second  time I call my servlet and subsequet times. Has
> anyone seen this behaviour before or know the cause of such a behaviour?
> The
> servlet is runing on BEA Weblogic v8.1 on a Windows XP desktop. FOP
> version
> is 0.94
> 
> Thanks
> John

-- 
View this message in context: http://www.nabble.com/Embedding-Fonts-tp18836519p18851689.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Embedding Fonts

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
I'm not aware of such problems. When FOP is run from the command-line,
it just runs once and there are no such problems. The way FOP is called
is quite similar to when it's embedded in a servlet. But then, what does
"it only works the second time" mean? Are there error messages the first
time? If yes, which? Have you tried with different browsers?

My gut feeling is that you've either got a problem in your servlet code
or a communication problem between the browser and the servlet. Please
make sure you've read the tips on this page:
http://xmlgraphics.apache.org/fop/0.95/servlets.html

On 05.08.2008 19:52:15 John T wrote:
> 
> Hello. I am embedding fonts in my PDF and it seems to be working. However, it
> only works the second  time I call my servlet and subsequet times. Has
> anyone seen this behaviour before or know the cause of such a behaviour? The
> servlet is runing on BEA Weblogic v8.1 on a Windows XP desktop. FOP version
> is 0.94
> 
> Thanks
> John
> -- 
> View this message in context: http://www.nabble.com/Embedding-Fonts-tp18836519p18836519.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 



Jeremias Maerki


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