> Le 13 nov. 2018 à 18:46, Michal Sudolsky <sudols...@gmail.com> a écrit :
> 
> Whether I use this:
> 
> PdfDocument::CreateFontSubset("Arial", false, false);
> 
> Or this:
> 
> PdfDocument::CreateFont("Arial", false, false, false, 
> PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), 
> PdfFontCache::eFontCreationFlags_Type1Subsetting);
> 
> It produces invalid pdf. Acrobat says "The font 'AAAAAA+ArialMT' contains bad 
> /Widths." and indeed it does not have widths:
> 
> 19 0 
> obj<</Type/Font/BaseFont/AAAAAA+ArialMT/Encoding/WinAnsiEncoding/FontDescriptor
>  20 0 R/Subtype/TrueType>>

For what it's worth (as a user of PoDoFo 0.9.5) I use the following code to 
embed Consolas:

PdfDocument::CreateFontSubset("Consolas", false, false, false, 
PdfEncodingFactory::GlobalIdentityEncodingInstance());

And for Arial which is ubiquitous, I simply do not embed it, quite successfully 
with :

PdfDocument::CreateFont("Arial", false, false, false,
                                
PdfEncodingFactory::GlobalWinAnsiEncodingInstance(),
                                
PdfFontCache::eFontCreationFlags_AutoSelectBase14,
                                false /* Don't embed */);

I must say and admit my use case is somewhat specific because those PDFs are 
built by some process, transmitted over the network to another one, which will 
display them or print them.  The whole production of PDF is used as an 
intermediate medium between one remote non interactive part of the software and 
a GUI part running on other systems, which contains display and printing 
capabilities.  So that the remote non interactive part can build printed 
reports, even to be physically printed the next second by the GUI component, in 
full abstraction of any knowledge of the printer or display devices (except the 
page format).

I don't exactly remember, why I had to choose GlobalIdentityEncodingInstance() 
for CreateFontSubset.

-- 
Best Regards, Meilleures salutations, Met vriendelijke groeten,
Olivier Mascia





_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to