I was trying to use EmbeddedFiles.Count (as below) to determine if a PDF file has attachments, but
the APi returns zero for a PDF with attachments.
Is there an (efficient) API to query if a PDF has file attachments?
The only thing I have found is to try and extract them as described at:
but that seems inefficient
// Create Blank Page Pdf
string pdfFileName = “CreateFileAnnotation.pdf”;
Document pdfDocument = new Document();
// Modify the PDF to add a file attachment PdfContentEditor editor = new PdfContentEditor(); editor.BindPdf(pdfFileName); editor.CreateFileAttachment(new System.Drawing.Rectangle(50, 50, 10, 10), "here", attachedPdf, 1, "Paperclip", 0.005); editor.Save(pdfFileName+ ".out.pdf"); // Inspect PDF to determine if it has file attachments pdfDocument = new Document(pdfFileName + ".out.pdf"); int embeddedFilesCount = pdfDocument.EmbeddedFiles.Count; Console.WriteLine("The resulting PDF has EmbeddedFiles Count: " + embeddedFilesCount);