To PDF/a Conversion without licensed fonts (java)

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

To PDF/a Conversion without licensed fonts (java)

Arthur R.
Hello, I'm trying to convert ".fo" to PDF/a with FOP files for quite a long time and I hoped you could help me. Please excuse my English.

I don't have the rights to use the base 14 fonts so I do have to substitute those fonts with free fonts. In order to do so I have to embed those free fonts through the "fop.conf" file then substitute them to the licensed fonts. I thought the following codes would do the trick but it failed:

-Declare the FreeFont (FF) with the Licensed Font (LF) name:
        <...font kerning="yes" embed-url="C:/Users/thinkpad/workspace/FopConverter/Fonts/ttf/arial.ttf" name="Arial" >
            <font-triplet name="Helvetica" style="normal" weight="700"/>
        <.../font>

-Declare the FF with its own name then substitute the LF by the FF:
        <...font kerning="yes" embed-url="C:/Users/thinkpad/workspace/FopConverter/Fonts/arial.ttf" name="Arial">
          <font-triplet name="Arial" style="normal" weight="700"/>
        <.../font>
       <substitutions>
         <substitution>
           <from font-family="Helvetica" font-weight="700..900"/>
           <to font-family="Arial"/>
         </substitution>
       </substitutions>

-I also tried to declare the font with <directory></directory> or with <auto-detect/>, then made the substitution, but it did not worked.

One of the reason of this fail might be that I miss declared the base14 fonts. I think that with the present FOP documentation it is really hard to correctly declare a font which will serve as base 14 font. I would like to have an exemple of how to declare a LF substitute. Such an exemple would make Apache FOP use for PDF/a creation much easier.
Reply | Threaded
Open this post in threaded view
|

Re: To PDF/a Conversion without licensed fonts (java)

Stefan Hegny (hydrografix Consulting GmbH)
Hello Arthur,
what you could try (checking the license) is using the ghostscript fonts
like...
                <font kerning="yes"
embed-url="file:///usr/share/fonts/type1/gsfonts/n019003l.pfb">
                    <font-triplet name="Helvetica-Roman" style="normal"
weight="normal"/>
                    <font-triplet name="Helvetica" style="normal"
weight="normal"/>
                    <font-triplet name="Nimbus Sans L" style="normal"
weight="normal"/>
                    <font-triplet name="sansserif" style="normal"
weight="normal"/>
                    <font-triplet name="sans-serif" style="normal"
weight="normal"/>
                    <font-triplet name="Helvetica Roman" style="normal"
weight="normal"/>
                </font>
                <font kerning="yes"
embed-url="file:///usr/share/fonts/type1/gsfonts/n019004l.pfb">
                    <font-triplet name="Helvetica-Roman" style="normal"
weight="bold"/>
                    <font-triplet name="Helvetica" style="normal"
weight="bold"/>
                    <font-triplet name="Nimbus Sans L" style="normal"
weight="bold"/>
                    <font-triplet name="sansserif" style="normal"
weight="bold"/>
                    <font-triplet name="sans-serif" style="normal"
weight="bold"/>
                    <font-triplet name="Helvetica Bold" style="normal"
weight="normal"/>
                </font>
                <font kerning="yes"
embed-url="file:///usr/share/fonts/type1/gsfonts/n021003l.pfb">
                    <font-triplet name="Times-Roman" style="normal"
weight="normal"/>
                    <font-triplet name="Times" style="normal"
weight="normal"/>
                    <font-triplet name="Nimbus Roman No9 L"
style="normal" weight="normal"/>
                    <font-triplet name="serif" style="normal"
weight="normal"/>
                    <font-triplet name="Times Roman" style="normal"
weight="normal"/>
                </font>
                <font kerning="yes"
embed-url="file:///usr/share/fonts/type1/gsfonts/n021004l.pfb">
                    <font-triplet name="Times-Roman" style="normal"
