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 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:
File Attachment Sample - Demonstrates how to handle file attachments in a PDF, which can be used to access embedded PDFs.
FDF Test Sample - Shows how to extract annotations and work with FDF/XFDF.
You can find information correlating to your needs below:
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