FreeText annotation loses font family

Product: Apryse SDK PHP

Product Version: 10.9.0

Please give a brief summary of your issue:
In our project, we have a webviewer running in which the user can add all types of annotations. When ready, they will save. This save request calls our PHP code in which we have a custom saving procedure. We’re saving FreeText annotations (along with these other types) like this (shortened for readability):

$textRect contains the bbox of the annot, $font holds the font-family, $text is the content of the annot.

function saveFreeTextAnnotations(PDFDoc $document, Rect $textRect, string $font, string $text){
 $sdfDoc = $document->GetSDFDoc();
 $page = $document->GetPage(1);
 $freeText = FreeText::CreateAnnot($sdfDoc, $textRect);
 $freeText->SetFontName($font);
 $freeText->SetFontSize(12);
 $freeText->SetQuaddingFormat(0);
 $freeText->SetContents($text);
 $freeText->RefreshAppearance();
 $page->annotPushBack($freeText);
} 

Finally, after everything is saved, the PDF is saved with

$document->Save(".../test.PDF", SDFDoc::e_remove_unused);

When we download this file, all annotations are included, but the text annotations all lose their font-family and are displayed in (what I’m guessing is) a default fallback font. (Using Google Chrome to view the PDF)

Possible values for $font are: “Times New Roman”, “Helvetica”, “Arial”, “Cambria”, “Courier”, “Georgia”, “Roboto”, “Verdana”.

Shouldn’t my desktop fill in the fonts? or do I have to embed the fonts somehow? In case it’s the latter, how do I embed them so the text annotations can find them? I’ve tried Font::CreateTrueTypeFont but I’ve only gotten it to work with the ElementWriter.

Thank you for posting your question to our forum. We will provide you with an update as soon as possible.

Hi there,

Please see our forum post here on embedding missing fonts into the PDF:

If you are using element writer, you can follow this forum post:

If the above does not work for you, could you please share the input & output file with the exact reproduction steps and code snippets used.

Best regards,
Kevin Kim