Update documentation for PDFium initialization. Better explain PDFium initialization, and mention older initialization APIs/configs will be deprecated in the future. Do similar comment updates in public/fpdfview.h. Bug: pdfium:1446 Change-Id: I76acd76827fad6fe6a1bdf76f13b7dc20329e513 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/64453 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/docs/getting-started.md b/docs/getting-started.md index 0cf2ff3..6077d21 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md
@@ -30,10 +30,10 @@ ## Initializing PDFium -The first step to using PDFium is to initialize the library. Having done so, -you'll need to destroy the library when you're finished. When initializing the -library you provide the `FPDF_LIBRARY_CONFIG` parameters to -`FPDF_InitLibraryWithConfig`. +The first step to using PDFium is to initialize the library. Having done so, one +must destroy the library with `FPDF_DestroyLibrary()` when finished. When +initializing the library, provide the `FPDF_LIBRARY_CONFIG` parameters to +`FPDF_InitLibraryWithConfig()`. ```c #include <fpdfview.h> @@ -52,16 +52,19 @@ } ``` -Currently the `config.version` must be set to `2`. `m_pUserFontPaths` can be -used to override the font paths searched by PDFium. If you wish to use your -own font paths pass a `NULL` terminated list of `const char*` paths to use. +Currently the `config.version` must be set to `2`. Older versions works for +backwards compatibility, but will be deprecated eventually. + +`m_pUserFontPaths` can be used to override the font paths searched by PDFium. To +use a custom font paths, pass a `NULL` terminated list of `const char*` paths to +use. `m_pIsolate` and `m_v8EmbedderSlot` are both used to configure the V8 -javascript engine. In the first case, you can provide an isolate through -`m_pIsolate` for PDFium to use to store per-isolate data. Passing `NULL` will -case PDFium to allocate a new isolate. `m_v8EmbedderSlot` is the embedder data -slot to use in the v8::Isolate to store PDFium data. The value must be between -0 and v8::Internals::kNumIsolateDataSlots. Typically, 0 is a good choice. +JavaScript engine. For the V8 isolate, either provide an isolate through +`m_pIsolate` for PDFium to use to store per-isolate data, or pass `NULL` to tell +PDFium to allocate a new isolate. `m_v8EmbedderSlot` is the embedder data slot +to use in the v8::Isolate to store PDFium data. The value must be in the range +[0, `v8::Internals::kNumIsolateDataSlots`). Typically, 0 is a good choice. For more information on using Javascript see the [V8 Getting Started][pdfium-v8] guide.
diff --git a/public/fpdfview.h b/public/fpdfview.h index 901d7db..0542b05 100644 --- a/public/fpdfview.h +++ b/public/fpdfview.h
@@ -214,12 +214,14 @@ // None. // Comments: // Convenience function to call FPDF_InitLibraryWithConfig() for -// backwards comatibility purposes. +// backwards compatibility purposes. This will be deprecated in the +// future. FPDF_EXPORT void FPDF_CALLCONV FPDF_InitLibrary(); // Process-wide options for initializing the library. typedef struct FPDF_LIBRARY_CONFIG_ { // Version number of the interface. Currently must be 2. + // Support for version 1 will be deprecated in the future. int version; // Array of paths to scan in place of the defaults when using built-in @@ -234,9 +236,9 @@ void* m_pIsolate; // The embedder data slot to use in the v8::Isolate to store PDFium's - // per-isolate data. The value needs to be between 0 and - // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine - // for most embedders. + // per-isolate data. The value needs to be in the range + // [0, |v8::Internals::kNumIsolateDataLots|). Note that 0 is fine for most + // embedders. unsigned int m_v8EmbedderSlot; } FPDF_LIBRARY_CONFIG;