aeischeid / grails-pdfplugin

simple plugin to generate PDF's from GSP's on the fly

Home | Edit | New

Home

Welcome to the grails-pdfplugin wiki!

I could not add an issue, so I am posting it here.

Embedding font support
Is it possible to add embedding font support to grails-pdfplugin? When creating pdfs in langages with diactric marks, letters with diactric marks are not shown since there is no embedded font to display them. To change it I have made following:

Added new configuration variable in Config.groovy:


pdfplugin.addFonts=["/media/disk/Windows/Fonts/arial.ttf"]

Modified PdfService.groovy
(added imports)

import com.lowagie.text.pdf.BaseFont
import org.codehaus.groovy.grails.commons.ConfigurationHolder

(after creating renderer add fonts)

	ITextRenderer renderer = new ITextRenderer();
	def fonts = ConfigurationHolder.config.pdfplugin.addFonts
	fonts.each {
		renderer.getFontResolver().addFont (it,
		    BaseFont.IDENTITY_H,
		    BaseFont.NOT_EMBEDDED);	
	}

Best,
Marcin

Last edited by mlepicki, Sat May 30 23:41:58 -0700 2009
Home | Edit | New
Versions: