I am having trouble with getting the PDFTranscoder to output text instead of 
glyphs.  I have tried just about everything, and I was wondering if anyone 
could help me out.  For my latest try, I basically modified some code I found 
somewhere on the internet, it is below.
 
Could someone inspect it really quickly and tell me what might be wrong?  I am 
not getting any errors, but the resulting PDF (It is a webbased program and I 
return the ByteArrayOutputStream PDF to the browser) has the text rendered as 
glyphs.
Thanks for your time,
 
Shaun Roach
 
 
Code Section:
 
public ByteArrayOutputStream makeSVGaPDF() {
 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 try
 {
  File userConfigFile = new File("C:/userconfig.xml");
  Options options = new Options();
  options.loadUserconfiguration(userConfigFile);
  AbstractFOPTranscoder transcoder = new org.apache.fop.svg.PDFTranscoder();
  DefaultConfigurationBuilder cfgBuilder = new DefaultConfigurationBuilder();
  Configuration cfg = cfgBuilder.buildFromFil(userConfigFile);
  ContainerUtil.configure(transcoder, cfg);
  TranscoderInput input = new TranscoderInput(
   new FileInputStream("C:/start.svg"));
  TranscoderOutput output = new TranscoderOutput(baos);
  transcoder.transcode(input, output);
 }
 catch(Throwable t)
 {
  t.printStackTrace();
 }
 return baos;    
}

C:\userconfig.xml:
<configuration>
<entry>
  <key>strokeSVGText</key>
  <value>false</value>
</entry>
<fonts>
 <font metrics-file="C:\arial.xml" kerning="yes" 
embed-file="C:\\WINNT\Fonts\arial.ttf">
    <font-triplet name="Arial" style="normal" weight="normal"/>
    <font-triplet name="ArialMT" style="normal" weight="normal"/>
 </font>
</fonts>
</configuration>

C:\start.svg:
<?xml version="1.0"?>
<svg width="650" height="842" preserveAspectRatio="xMinYMin meet"  viewBox="0 0 
650 842" >
<text x="60" y="190" font-family="Arial" font-weight="bold" font-size="23pt" 
text-anchor="start">TEXT ME</text>
</svg>

Reply via email to