xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Steiner" <simonsteiner1...@gmail.com>
Subject RE: Font not embedded in PDF File !
Date Wed, 29 Apr 2015 15:04:58 GMT
Hi,

 

I have done in the past:

 

        String fopxconf = "<fop version=\"1.0\"><renderers>"

                + "<renderer mime=\"application/pdf\">"

                + "</renderer></renderers></fop>";

        FopFactory fopFactory = FopFactory.newInstance(new File(".").toURI(),

                new ByteArrayInputStream(fopxconf.getBytes()));

 

Thanks

 

From: Fabrice MAUPIN [mailto:fmaupin@iback.fr] 
Sent: 29 April 2015 15:54
To: fop-users@xmlgraphics.apache.org
Cc: terence@tmbsw.com
Subject: RE: Font not embedded in PDF File !

 

Hi,

 

I try this :

 

       URL url = new URL(this.getClass().getResource("mycfg.xml").toURI()

                                  .toString());

                    JarURLConnection connection = (JarURLConnection) url

                                  .openConnection();

                    File file = new File(connection.getJarFileURL().toURI());

 

                    fopFactory.setUserConfig(file);

 

It takes into account to me well the FOP configuration file but I have a new error message
:

 

Contenu non autorisé dans le prologue.

 

2015-04-29 16:26:17,069 ERROR [JavaFX Application Thread] manager.EstimateManager     - com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper
ErrorHandlerWrapper.java 203 createSAXParseException

2015-04-29 16:26:17,069 ERROR [JavaFX Application Thread] manager.EstimateManager     - com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper
ErrorHandlerWrapper.java 177 fatalError

2015-04-29 16:26:17,069 ERROR [JavaFX Application Thread] manager.EstimateManager     - com.sun.org.apache.xerces.internal.impl.XMLErrorReporter
XMLErrorReporter.java 441 reportError

2015-04-29 16:26:17,069 ERROR [JavaFX Application Thread] manager.EstimateManager     - com.sun.org.apache.xerces.internal.impl.XMLErrorReporter
XMLErrorReporter.java 368 reportError

2015-04-29 16:26:17,069 ERROR [JavaFX Application Thread] manager.EstimateManager     - com.sun.org.apache.xerces.internal.impl.XMLScanner
XMLScanner.java 1437 reportFatalError

….

 

This is my FOP file :

 

<?xml version="1.0" encoding="UTF-8"?>

 

<!-- configuration FOP -->

 

<fop version="1.0">

       <renderers>

             <renderer mime="application/pdf">

                    <fonts>

                           <font metrics-url="file:///C:/Users/FMAUPIN/Desktop/fonts/calibri.xml"

                                  kerning="yes" embed-url="file:///C:/Windows/Fonts/calibri.ttf">

                                  <font-triplet name="Calibri" style="normal" weight="normal"
/>

                           </font>

                           <font metrics-url="file:///C:/Users/FMAUPIN/Desktop/fonts/calibrib.xml"

                                  kerning="yes" embed-url="file:///C:/Windows/Fonts/calibrib.ttf">

                                  <font-triplet name="Calibrib" style="normal" weight="bold"
/>

                           </font>

 

                           <!-- détection automatique des fonts installées -->

                           <auto-detect />

                    </fonts>

             </renderer>

       </renderers>

</fop>

 

 

Any ideas ?

 

 

 

De : Terence M. Bandoian [mailto:terence@tmbsw.com] 
Envoyé : mercredi 29 avril 2015 16:48
À : fop-users@xmlgraphics.apache.org
Objet : Re: Font not embedded in PDF File !

 

Hi, Fabrice-

If it's in the JAR file, I don't believe the config file may be accessed directly using java.io.File.
 Have you tried the other FopFactory.setUserConfig methods?

-Terence Bandoian


On 4/29/2015 3:56 AM, Fabrice MAUPIN wrote:

Hi,

 

After several tests, we have well a problem with the location of the FOP configuration file
!!!

 

fopFactory.setUserConfigBaseURI(this.getClass()

                                  .getResource("mycfg.xml").toURI());

 

doesn’t work !

 

If I use this (external call) :

 

       String config = "D:/mycfg.xml";

                    fopFactory.setUserConfig(new File(config));

 

it’s ok !

 

But I would prefer that my FOP configuration file is in the JAR file.

 

How to set user config with a configuration file inside a Jar File ?

 

 

 

