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!
Visual C++ Starter example code |
Post Reply |
Author | |
bobhall106
Beginner Joined: 17 Oct 06 Status: Offline Points: 1 |
Post Options
Thanks(0)
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_onlyvoid AddPDFFooter(){ //dont forget to call ::CoInitialize(NULL); in your app initCComPtr<iSED::IQuickPDF> spPDF; //smart pointer to pdf object //create the COM objectHRESULT hr = CoCreateInstance( iSED::CLSID_QuickPDF, NULL, CLSCTX_INPROC_SERVER, iSED::IID_IQuickPDF, ( void**)&spPDF); //add your key code hereCComBSTR 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 documentCComBSTR 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 turnhr=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 pathhr= spPDF->SaveToFile(output,&rtn); //save the file to disk //dont forget to call ::CoUninitialize(); in your app closure} Edited by bobhall106 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store