Need to check input file details

Hi Team,

Could you please provide us the code snippet/how to check for the following queries using Aspose APIs.

  1. if input PDF is a valid PDF/A
  2. if input PDF has attachments
  3. if input PDF is signed
  4. if input PDF has unknown fonts

Thanks,
Kavitha

@Kofax_Business_Communications

Thanks for contacting support.

You can validate a PDF document for any PDF/A format offered by the API.

You can get All Attachments from a PDF document and check the Count of EmbeddedFiles to determine whether there is any attachment or not.

Please check linked article to determine whether a PDF is signed or not.

You can get all fonts from a PDF document and check using following code snippet if they exist in your system or not:

Document doc = new Document(dataDir + "input.pdf");
Aspose.Pdf.Text.Font[] fonts = doc.FontUtilities.GetAllFonts();
foreach (Aspose.Pdf.Text.Font font in fonts)
{
    try
    {
      Aspose.Pdf.Text.Font font = FontRepository.FindFont(font.FontName);
      Console.WriteLine(font.FontName + " is present.");
    }
    catch(FontNotFoundException ex)
    {
      Console.WriteLine("UnknowFont");
    }
}