File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ // //////////////////////////////////////////////////////////////////////////////////////////////////
2+ // AddComment.cpp
3+ // Copyright (c) 2018 Pdfix. All Rights Reserved.
4+ // //////////////////////////////////////////////////////////////////////////////////////////////////
5+ /* !
6+ \page CPP_Samples C++ Samples
7+ - \subpage Initialization_cpp
8+ */
9+ /* !
10+ \page Initialization_cpp Add Comment Sample
11+ Example how to add a text annotation with a reply.
12+ \snippet /Initialization.hpp Initialization_cpp
13+ */
14+
15+ #pragma once
16+
17+ // ! [Initialization_cpp]
18+ #include < string>
19+ #include < iostream>
20+ #include " Pdfix.h"
21+
22+ // Adds a new text annotation.
23+ void Initialization (
24+ std::wstring email, // authorization email
25+ std::wstring license_key // authorization license key
26+ ) {
27+ // initialize Pdfix
28+ if (!Pdfix_init (Pdfix_MODULE_NAME))
29+ throw std::runtime_error (" Pdfix initialization fail." );
30+
31+ Pdfix* pdfix = GetPdfix ();
32+ if (!pdfix)
33+ throw std::runtime_error (" GetPdfix fail" );
34+
35+ if (pdfix->GetVersionMajor () != PDFIX_VERSION_MAJOR ||
36+ pdfix->GetVersionMinor () != PDFIX_VERSION_MINOR ||
37+ pdfix->GetVersionPatch () != PDFIX_VERSION_PATCH)
38+ throw std::runtime_error (" Incompatible version" );
39+
40+ if (!pdfix->Authorize (email.c_str (), license_key.c_str ()))
41+ throw std::runtime_error (pdfix->GetError ());
42+
43+ // ...
44+
45+ pdfix->Destroy ();
46+ }
47+ // ! [Initialization_cpp]
You can’t perform that action at this time.
0 commit comments