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 "Clifford, Paul" <PC...@heico.com> on 2014/09/30 16:18:26 UTC

FOP servelet - font config

I am having trouble using a custom font when running the examples via the servlet.

If I  create a pdf from the example:
java -cp %CLASSPATH% org.apache.fop.cli.Main -c c:\fop-1.1\conf\fop.xconf c:\fop-1.1\examples\embedding\xml\fo\helloworld.fo -pdf report.pdf

It renders perfectly, with my font.

helloworld.fo has been slightly modified to contain my custom font :
<fo:block font-family="Monospac821" font-style="normal" font-weight="400">Hello World!</fo:block>

However, when I call  this via the servlet, it renders but with no custom font:
http://localhost:8080/fop/fop?fo=c:\fop-1.1\examples\embedding\xml\fo\helloworld.fo

30-Sep-2014 10:10:45.742 WARNING [http-nio-8080-exec-1] org.apache.fop.events.LoggingEventListener.processEvent Font "Monospac821,normal,400" not found. Substituting with "any,normal,400".

How can I get my config file to be recognized in the servlet?  I am rather new to JAVA so a step by step would be greatly appreciated!

C:\fop-1.1\conf\fop.xconf
<?xml version="1.0"?>
    <fop>
      <renderers>
        <renderer mime="application/pdf">
          <fonts>
                <font kerning="yes"  embed-url="file:///C:/windows/fonts/Mon821Rm.ttf">
                      <font-triplet name="Monospac821" style="normal" weight="normal"/>
                </font>
                <font kerning="yes"  embed-url="file:///C:/windows/fonts/Mon821Bd.ttf">
                      <font-triplet name="Monospac821" style="normal" weight="bold"/>
                </font>
            </fonts>
        </renderer>
      </renderers>
</fop>

Paul Clifford

DISCLAIMER:
The information contained in this e-mail and its attachments are intended solely for the use of the individual (s) to whom it is addressed and contains information that is confidential and the property of HEICO Corporation or one of its subsidiaries. If the reader of this e-mail is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify us immediately and destroy the e-mail. Thank you.

RE: FOP servelet - font config

Posted by "Clifford, Paul" <PC...@heico.com>.
Just a follow up here: my issue was resolved by adding the path to fop.xconf to CLASSPATH.

Paul

From: Clifford, Paul [mailto:PClifford@heico.com]
Sent: Tuesday, September 30, 2014 10:18 AM
To: fop-users@xmlgraphics.apache.org
Subject: FOP servelet - font config

I am having trouble using a custom font when running the examples via the servlet.

If I  create a pdf from the example:
java -cp %CLASSPATH% org.apache.fop.cli.Main -c c:\fop-1.1\conf\fop.xconf c:\fop-1.1\examples\embedding\xml\fo\helloworld.fo -pdf report.pdf

It renders perfectly, with my font.

helloworld.fo has been slightly modified to contain my custom font :
<fo:block font-family="Monospac821" font-style="normal" font-weight="400">Hello World!</fo:block>

However, when I call  this via the servlet, it renders but with no custom font:
http://localhost:8080/fop/fop?fo=c:\fop-1.1\examples\embedding\xml\fo\helloworld.fo

30-Sep-2014 10:10:45.742 WARNING [http-nio-8080-exec-1] org.apache.fop.events.LoggingEventListener.processEvent Font "Monospac821,normal,400" not found. Substituting with "any,normal,400".

How can I get my config file to be recognized in the servlet?  I am rather new to JAVA so a step by step would be greatly appreciated!

C:\fop-1.1\conf\fop.xconf
<?xml version="1.0"?>
    <fop>
      <renderers>
        <renderer mime="application/pdf">
          <fonts>
                <font kerning="yes"  embed-url="file:///C:/windows/fonts/Mon821Rm.ttf<file:///C:\windows\fonts\Mon821Rm.ttf>">
                      <font-triplet name="Monospac821" style="normal" weight="normal"/>
                </font>
                <font kerning="yes"  embed-url="file:///C:/windows/fonts/Mon821Bd.ttf<file:///C:\windows\fonts\Mon821Bd.ttf>">
                      <font-triplet name="Monospac821" style="normal" weight="bold"/>
                </font>
            </fonts>
        </renderer>
      </renderers>
</fop>

Paul Clifford

DISCLAIMER:
The information contained in this e-mail and its attachments are intended solely for the use of the individual (s) to whom it is addressed and contains information that is confidential and the property of HEICO Corporation or one of its subsidiaries. If the reader of this e-mail is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify us immediately and destroy the e-mail. Thank you.

DISCLAIMER:
The information contained in this e-mail and its attachments are intended solely for the use of the individual (s) to whom it is addressed and contains information that is confidential and the property of HEICO Corporation or one of its subsidiaries. If the reader of this e-mail is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify us immediately and destroy the e-mail. Thank you.