3#ifndef PDFSDK_CXX_CORE_H_INCLUDED_
4#define PDFSDK_CXX_CORE_H_INCLUDED_
6#include <pdfsdk/core.h>
10#include <pdfsdk/cxx/clip.h>
11#include <pdfsdk/cxx/collection.h>
12#include <pdfsdk/cxx/color.h>
14#include <pdfsdk/cxx/content.h>
15#include <pdfsdk/cxx/dest.h>
16#include <pdfsdk/cxx/document.h>
17#include <pdfsdk/cxx/element.h>
18#include <pdfsdk/cxx/filespec.h>
19#include <pdfsdk/cxx/font.h>
20#include <pdfsdk/cxx/form_field.h>
21#include <pdfsdk/cxx/function.h>
22#include <pdfsdk/cxx/gstate.h>
23#include <pdfsdk/cxx/object.h>
24#include <pdfsdk/cxx/optional_content.h>
25#include <pdfsdk/cxx/page.h>
27#include <pdfsdk/cxx/pattern.h>
28#include <pdfsdk/cxx/progress_monitor.h>
29#include <pdfsdk/cxx/read_stream.h>
30#include <pdfsdk/cxx/shading.h>
31#include <pdfsdk/cxx/soft_mask.h>
33#include <pdfsdk/cxx/struct_tree.h>
34#include <pdfsdk/cxx/text_run.h>
35#include <pdfsdk/cxx/write_stream.h>
36#include <pdfsdk/cxx/xgroup.h>
37#include <pdfsdk/cxx/xobject.h>
53inline void Init(std::string_view licenseKey,
54 const std::filesystem::path& resourcesDir = std::filesystem::path(),
55 const std::filesystem::path& tempDir = std::filesystem::path(),
56 const std::filesystem::path& appDataDir = std::filesystem::path()) {
57 std::wstring resourcesDirStr = resourcesDir.wstring();
58 std::wstring tempDirStr = tempDir.wstring();
59 std::wstring appDataDirStr = appDataDir.wstring();
61 PDInitData initdata = {};
62 initdata.resourcesDirectoryPath = resourcesDirStr.c_str();
63 initdata.tempDirectoryPath = tempDirStr.c_str();
64 initdata.appDataDirectoryPath = appDataDirStr.c_str();
66 std::string licenseKeyStr{licenseKey};
67 PDF_CHECK_SUCCESS_X(PDInit(licenseKeyStr.c_str(), &initdata,
"cxx"));
76inline void Done() noexcept {
101 const std::filesystem::path& resourcesDir = std::filesystem::path(),
102 const std::filesystem::path& tempDir = std::filesystem::path(),
103 const std::filesystem::path& appDataDir = std::filesystem::path()) {
104 Init(licenseKey, resourcesDir, tempDir, appDataDir);
131inline PDAtom Atomize(
const char* c_str) {
132 PDAtom atom = kPDAtomNull;
133 PDF_CHECK_SUCCESS_X(PDAtomPutString(c_str, &atom));
146inline PDAtom Atomize(
const std::string& str) {
147 return Atomize(str.c_str());
159inline PDAtom Atomize(std::string_view sv) {
160 return Atomize(std::string{sv});
172inline std::string AtomToString(PDAtom atom) {
173 const char* str =
"";
174 PDF_CHECK_SUCCESS_X(PDAtomGetString(atom, &str));
Represents a scope for initializing and cleaning up the PDF SDK.
Definition core.h:87
InitScope(const std::string &licenseKey, const std::filesystem::path &resourcesDir=std::filesystem::path(), const std::filesystem::path &tempDir=std::filesystem::path(), const std::filesystem::path &appDataDir=std::filesystem::path())
Constructs an InitScope object and initializes the PDF SDK.
Definition core.h:100
~InitScope()
Destructs the InitScope object and cleans up the PDF SDK.
Definition core.h:113