Cannot instantiate PDFDoc instance when apostrophe in filename


When I call PDFDoc doc(szFileName); and szFileName contains an apostrophe in it there is an exception.


Since you are using C++ unfortunately C++ never got “strings” correct with regards to Unicode, and a std::string have no known encoding. As such PDFTron SDK has to assume an encoding, which is UTF8, but that is often enough not correct.

Instead, please create a UString object with your string, and pass the UString to the PDFDoc constructor.

With UString you can pass in other encodings.