PDF/A-3 permits the embedding of files in any format. PDF/A-3 documents allow the progression from electronic paper to an electronic container that holds the human and machine-readable versions of a document. Applications can extract the machine-readable portion of the PDF document in order to process it. A PDF/A-3 document can contain an unlimited number of embedded documents for different processes.
Smart Document Container
In this sample application, we use a PDF document as a container to store an editable version and the DocumentViewer annotations as embedded files. The following illustration shows this container setup:
The advantage in this scenario is that the PDF can be send to anyone outside of your infrastructure and the current version of the document is always visible for everyone using a simple Acrobat Reader. The viewable version always reflects the most current version.
In this sample, you can create a new Smart Document by clicking New Smart Document:
The static method CreateNewDocument of the SmartDocument class creates a blank document using a Server
╰ TXTextControl Namespace
╰ ServerTextControl Class
The ServerTextControl class implements a component that provide high-level text processing features for server-based applications. instance. This document is saved in the internal Text Control format to be embedded into a newly created PDF document.
It opens the TX Text Control document editor that can be used to create a document:
When loading the original, embedded document, the ExtractSmartDocument method opens the PDF in order to check the embedded files for the original document or the annotations JSON. In case the document should be edited, the embedded original document is loaded into the editor.
When saving the original document, the method SaveDocument is loading the modified version into a ServerTextControl to create the updated PDF representation container by including itself as an embedded file.
Back in the overview, this new document can be edited or viewed:
When clicking View (Annotations), the original, editable version of the document is opened in the TX Text Control DocumentViewer that can be used to add annotations:
When clicking Save Annotations, the annotations JSON is stored as an embedded file in the container PDF. Therefore, the associated container PDF is loaded and the original document is extracted. This original document is then loaded and used to create the new PDF document to embed the original version and the annotation JSON.
Download the Sample
This concept is very flexible and can be used for your own formats and workflows. To test this on your own, download the fully-functional sample project from GitHub and let us know, if you have any questions or feedback.