- Home
- Purchase
- Developer Tools
- BarCode Generator SDK
- BarCode Generator SDK for Javascript for Code 128
- BarCode Reader SDK
- PDF Generator SDK for Javascript
- PDF Extractor SDK
- PDF Renderer SDK
- PDF To HTML SDK
- PDF Viewer SDK
- Spreadsheet SDK
- Image To Video SDK
- Screen Video Capturing SDK
- SWF To Video and Images SDK
- Images Watermarking SDK
- Document SDK beta
- Misc Tools
- Desktop Utilities
- Download
- Support
- Company
The PDFDoc Scout SDK product has been acquired by Lionsoft company in January, 2011 and not available on our web-site anymore.
NEW: pdf generator for Web Developers: PDF Generator SDK for Javascript: click here to read more details...
For 3rd party C# open-source PDF generation library? Check the blog article: .NET Bear, Do You Know Any Free PDF Generation Libraries For Use In Commercial Applications?
Check our commercial products for PDF format:
PDF Extractor SDK - extract tables, text, structured data from PDF files in your apps
PDF Renderer SDK - render PDF files to PNG, BMP, TIFF images in your apps
PDF To HTML SDK - convert PDF to HTML with images and formatting preserved
Tutorial: how to create PDF document in VC++ (Visual C++) using PDFDoc Scout library
How to create PDF document file from Visual C++ using PDFDoc Scout library: "Hello, World!" example
You can download the source code of this example here: pdfdocscout_vc.zip
This tutorial will teach you how to create simple PDF document from VC++ using PDFDoc Scout library.
1) Install PDFDoc Scout library on your computer and run Visual C++
2) Select the "New.." command from "File" menu (as it is shown below) to run :

3)The New Project Wizard dialog will appear on the screen. Select "Win32 Console Application" project type and enter "HelloWorld" as the Project name as shown on the screenshot below:


4) The wizard will ask what kind of Console Application you want to create. Select A "Hello, World!" application and click Finish:

VC++ will show the summary information for a new project. Click OK:

Visual C++ will generate the application code for simple console application
Source code editor window will appear. To edit main() function just open the class tree on the left and double click on "H elloWorld Classes" | "Globals" | "main (int argc, char* argv[1])":

VC++ will open main() function:

5) To use PDFDoc Scout from VC++ application you have to tell the compiler to import type library information into the project.
To import the type library just add #import compiler directive after #include directive:
#import "PDFSDoccout.tlb"
using namespace PDFDocScout;
using namespace PDFDocScout;
6) The code snippet that will generate PDF document should be placed in main() function body.
// HelloWorld.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#import "PDFDocScout.tlb"
using namespace PDFDocScout;
int main(int argc, char* argv[])
{
// initialize OLE
HRESULT hr = CoInitialize(NULL);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"OLE initialization errp","error",MB_OK);
return -1;
}
// declare PDFDoc object
IPDFDocument* PDFDoc = NULL;
CLSID clsid;
// get inuque ID for IPDFDocument interface
hr = CLSIDFromProgID(OLESTR("PDFDocScout.PDFDocument"), &clsid);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"Can't get CLSID for IPDFDocument interface","error",MB_OK);
goto Uninit;
};
// create PDFDoc object
hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL,__uuidof(IPDFDocument), (LPVOID*)&PDFDoc);
// check for errors
if (FAILED(hr)) {
MessageBox(0,"Can't create PDFDoc object","error",MB_OK);
goto Uninit;
}
// initialize library
PDFDoc->InitLibrary("demo", "demo");
// set output PDF filename
PDFDoc->OutputFileName = "c:\\HelloWorld.pdf";
// set library to automatically open generated PDF document in default PDF viewer application
PDFDoc->AutoOpenGeneratedPDF = true;
// starts PDF documen generation
PDFDoc->BeginDocument();
// add text to current page at (100,100) with 15 degrees rotation
PDFDoc->AddText("Hello, World!", 100, 100, 15);
PDFDoc->EndDocument(); // close generated PDF document
// release PDFDoc object
PDFDoc->Release();
// uninitialize OLE libraries
Uninit:
CoUninitialize();
return 0;
}
This code will generate PDF document file that will be saved as "c:\HelloWorld.PDF" file
Hint: you can simply copy and paste the code from the sample above into VC++ code editor window:
7) Run the application by pressing F5 (or use "Build" | "Debug" | "Go")
VC++ will compile and run "Hello, World!" application. It will generate Shapes.PDF file on C:\ disk
You can view generated PDF file (.PDF) using Adobe Reader or another application that is capable of displaying pdf documents.

You can download the source code of this example here: pdfdocscout_vc.zip
Filed in:
PDFDoc Scout SDK
Tutorials:


