Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embedding font support #6

Open
aeischeid opened this issue Sep 10, 2010 · 1 comment
Open

Embedding font support #6

aeischeid opened this issue Sep 10, 2010 · 1 comment

Comments

@aeischeid
Copy link
Owner

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

@aeischeid
Copy link
Owner Author

sweet, looks like a good fix to embedding fonts. might need some tweaking because people aren't going to want to edit the config file of the plugin itself, but rather in their application ... but maybe that is what you meant... anyway I'll see if I can get it in soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant