Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > Sample Code
  New Posts New Posts RSS Feed - Visual C++ Starter example code
  FAQ FAQ  Forum Search   Register Register  Login Login

Visual C++ Starter example code

 Post Reply Post Reply
Author
Message
bobhall106 View Drop Down
Beginner
Beginner


Joined: 17 Oct 06
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote bobhall106 Quote  Post ReplyReply Direct Link To This Post Topic: Visual C++ Starter example code
    Posted: 17 Oct 06 at 7:24AM

This is some simple COM code to get you started in Visual C++ using the ActiveX part of Quick PDF. The code opens an existing file adds a footer text to each page and then saves the file to a different PDF. Enjoy. Check your hr return codes for errors in real life.

//import the dll guids and interface by dll name in project dir. This should add the interface to Intellisense and you can code from there

#import "ISED.dll" named_guids raw_interfaces_only

void AddPDFFooter()

{

//dont forget to call ::CoInitialize(NULL); in your app init

CComPtr<iSED::IQuickPDF> spPDF;//smart pointer to pdf object

//create the COM object

HRESULT hr = CoCreateInstance( iSED::CLSID_QuickPDF, NULL, CLSCTX_INPROC_SERVER, iSED::IID_IQuickPDF, (void**)&spPDF);

//add your key code here

CComBSTR key="add your key code here";//change me!!
long rtn=0;//general return values

hr=spPDF->UnlockKey(key,&rtn);//unlock the product

CComBSTR file="c:\\input.pdf";//change for your input file

hr=spPDF->LoadFromFile(file,&rtn);//load a local file

long pages=0;

spPDF->PageCount(&pages);//count the pages in the document

CComBSTR footer="testing 123";//this is the footer text

for(int page=0;page<pages+1;page++)//for each page of the document

{

hr=spPDF->SelectPage(page,&rtn);//select each page in turn

hr=spPDF->SetTextSize(6,&rtn);//set the font size (6pt here)

hr=spPDF->DrawText(10, 10, footer,&rtn);//draw the footer text

}

CComBSTR output="C:\\output.pdf";//temp output path

hr= spPDF->SaveToFile(output,&rtn);//save the file to disk

//dont forget to call ::CoUninitialize(); in your app closure

}



Edited by bobhall106
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store