0

We have just upgraded from 7 to 9 and unfortunately the guy who was running this quit and I am now in charge of this update. I am not too familiar with PDFlib either. From what I see we need to embed fonts because it no longer does this automatically for us. Below is a helper and the call to set a font.

public function setFont($name,$font)
    {

        $this->p->set_parameter("FontOutline", $name."=".Zend_Registry::get('fontPath').$font); 
    }

From what I read you have to set the embed on the load_font() function. Yet I don't see that. Also below is the call we make on the document.

$helper->setFont('MinionPro-Regular','MinionPro-Regular.otf');

Not sure if this helps, but hopefully someone can point me in the right direction. Thanks for any help.

Jcdevelopment
  • 51
  • 2
  • 8

1 Answers1

1

for embedding a font, you should set the embedding option in the load_font() option list. The line above, just do a matching for a font name to a font file. This do not load a font.

Please check your code for a line which

$this->p->load_font($name, "winansi", "");

There you have to add "embedding" to the option list. Unfamiliar with the PDFlib API, please check the PDFlib 9 API Reference for details, which is bundled to your PDFlib 9 package within the doc directory.

see also the answer to your posting on the PDFlib mailing list: https://groups.yahoo.com/neo/groups/pdflib/conversations/messages/22126

Rainer
  • 2,013
  • 1
  • 10
  • 7
  • I have been reading the cookbook, the only problem is that it does not show you how to implement embedding into the fontoutline. I have changed the previous code to: $this->p->set_option("FontOutline={".$name."=".Zend_Registry::get('fontPath').$font."}"); Yet, not sure how to add the embedding option – Jcdevelopment May 09 '14 at 22:45
  • you should check the API reference or the Tutorial for a detailed explanation. The cookbook is a collection of sample codes which will only help, when you know the basics. Please read my comment again, embedding is an option for _load_font()_ not for the font configuration. – Rainer May 13 '14 at 14:39
  • Turns out we were properly embedding the fonts. The issue was, some fonts had licensing restrictions on them. I guess in version 7 these were no affected. Thank you for your help. – Jcdevelopment May 14 '14 at 15:53
  • Also previous PDFlib version (like PDFlib 7) honor the embedding restrictions for fonts. So I assume, something else was the origin of your problems. – Rainer May 15 '14 at 10:59
  • You are right, that was not the solution. Yet i changed everything and maybe i am missing one thing. So far I followed everything and yet this does not work. public function setFont($name,$font) { $setfont = Zend_Registry::get('fontPath').$font; $this->p->set_option("FontOutline={".$name."=".$setfont."}"); $this->p->load_font(".$name.", "unicode", "embedding"); } – Jcdevelopment May 20 '14 at 17:35