Frequently Asked Question:
Can I use Quick PDF Library with Borland C++ Builder 3?
Question
Please let me know if I can use Quick PDF Library with Borland C++ Builder 3?
Answer
Yes, you can. Here are the steps required to get Quick PDF Library working with Borland C++ Builder 3:
- Extract Sample/CPlusPlus files
- Copy QuickPDFDLL0717.dll, QuickPDFDLL0717.cpp, and QuickPDFDLL0717.h to the project directory
- In the project file, select Project/Add to Project... and include QuickPDFDLL0717.cpp in the project
Add the following code to the source and your ready to go:
include "QuickPDFDLL0717.h"
void __fastcall TfrmForm::btnOpenPDFClick(TObject *Sender)
{
// Declare and load Quick PDF Library DLL
QuickPDFDLL0717
QP("C:\dll_location_path_name_here\QuickPDFDLL0717.dll");
// Library key
std::string strLicenseKey = "your_license_key_here";
// PDF output filename
std::string strFileName = "hello-world.pdf";
// Display message containing the library version
std::string strMessage = ("Quick PDF Library Hello World
sample");
strMessage.append("\n");
strMessage.append("Library version: " + QP.LibraryVersion());
// Unlock the library
int iResult = QP.UnlockKey(strLicenseKey);
if(iResult == 1)
{
strMessage = "\n";
strMessage = "Valid license key: " + QP.LibraryVersion();
// Draw the 'Hello World' text on the PDF page
QP.DrawText(100, 500, "Hello world from C++");
// Attempt to save the file
if(QP.SaveToFile(strFileName) == 1)
{
// Display message that the 'Hello Word' file has been
written successfully
}
else
{
// Display cannot write to file message
}
}
else
{
// Display invalid license key message
}
}