De : Fabrice MAUPIN [mailto:fmaupin@iback.fr] 
Envoyé : mercredi 29 avril 2015 09:30
À : 'fop-users@xmlgraphics.apache.org <mailto:fop-users@xmlgraphics.apache.org> '
Cc : 'terence@tmbsw.com <mailto:terence@tmbsw.com> '
Objet : RE: Font not embedded in PDF File !

 

Hi,

 

And the calibri*.xml files are very present on “C:/Users/FMAUPIN/Desktop/fonts” directory.

 

To locate my FOP configuration file, I use :           

 

fopFactory.setUserConfigBaseURI(this.getClass()

                                  .getResource("mycfg.xml").toURI());

 

 

De : Fabrice MAUPIN [mailto:fmaupin@iback.fr] 
Envoyé : mercredi 29 avril 2015 09:11
À : 'fop-users@xmlgraphics.apache.org <mailto:fop-users@xmlgraphics.apache.org> '
Cc : 'terence@tmbsw.com <mailto:terence@tmbsw.com> '
Objet : RE: Font not embedded in PDF File !

 

Hi,

 

The FOP configuration file is embedded into the Jar File.

 

URI : jar:file:/C:/Program%20Files/Gizmo/app/gizmo.jar!/tab/manager/mycfg.xml

 

mycfg.xml is my FOP configuration file

 

Fabrice

 

 

De : Terence M. Bandoian [mailto:terence@tmbsw.com] 
Envoyé : mardi 28 avril 2015 18:19
À : fop-users@xmlgraphics.apache.org <mailto:fop-users@xmlgraphics.apache.org> 
Objet : Re: Font not embedded in PDF File !

 

Hi, Fabrice-

Are you sure the application can locate the FOP configuration file when it's executed outside
of Eclipse?

-Terence Bandoian


On 4/28/2015 9:23 AM, Fabrice MAUPIN wrote:

Hi,

 

I would like that the Calibri Font is embedded in my PDF File.

 

This is my FOP configuration file :

 

<fop version="1.0">

       <renderers>

             <renderer mime="application/pdf">

                    <fonts>

                           <font metrics-url="file:///C:/Users/FMAUPIN/Desktop/fonts/calibri.xml
<file:///C:%5CUsers%5CFMAUPIN%5CDesktop%5Cfonts%5Ccalibri.xml> "

                                  kerning="yes" embed-url="file:///C:/Windows/Fonts/calibri.ttf
<file:///C:%5CWindows%5CFonts%5Ccalibri.ttf> ">

                                  <font-triplet name="Calibri" style="normal" weight="normal"
/>

                           </font>

                           <font metrics-url="file:///C:/Users/FMAUPIN/Desktop/fonts/calibrib.xml
<file:///C:%5CUsers%5CFMAUPIN%5CDesktop%5Cfonts%5Ccalibrib.xml> "

                                  kerning="yes" embed-url="file:///C:/Windows/Fonts/calibrib.ttf
<file:///C:%5CWindows%5CFonts%5Ccalibrib.ttf> ">

                                  <font-triplet name="Calibrib" style="normal" weight="bold"
/>

                           </font>

 

                           <auto-detect />

                    </fonts>

             </renderer>

       </renderers>

</fop>

 

When I launch my application (Jar File packaging by Eclipse) and that I generate my PDF file,
I notice that the Calibri font was not embedded in this file !

 

FOP takes by default a Font (Times I think).

 

It’s very strange because the <auto detect> tag has to take into account the all installed
Fonts in my system folder !

 

For information, if I execute my application under Eclipse (before build  - DEV mode), no
problem : the Calibri Font is embedded in my PDF File !

 

 

So, Is it necessary to  embed the Font during the packaging of the application so that it
works ? If yes how ?

 

The behavior of <auto – detect> tag is it different between running from Eclipse and
running from Jar File ?

 

Any ideas ?

 

 

Thank you in advance

 

Fabrice

 

 

 

  _____  


 <http://www.avast.com/> 

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus
Avast. 
www.avast.com <http://www.avast.com/>  

 

 

 

  _____  


 <http://www.avast.com/> 

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus
Avast. 
www.avast.com <http://www.avast.com/>  

 

 

 

  _____  


 <http://www.avast.com/> 

L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus
Avast. 
www.avast.com <http://www.avast.com/>  

 


Mime
View raw message