Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Embed Font Subset in Existing Document

$
0
0
Hi,
I'm trying to embed fonts in an existing PDF document.  I'd like to subset the fonts (for size reduction).  I've tried the code below, but setting IsSubset either doesn't work (IsSubset called before IsEmbedded), or seems to just embed the entire font.  Am I using the correct method?  Using version 16.12.0.0.  Thanks.

            Document doc = new Document(@"C:\NotEmbedded.pdf");
            foreach (Page page in doc.Pages)
            {
                foreach (Aspose.Pdf.Text.Font font in page.Resources.Fonts)
                {
                    // Setting this first doesn't embed the fonts, and Adobe complains when reading the fonts in the new file
                    // font.IsSubset = true;

                    font.IsEmbedded = true;

                    // Setting here embeds the fonts, but doesn't reduce the size (same as without subset)
                    font.IsSubset = true;
                }
            }

            doc.Save(@"C:\Embedded.pdf");



Viewing all articles
Browse latest Browse all 3131

Trending Articles