A document event occurs any time you open or create a new document using the SDK. In other words, any time you load a document into memory, it is counted as a document event.
Any operations that you make on a document after it's been loaded are not document events. You can perform as many operations on an opened document as you want without incurring additional document events.
The following sections include just a few languages as examples, but the rules apply to all languages that our SDKs support.
Opening files
In WebViewer, loading a new file into the viewer or into memory in any way counts as a document event. Interacting with that document after its loaded will not count as additional document events.
Creating a new blank file in WebViewer or the server SDKs counts as a document event.
1// Counts as a document event
2const doc = await PDFNet.PDFDoc.create();
1// Counts as a document event
2PDFDoc doc;
1// Counts as a document event
2PDFDoc doc = new PDFDoc();
Converting files
Some APIs allow you to convert a file and write it to disk. In the event where you want to perform additional operations on the converted file, loading it into memory will count as a document event.
Operations that input multiple files may count as more than one document event. For example, merging two documents into one will count as two document events.
1// This counts as two document events, we are loading two documents into memory.
In operations like merging, it is recommended that you merge one document into another (2 document events), rather than creating a new blank file and then merging two documents into it (which would be 3 document events).
Saving files
Saving files does not count as a document event. After the document has been loaded into memory, you can save that document as many times as you want without incurring additional document events.
For example, you could load a file into memory (1 document event), and then convert that file to 5 different formats while only incurring 1 document event.
Additional information
If you are still unsure about what counts as a document event, or you're not sure how many document events your project will use, please reach out to our support team for more information.