Getting Started with APDFL in Qt Creator
Estimated Reading Time: 3 MinutesThis short guide will focus on creating the following type of Qt Project:
- Qt Console Application
- qmake build system
- MSVC kit
NOTE: This guide references two files, "main.cpp" and "HelloAPDFL.pro". The raw text will be included at the end of this article.
1.
Open Qt Creator and create a new Project. Select Qt Console Application.
2.
Name your new project and select “qmake” as build system.
3.
When you reach the “Kits” step, select the MSVC option. It should look something like this:
Click through and Select “Finish”
4.
Accompanying this document should be two files: main.cpp and TestAPDFL.pro. Paste the contents of these files into the main.cpp and [your_project_name].pro that were created upon finishing the previous step.
Your project’s main.cpp should look something like this:
Your project’s .pro file should look something like this:
Your main.cpp will show a lot of errors, but they should go away in the following steps.
5. You will need to place the APDFL package into a directory that looks like this:
HelloAPDFL\build\Desktop_Qt_6_6_3_MSVC2019_64bit-Debug
Where “HelloAPDFL” is the project’s working directory. The last directory’s name will change based on your versions of Qt and MSVC (so note that you will likely have to change the string on line 2 of main.cpp to reflect this, as well as the paths in the .pro file)
6.
At this point you can build the project, but it will most likely fail. Restart Qt, reopen your project and try to build it again. It should work this time.
7.
Run your project and the program should output:
Congratulations! You’ve run an APDFL application in Qt! If you have any further questions, run into trouble, or are missing the aforementioned files, please contact tech_support@datalogics.com and someone will be happy to assist you.
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
main.cpp RAW TEXT:
//#include <QCoreApplication>
#include "build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Sample_Source/_Common/InitializeLibrary.h"
// This simple APDFL application initializes and validates the library.
int main(int argc, char *argv[])
{
ASErrorCode errCode = 0;
APDFLib libInit;
if (libInit.isValid() == false) {
errCode = libInit.getInitError();
std::cout << "Initialization failed with code " << errCode << std::endl;
return libInit.getInitError();
}
else {
std::cout << "Hello! I'm APDFL!" << std::endl;
}
}
HelloAPDFL.pro RAW TEXT:
QT = core
CONFIG += c++17 cmdline
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Include/Source/PDFLInitCommon.c \
$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Include/Source/PDFLInitHFT.c \
$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Sample_Source/_Common/InitializeLibrary.cpp \
$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Sample_Source/_Common/APDFLDoc.cpp \
HEADERS += \
$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Include/Headers
DEFINES += \
+= _CRT_SECURE_NO_WARNINGS \
+= _CONSOLE \
+= _DEBUG \
+= _WIN32 \
+= WIN32 \
+= WIN_ENV \
+= WIN_PLATFORM \
+= PI_ACROCOLOR_VERSION=AcroColorHFT_VERSION_6 \
+= PRODUCT=\\\"HFTLibrary.h\\\" \
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Binaries/ -lDL180PDFL
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Binaries/ -lDL180PDFL
INCLUDEPATH += $$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Binaries
INCLUDEPATH += $$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Include/Headers
DEPENDPATH += $$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Binaries
DEPENDPATH += $$PWD/build/Desktop_Qt_6_6_3_MSVC2019_64bit-Debug/APDFL/CPlusPlus/Include/Headers