[ 
https://issues.apache.org/jira/browse/PDFBOX-1971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13925501#comment-13925501
 ] 

John Hewson commented on PDFBOX-1971:
-------------------------------------

There's no need to modify the source of PDFBox in order to embed fonts. The 
font constants defined in PDType1Font, such as HELVETICA, are used for fonts 
which are pre-defined by the PDF format, i.e. they come built-in to readers and 
so don't get embedded.

To embedded a custom Type 1 font you just need to do the following:

{code}
PDFont font = new PDType1AfmPfbFont(document,"LiberationSans-Bold.afm");
{code}

This will embed the .pfb and .afm data into the PDF, and the file size will be 
larger.

> Bad /bbox dialog after creating PDF with custom font
> ----------------------------------------------------
>
>                 Key: PDFBOX-1971
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-1971
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Writing
>    Affects Versions: 1.8.4
>         Environment: Linux and Windows
>            Reporter: janak
>         Attachments: Hello World.pdf, LiberationSans-Bold.afm, 
> LiberationSans-Bold.pfb, LiberationSans-Bold.ttf, LiberationSans-Regular.afm, 
> LiberationSans-Regular.pfb, LiberationSans-Regular.ttf, Main.java, pdfbox.zip
>
>
> I have tried with adding my customer font in PDFBox resource but it not 
> creating proper PDF. PDF was created successfully but its showing Font 
> contain bad /bbox dialogue while opening the pdf. What will be solution for 
> this.
> Testing with font : LiberationSans with Regular and Bold
> Also tried with loadTTF and PDType1AfmPfbFont  class but pdf was 150 times 
> larger then attached one.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to