weight="bold"/>
                    <font-triplet name="Times" style="normal"
weight="bold"/>
                    <font-triplet name="Nimbus Roman No9 L"
style="normal" weight="bold"/>
                    <font-triplet name="serif" style="normal"
weight="bold"/>
                    <font-triplet name="Times Roman" style="normal"
weight="bold"/>
                </font>
etc.
BR Stefan

07.08.2017 17:26, Arthur R. wrote:

> Hello, I'm trying to convert ".fo" to PDF/a with FOP files for quite a long
> time and I hoped you could help me. Please excuse my English.
>
> I don't have the rights to use the base 14 fonts so I do have to substitute
> those fonts with free fonts. In order to do so I have to embed those free
> fonts through the "fop.conf" file then substitute them to the licensed
> fonts. I thought the following codes would do the trick but it failed:
>
> -Declare the FreeFont (FF) with the Licensed Font (LF) name:
>         <...font kerning="yes"
> embed-url="C:/Users/thinkpad/workspace/FopConverter/Fonts/ttf/arial.ttf"
> name="Arial" >
>             <font-triplet name="Helvetica" style="normal" weight="700"/>
>         <.../font>
>
> -Declare the FF with its own name then substitute the LF by the FF:
>         <...font kerning="yes"
> embed-url="C:/Users/thinkpad/workspace/FopConverter/Fonts/arial.ttf"
> name="Arial">
>           <font-triplet name="Arial" style="normal" weight="700"/>
>         <.../font>
>        <substitutions>
>          <substitution>
>            <from font-family="Helvetica" font-weight="700..900"/>
>            <to font-family="Arial"/>
>          </substitution>
>        </substitutions>
>
> -I also tried to declare the font with <directory></directory> or with
> <auto-detect/>, then made the substitution, but it did not worked.
>
> One of the reason of this fail might be that I miss declared the base14
> fonts. I think that with the present FOP documentation it is really hard to
> correctly declare a font which will serve as base 14 font. I would like to
> have an exemple of how to declare a LF substitute. Such an exemple would
> make Apache FOP use for PDF/a creation much easier.
>
>
>
> --
> View this message in context: http://apache-fop.1065347.n5.nabble.com/To-PDF-a-Conversion-without-licensed-fonts-java-tp45365.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--

Stefan Hegny, Geschäftsführer/Manager
hydrografix Consulting GmbH       [hidden email]
Tel. +49 - 173-3257674            Fax +49 - 6106-772614
Görlitzer Str. 13
D-63110 Rodgau                    Amtsgericht Offenbach/Main HRB 43974
Geschäftsführer: Roland Junker, Stefan Hegny


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: To PDF/a Conversion without licensed fonts (java)

Arthur R.
Hello,
I tried your code after putting the ghostScript polices in the right file but it seem that fonts `embed-url` only accept `.pfm` or `.afm` since I got this error:

Input: XSL-FO (.\xml\fo\fonts.fo)
Output: PDF (.\out\ResultFO2PDF.pdf)

Transforming...
août 10, 2017 5:17:40 PM org.apache.fop.fonts.LazyFont load
GRAVE: Failed to read font metrics file null
java.io.FileNotFoundException: Neither an AFM nor a PFM file was found for C:/Users/thinkpad/workspace/FopConverter/Fonts/ttf/ghostFonts/notTtfFonts/n019003l.pfb

I still don't quite understand how the way FOP font's configuration but no it doesn't matter.
I moved onto another java library that use Word to do the conversion since it's easier but thank you for your help.
Fop look like an amazing library but maybe it is a too complex tool for a novice like me.
Reply | Threaded
Open this post in threaded view
|

Re: To PDF/a Conversion without licensed fonts (java)

Stefan Hegny (hydrografix Consulting GmbH)
Hello,
ah ok, I see, the afm files must be besides the PFM files. My
ghostscript installation places them right in the same directory.
Sorry I missed that
BR, Stefan

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]