Hi,
Oh after i wrote the lines below i see YOUR CONFIG IS MISSING:
the font definitions need to be in the fonts tag. So ie.:
<renderer>
...
<fonts>
<font>...</font>
</fonts>
Before i recognized the missing in config:
As i make fo and config to using fonts, it may help you, try it:
First:
In FOP config define the <font-base> directive.
Second:
In FOP renderer config, where you define fonts, in embed-url use
only the file name without path (wich is defined in font-base)
Define the font name as it is in the ttf, ie.: "DejaVu Sans" not
"DejaVuSans" !!!
- may try to use the embedding-mode="full" attribute (i know it
will make larger PDF file size)
Third:
Use the font in fo by its given=real name: font-family="DejaVu Sans"
I hope this will help you.
Bye, Szeak
2016-01-07 10:14 keltezéssel, Tunahan Coban írta:
Hey,
I added Pascals variations to my config file and change in the xsl again : <fo:root
font-family="DejaVuSans">.
But it still doesn't work. I get the following sentences:
// a lot of these Warnings
16:40:27,941 WARN [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-2) The following
feature isn't implemented by Apache FOP, yet: table-layout="auto" (on fo:table)
(Keine Kontextinformationen verfügbar)
16:40:29,082 WARN [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-2)
table-layout="fixed" and column-width unspecified => falling back to
proportional-column-width(1) (No context info available)
16:40:29,268 WARN [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-2) The
contents of fo:inline line 1 exceed the available area in the
inline-progression direction by 3896 millipoints. (No context info available)
16:40:29,145 WARN [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-2) Font
"DejaVuSans,normal,400" not found. Substituting with "any,normal,400".
16:40:29,145 WARN [org.apache.fop.apps.FOUserAgent] (http-/0.0.0.0:7080-2) Font
"DejaVuSans,normal,700" not found. Substituting with "any,normal,700".
16:40:29,675 ERROR [org.apache.fop.fo.FOTreeBuilder] (http-/0.0.0.0:7080-2)
org.apache.fop.pdf.PDFConformanceException: For PDF/A-1a, all fonts, even the
base 14 fonts, have to be embedded! Offending font: /Times-Roman
16:40:29,690 ERROR [stderr] (http-/0.0.0.0:7080-2) (Position des Fehlers
unbekannt)org.apache.fop.pdf.PDFConformanceException: For PDF/A-1a, all fonts,
even the base 14 fonts, have to be embedded! Offending font: /Times-Roman
Here is my finally config file after adding your variations:
<fop version="1.0">
<accessibility>true</accessibility>
<renderers>
<renderer mime="application/pdf">
<pdf-a-mode>PDF/A-1a</pdf-a-mode>
<version>1.4</version>
<font kerning="yes"
embed-url="C:/Utilities/DejaVuSans.tff">
<font-triplet name="DejaVuSans" style="normal"
weight="400"/>
</font>
<font kerning="yes"
embed-url="C:/Utilities/DejaVuSans-Oblique.ttf">
<font-triplet name="DejaVuSans" style="italic"
weight="400"/>
</font>
<font kerning="yes"
embed-url="C:/Utilities/DejaVuSans-Bold.ttf">
<font-triplet name="DejaVuSans" style="normal"
weight="700"/>
</font>
<font kerning="yes"
embed-url="C:/Utilities/DejaVuSans-BoldOblique.ttf">
<font-triplet name="DejaVuSans" style="italic"
weight="700"/>
</font>
</renderer>
</renderers>
</fop>
Where could be this problem?
Thanks.
--
-----Ursprüngliche Nachricht-----
Von: Pascal Sancho [mailto:[email protected]]
Gesendet: Mittwoch, 6. Januar 2016 16:20
An: Tunahan Coban; [email protected]
Betreff: Re: Embedding Fonts for PDF/A
(Tunahan sent me the FO file off-list, due to confidential things)
Tunahan,
I can reproduce DejaVu substitution:
Your config lacks font descriptions for variations:
<font kerning="yes" embed-url="C:/Utilities/DejaVuSans-Oblique.ttf">
<font-triplet name="DejaVuSans" style="italic" weight="400"/> </font> <font kerning="yes"
embed-url="C:/Utilities/DejaVuSans-Bold.ttf">
<font-triplet name="DejaVuSans" style="normal" weight="700"/> </font> <font kerning="yes"
embed-url="C:/Utilities/DejaVuSans-BoldOblique.ttf">
<font-triplet name="DejaVuSans" style="italic" weight="700"/> </font>
2016-01-06 15:26 GMT+01:00 Tunahan Coban <[email protected]>:
Hi Pascal,
Thank you to invest your time for me. It is better for me that our conversation
don't been uploaded to the mail list site. Because of the internal
informations. I hope I understand you correctly with the xsl-fo file.
Now I have converted my XML file with the stylesheet to FO.
I will send you this as a mail-attachment.
When you could say me what kind of mistakes you search, so can I help
you.. Because the file is too long, you will see.. :/
Thanks so much !
--
-----Ursprüngliche Nachricht-----
Von: Pascal Sancho [mailto:[email protected]]
Gesendet: Mittwoch, 6. Januar 2016 14:43
An: Tunahan Coban
Betreff: Re: Embedding Fonts for PDF/A
Hi,
Please, rather than XSL stylsheet, it's easier for us to play with resulting
XSL-FO, witch can be achieved without FOP, using XALAN, for example.
And it is better to attach such file rather than copy/paste in mail
body: all blank spaces and lines are preserved, with actual used encoding.
2016-01-06 14:06 GMT+01:00 Tunahan Coban <[email protected]>:
Hi Pascal,
I sent the first part (because the file is 3000 lines long) from the
*.xsl file, too.
Here again:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.1"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:variable name="fo:layout-master-set">
<fo:layout-master-set>
<fo:simple-page-master master-name="simpleA4" page-height="29.7cm"
page-width="21cm" margin-top="2cm" margin-bottom="2cm" margin-left="2cm"
margin-right="2cm">
<fo:region-body margin-top="2cm" margin-bottom="2cm"/>
<fo:region-before extent="2cm"/>
</fo:simple-page-master>
</fo:layout-master-set>
</xsl:variable>
<xsl:template match="/">
<fo:root font-family="Arial">
<xsl:copy-of select="$fo:layout-master-set" />
<fo:page-sequence master-reference="simpleA4"
initial-page-number="1" format="1">
<fo:static-content flow-name="xsl-region-before">
<fo:block>
<fo:block>
<xsl:text>
</xsl:text>
</fo:block>
<fo:table table-layout="fixed" width="100%"
space-before.optimum="1pt" space-after.optimum="2pt">
<fo:table-column />
<fo:table-column />
<fo:table-column />
<fo:table-body>
<fo:table-row>
<fo:table-cell font-family="Arial"
text-align="center" padding-start="3pt" padding-end="3pt"
padding-before="3pt" padding-after="3pt" display-align="center"
border-style="solid" border-width="1pt" border-color="white">
<fo:block>
<xsl:for-each
select="data">
<xsl:for-each
select="texts">
<xsl:for-each
select="DateText">
<fo:inline
font-size="7pt">
<xsl:apply-templates />
</fo:inline>
</xsl:for-each>
</xsl:for-each>
</xsl:for-each>
…..
…
I tested now the normal PDF converting and its still does work. Only
the PDF/A doesn’t work..
Maybe my java-code is wrong?
// TODO:Fonts configuration in work
DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(new
File("cfg.xml"));
FopFactoryBuilder fopFactoryBuilder = new
FopFactoryBuilder(new File(".").toURI()).setConfiguration(cfg);
final FopFactory fopFactory = FopFactory.newInstance(new
File(".").toURI());
FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
foUserAgent.getRendererOptions().put("pdf-a-mode",
"PDF/A-1b");
OutputStream pdfOut = new
BufferedOutputStream(pdfOutputStream);
try {
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,
foUserAgent, pdfOut);
TransformerFactory factory =
TransformerFactory.newInstance();
Transformer transformer =
factory.newTransformer(styleSheet);
transformer.setParameter("versionParam", "2.0");
Result fopResult = new
SAXResult(fop.getDefaultHandler());
transformer.transform(xml, fopResult);
} finally {
pdfOut.close();
}
} catch (Exception e) {
e.printStackTrace(System.err);
}
}
Thanks !
--
--
pascal
--
pascal
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]