We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Font embedded status is not returning correctly for Descendant fonts by AsposePDF.Net

One of the feature in our application is to check if the fonts in a PDF file are embedded or not. While you have the function to get embed status, in some cases aspose is reporting the status incorrectly.
Please see attached file (font-Embedded.jpg), the fonts marked in RED color using descendent font and in one case AsposePDF.Net is retuning the right value for embedded status while in other case it returning a incorrect embed status.
We like to know how we can get the font embedded status in this particular case. I am using Aspose.PDf v17.4.0

I am using below code to get font embedded status:
//////////// Code Start

string FontEmbedded = "No";
Document pdfdoc = new Document(sPDFFilePath);
Aspose.Pdf.Page page = pdfdoc.Pages[1];
FontCollection fontcoll = page.Resources.Fonts;
foreach (Font font in fontcoll)
{
if (font.IsEmbedded)
{
FontEmbedded = "Yes";
}
}

//////////// Code End

Font-Embedded.jpg (66.8 KB)

Thanks

Chenna Basappa

@chennabasappa.c

Thanks for contacting support.

Would you please share your input document upon which you are testing the shared code snippet. This would help us in testing the scenario in our environment and respond you accordingly.


Best Regards,
Asad Ali

sample-descendant-font.pdf (276.7 KB)

Hi Asad Ali,

Thanks for your response. Please find attached PDF file “sample-descendant-font.pdf” as requested by you for your investigation.

Regards,
Chenna Basappa

@chennabasappa.c

Thanks for sharing the sample document.

I have tested the scenario in our environment with latest version Aspose.Pdf for .NET 17.7, using following code snippet and I was unable to notice any issue. The API returned correct information regarding fonts as you can also check the attached screenshot of the result over our end.

//////////// Code Start
Document pdfdoc = new Document(dataDir + "sample-descendant-font.pdf");
Aspose.Pdf.Page page = pdfdoc.Pages[1];
FontCollection fontcoll = page.Resources.Fonts;
foreach (Aspose.Pdf.Text.Font font in fontcoll)
{
 Console.WriteLine("Font : " + font.FontName + ", IsEmbedded : " + (font.IsEmbedded == true ? "Yes" : "No"));
}
//////////// Code End

Font_IsEmbedded.png (24.9 KB)

Please note that it is always recommended to use latest version of the API as it contains all fixes and enhancements. Please download latest version by click on the link shard above and in case if you still face any issue, please feel free to let us know.


Best Regards,
Asad Ali

Hi Asad Ali,

Thank You for responding to this.

You are right AsposePDF.net is reporting correctly. The issue is with Adobe Acrobat, there is a mismatch of Font embedded status shown in “Adobe Preflight” versus “Adobe Document properties”. When I compare with “Adobe Preflight” there is mismatch against Aspose, I should compare against “Adobe Document Properties”.

For now this issue is resolved.

Thanks,
Chenna Basappa

@chennabasappa.c

Thanks for your feedback and sharing more details.

We are pleased to know that your issue is resolved. Please keep using our API and in the event of any further query, please feel free to contact us.


Best Regards,
Asad Ali