View and extract annotations from file attachments in pdf file

Product: PDFTron.NET.x64

Product Version: 11.3.0

Please give a brief summary of your issue:
I need to export annotations from a PDF document and from its embedded PDF attachments (File Attachments) into XFDF. My current implementation only extracts annotations from the main pdf file. I would like to know if Apryse supports including annotation data from attached/embedded PDFs in a single XFDF output, or if these must be handled separately.

Here is my current implementation to create xfdf:

using (var xfdfDocument = pdfDocument.FDFExtract(PDFDoc.ExtractFlag.e_both))
{
var xfdf = xfdfDocument.SaveAsXFDF();
return new MemoryStream(Encoding.UTF8.GetBytes(xfdf));
}

Is there a way to also include the comments present in attachments?

And can you give me a brief overview as to how I am able to view comments of attachments in your demo website (JS PDF Multi-Tab Support Demo | Apryse WebViewer) in MultiTab view?
When I open a PDF attachment in a new tab, the comments for that attachment display correctly.

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.

To export annotations from both a PDF document and its embedded PDF attachments into XFDF, it is important to note that Apryse’s PDFTron SDK does not automatically handle annotations in embedded attachments during a single extraction process. Each embedded PDF must be individually processed to extract its annotations. This means you will need to iterate over the file attachments, open each one as a PDF document, and then extract annotations separately.

Some things you can try:


  • Iterate through the attachments in the main PDF document to identify PDF files.

  • For each PDF attachment, open it as a separate PDF document using PDFDoc constructor.

  • Extract annotations from each PDF attachment using the FDFExtract method, similar to how you are doing it for the main document.

  • Combine the XFDF outputs from the main document and each attachment if a single XFDF output is required.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

You can find information correlating to your needs below:

  1. Extracting annotations/comments from attachments
    You would need to extract each file from the PDF, then you could extract the comments and annotations as you did the original file.
    Extract Embedded Images from PDFs with SDK | Apryse attachment annotations

This is also how the Multi-Tab Support Demo extracts the comments from the attachments.
We have a workflow that extracts just the comments from the file, found in the following page:
https://community.apryse.com/t/how-do-i-get-all-the-annotation-comments-so-i-can-get-them-as-plain-text/

  1. Combining into one XFDF file
    We don’t provide this functionality in the current version of the Apryse SDK.

If you are still having troubles with this, could you please provide me with the sample file that you are currently working with?

Please let me know if you need anything else regarding this at this time.

Thanks,
Daniel House
Apryse Support

1 Like