Print Page | Close Window

Help Using AddTrueTypeSubsettedFont

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3751
Printed Date: 24 Apr 24 at 10:27AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Help Using AddTrueTypeSubsettedFont
Posted By: mmaclean
Subject: Help Using AddTrueTypeSubsettedFont
Date Posted: 18 Oct 19 at 3:03PM
I have a programming loop that adds Unicode strings to a PDF file.
When I call AddTrueTypeSubsettedFont() function I get a new fontID each time and my file size get very large. Does this mean that QuickPDF is adding a new font for each sting I add?
Would calling UpdateTrueTypeSubsettedFont() make a smaller sized file? What font is updated when I call this function? Does anyone have a clear example of how to use these two functions?



Replies:
Posted By: Ingo
Date Posted: 18 Oct 19 at 10:48PM
Hi mmaclean,

inside there's a special chapter having to do with "PDF Fonts":
http://www.debenu.com/docs/pdf_library_developer_guide/foxit_quick_pdf_library_15_developer_guide.pdf

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: mmaclean
Date Posted: 21 Oct 19 at 1:18PM
Hello Mr. Ingo,

Thank you for the information, however, I have read that section and in fact most of the QuickPDF developer's guide and function reference manual and they have not come close to answering the questions I have, which is why I posted on this site. Perhaps some kind programmer will have already figured out what I am asking by trial and error.


Posted By: tfrost
Date Posted: 21 Oct 19 at 2:53PM
The documentation for UpdateTrueTypeSubsettedFont() clearly says that it updates the selected font. So, add the characters you want, select the font, update it with more characters.  No trial and error should be involved, just trial in your own program, and see if the file size is reduced.  My guess is that it will be; but like many users here I have not used every function in the library, including this one.


Posted By: Renaud
Date Posted: 03 Jul 20 at 3:11PM
Hello Everyone, 

I wouldlike to share some experience about AddTrueTypeSubsettedFont and UpdateTrueTypeSubsettedFont

using active X version 16.13 of quick pdf.

function seems to always return 0 ( even when it worked)

if you AddTrueTypeSubsettedFont with option 2, 4, 5

UpdateTrueTypeSubsettedFont works until you close the file.

when you LoadFromfile a PDF containing a subsetted font added with AddTrueTypeSubsettedFont

and you FontSelect this font, AddTrueTypeSubsettedFont do not work.

something like that do not work : 


$fid = $qp->AddTrueTypeSubsettedFont("Arial Unicode MS","A" , 2);
$qp->SaveToFile("out.pdf");
$doc_id = $qp->SelectedDocument();
$qp->RemoveDocument($doc_id);

$qp->LoadFromFile(__DIR__ ."\\out.pdf","");
$totalfont =$qp->FindFonts();
$ffid =0; 
for ($f = 1 ; $f<= $totalfont; $f++){
    $fid =$qp->GetFontID($f);
    $qp->SelectFont($fid);
    if ((strpos($qp->FontName(), 'Arial Unicode MS') !== false)&&$fid!=0) {
        $ffid =  $fid ;
    }
}
$qp->SelectFont($ffid)
$textRussian = "toto Нет никого, кто любил бы боль саму по себе, кто искал бы её и кто хотел бы иметь её просто потому, что это боль";
$qp->UpdateTrueTypeSubsettedFont($textRussian);
$qp->DrawText(10, 180, $textRussian );





Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk