You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Adis Katkic <d9...@hotmail.com> on 2002/12/12 08:46:47 UTC

Croatian characters in fop created pdf

Hi
I have created I java class that takes xml file and xsl file and creates 
pdf.

Now my xml has croatian character and those are showen as #.
I read documentation and it says that fonts must be avaliable on the 
platform.
Now I don't understand this since I have croatina locale set and I can view 
pdf files that have
croatian characters.
I have tried to use different font familises for fo:block tag. (Arial, 
Symbol etc ...)


What should I do to make it work. If you can explain it to me step by step I 
would be very thankful.

My method is

public void createPdf(String xml, String xslPath, String outputPdfPath) 
throws TransformerConfigurationException, TransformerException, 
FileNotFoundException, FOPException, IOException
  {
    Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
    MessageHandler.setScreenLogger(log);
    FileOutputStream fos=new FileOutputStream(outputPdfPath);

    //Options options = new Options(new 
File("c:\\Adis\\MedicSoft\\MedicsoftClient\\GUI\\config\\print\\userconfig.xml"));
    Driver driver=new Driver();
    driver.setLogger(log);
    driver.setOutputStream(fos);
    driver.setRenderer(Driver.RENDER_PDF);
    StreamSource xmlStreamSource=new StreamSource(new StringReader(xml));
    Transformer 
transformer=TransformerFactory.newInstance().newTransformer(new 
StreamSource(xslPath));
    transformer.transform(xmlStreamSource, new 
SAXResult(driver.getContentHandler()));
    fos.close();
  }

and xsl that is used for fop is very easy

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
   <fo:layout-master-set>
     <fo:simple-page-master master-name="simple"
                   page-height="29.7cm"
                   page-width="21cm"
                   margin-top="1cm"
                   margin-bottom="2cm"
                   margin-left="2.5cm"
                   margin-right="2.5cm">
       <fo:region-body margin-top="3cm"/>
       <fo:region-before extent="3cm"/>
       <fo:region-after extent="1.5cm"/>
     </fo:simple-page-master>
   </fo:layout-master-set>

   <fo:page-sequence master-reference="simple">
   	<fo:flow flow-name="xsl-region-body">
   	       <xsl:apply-templates select="data"/>
   	</fo:flow>
   </fo:page-sequence>
  </fo:root>
</xsl:template>

<xsl:template match="data">
       <fo:block>
       	<xsl:apply-templates select="name"/>
       	<xsl:apply-templates select="description"/>
       </fo:block>
</xsl:template>

<xsl:template match="name">
       <fo:block font-size="18pt"
             font-family="sans-serif"
             line-height="24pt"
             space-after.optimum="15pt"
             background-color="blue"
             color="white"
             text-align="center"
             padding-top="3pt">
         <xsl:value-of select="."/>
       </fo:block>
</xsl:template>

<xsl:template match="description">
       <fo:block font-size="12pt"
                 font-family="Symbol"
                 line-height="15pt"
                 space-after.optimum="3pt"
                 text-align="justify">
		<xsl:value-of select="."/>
	</fo:block>
</xsl:template>

</xsl:stylesheet>




_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Croatian characters in fop created pdf

Posted by Keiron Liddle <ke...@aftexsw.com>.
> The default pdf fonts only have a certain set of characters.

I just found on this page:
http://partners.adobe.com/asn/developer/technotes/fonts.html
the CMAPS of the core fonts (down the bottom).

Does anyone know if they correspond (with data) to our xml font files.

Also is there anywhere that shows a list of the glyphs
for these fonts, preferably with a picture. So that it
is easier to find if a font has the characters needed.




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: Croatian characters in fop created pdf

Posted by Keiron Liddle <ke...@aftexsw.com>.
Hi,

I'll try to clarify the FAQ entry.

The short answer is that you need to configure it to embed the required
font and/or use the correct encoding for the characters in the XML.

The default pdf fonts only have a certain set of characters.

I don't know anything about croatian characters so I might need some
more help from you.

btw this is more of a user question.

Keiron.

On Thu, 2002-12-12 at 08:46, Adis Katkic wrote:
> Hi
> I have created I java class that takes xml file and xsl file and creates 
> pdf.
> 
> Now my xml has croatian character and those are showen as #.
> I read documentation and it says that fonts must be avaliable on the 
> platform.
> Now I don't understand this since I have croatina locale set and I can view 
> pdf files that have
> croatian characters.
> I have tried to use different font familises for fo:block tag. (Arial, 
> Symbol etc ...)
> 
> 
> What should I do to make it work. If you can explain it to me step by step I 
> would be very thankful.
> 
> My method is



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org