Re: how to add a font to generate bar codes in my pdfs?

2004-10-25 Thread Raúl Herranz Serrano
Thanks for your answer... but I have got a question:

Do I overwrite the rest of the fonts (the deafult fonts, I mean...) with the
line Configuration.put(fonts, allFonts);?

Thanks again!

Raul (Spain)

- Original Message - 
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 25, 2004 5:17 PM
Subject: Re: how to add a font to generate bar codes in my pdfs?



It looks like you have the font file ready to go.  To get a barcode in the
PDF, I did the following:

1.  First, here is some sample java code to configure the fonts (you would
probably want to do this dynamically (read better):

Vector allFonts = new Vector();//you may have more than one
Vector allTrips = new Vector();

allTrips.add(new FontTriplet(fre3of9x,normal,normal));
allTrips.add(new FontTriplet(fre3of9x,bold,normal));
allTrips.add(new FontTriplet(fre3of9x,normal,italic));
allTrips.add(new FontTriplet(fre3of9x,bold,italic));
FontInfo fontInfo = new FontInfo(3OF9X,/fonts/fre3of9x.xml
,true,allTrips,/fonts/fre3of9x.ttf);//sample font
allFonts.add(fontInfo);

Configuration.put(fonts, allFonts);


2.  Next, create a text block that uses your barcode font family:

fo:block font-size=10pt color=black font-family=fre3of9x
112233
/fo:block

This works for me.

-Lou




  Raúl Herranz
  Serrano  To:
[EMAIL PROTECTED]
  [EMAIL PROTECTED] cc:
  es  Subject: how to add a font to
generate bar codes in my pdfs?

  10/25/2004 11:06
  Please respond
  to fop-user





Hi there!

I have the following method in a Servlet that helps me to output pdf files:


private ByteArrayOutputStream transform(Source xmlSrc, Source xslSrc)
throws TransformerConfigurationException, TransformerException
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
org.apache.fop.configuration.Configuration.put(baseDir,
BASE_DIR);
Driver driver = new Driver();
Logger logger = new Log4JLogger(log4j);
MessageHandler.setScreenLogger(logger);
driver.setLogger(logger);
driver.setRenderer(Driver.RENDER_PDF);
driver.setOutputStream(out);
TransformerFactory transformerFactory =
TransformerFactory.newInstance();
Transformer transformer =
transformerFactory.newTransformer(xslSrc);
Result res = new SAXResult(driver.getContentHandler());
transformer.transform(xmlSrc, res);
return out;
}

The problem is that right now I need to generate some bar codes in my pdfs
and I have think to embed a ttf font in my pdfs that I can use to generate
those barcodes. I have the ttf font file and the xml font metrics file but
right now I don´t know what must I add to the code to be able to use this
font in my pdfs... can you help me?

Thanks a lot!!

Raul (Spain)






-
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]



tutalii error??

2004-07-21 Thread Raúl Herranz Serrano




In OC4J with FOP 0.20.5... what is the problem with 
this piece of code?:

Tutalii: 
C:\desarrollo\java\install\oc4j\j2ee\home\applications\QuemasFOP\QuemasFOP\WEB-INF\lib/fop.jar[INFO] 
[1]


The code thatis generating this 
'error':

public ByteArrayOutputStream transform(Source 
xmlSrc, Source xslSrc) throws TransformerConfigurationException, 
TransformerException { 
ByteArrayOutputStream out = new ByteArrayOutputStream(); 
org.apache.fop.configuration.Configuration.put("baseDir","C:/desarrollo/java/install/oc4j/j2ee/home/applications/QuemasFOP/QuemasFOP/pages/baseDir"); 
Driver driver = new Driver(); Logger logger = new 
ConsoleLogger(ConsoleLogger.LEVEL_INFO); 
MessageHandler.setScreenLogger(logger); 
driver.setLogger(logger); 
driver.setRenderer(Driver.RENDER_PDF); 
driver.setOutputStream(out); TransformerFactory 
transformerFactory = TransformerFactory.newInstance(); 
Transformer transformer = 
transformerFactory.newTransformer(xslSrc); Result res = 
new SAXResult(driver.getContentHandler()); 
transformer.transform(xmlSrc, res); //this is the point where I get the 
tutalii error
 return out;
}


Thanks a lot!

 Raul Herranz 
(Spain)


Re: [XSL-FO] tutalii error??

2004-07-21 Thread Raúl Herranz Serrano

I have found that this is an error with the xml libraries that come with the
oc4j... I have to start the oc4j server with the following options:

-Xbootclasspath/a:/path to xml-apis.jar
-Xbootclasspath/a:/path to xalan-2.4.1.jar
-Xbootclasspath/a:/path to xercesImpl-2.2.1.jar

as I said before: amazing!! :)

Thanks everybody!!

Raul (Spain)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]