<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>Debenu Quick PDF Library - PDF SDK Community Forum : Visual C++ Starter example code</title>
  <link>http://www.quickpdf.org/forum/</link>
  <description><![CDATA[This is an XML content feed of; Debenu Quick PDF Library - PDF SDK Community Forum : Sample Code : Visual C++ Starter example code]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 08 May 2026 05:59:10 +0000</pubDate>
  <lastBuildDate>Tue, 17 Oct 2006 07:24:54 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 11.01</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.quickpdf.org/forum/RSS_post_feed.asp?TID=535</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Debenu Quick PDF Library - PDF SDK Community Forum]]></title>
   <url>http://www.quickpdf.org/forum/forum_images/QPDF_Forum_Title.png</url>
   <link>http://www.quickpdf.org/forum/</link>
  </image>
  <item>
   <title><![CDATA[Visual C++ Starter example code :  This is some simple COM code...]]></title>
   <link>http://www.quickpdf.org/forum/visual-c-starter-example-code_topic535_post2335.html#2335</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=482">bobhall106</a><br /><strong>Subject:</strong> 535<br /><strong>Posted:</strong> 17 Oct 06 at 7:24AM<br /><br /><FONT color=#0000ff size=2><P><FONT color=#008000>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.</FONT></P><P><FONT color=#008000>//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</FONT></P><P>#import</FONT><FONT size=2> "ISED.dll" named_guids raw_interfaces_only </P></FONT><FONT color=#0000ff size=2><P>void</FONT><FONT size=2> AddPDFFooter()</P><P>{</P><P></FONT><FONT color=#008000 size=2>//dont forget to call ::CoInitialize(NULL); in your app init</P></FONT><FONT size=2><P>CComPtr&lt;iSED::IQuickPDF&gt; spPDF;</FONT><FONT color=#008000 size=2>//smart pointer to pdf object</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>//create the COM object</P></FONT><FONT size=2><P>HRESULT hr = CoCreateInstance( iSED::CLSID_QuickPDF, NULL, CLSCTX_INPROC_SERVER, iSED::IID_IQuickPDF, (</FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2>**)&amp;spPDF);</P><P></FONT><FONT color=#008000 size=2>//add your key code here</P></FONT><FONT size=2><P>CComBSTR key="add your key code here";</FONT><FONT color=#008000 size=2>//change me!!<BR></FONT><FONT color=#0000ff size=2>long</FONT><FONT size=2> rtn=0;</FONT><FONT color=#008000 size=2>//general return values</FONT></P><P><FONT size=2>hr=spPDF-&gt;UnlockKey(key,&amp;rtn);</FONT><FONT color=#008000 size=2>//unlock the product</P></FONT><FONT size=2><P>CComBSTR file="c:\\input.pdf";<FONT color=#008000>//change for your input file</FONT></P><P>hr=spPDF-&gt;LoadFromFile(file,&amp;rtn);</FONT><FONT color=#008000 size=2>//load a local file</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>long</FONT><FONT size=2> pages=0;</P><P>spPDF-&gt;PageCount(&amp;pages);</FONT><FONT color=#008000 size=2>//count the pages in the document</P></FONT><FONT size=2><P>CComBSTR footer="testing 123";</FONT><FONT color=#008000 size=2>//this is the footer text</P></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2>for</FONT><FONT size=2>(</FONT><FONT color=#0000ff size=2>int</FONT><FONT size=2> page=0;page&lt;pages+1;page++)</FONT><FONT color=#008000 size=2>//for each page of the document</P></FONT><FONT size=2><P>{</P><P>hr=spPDF-&gt;SelectPage(page,&amp;rtn);</FONT><FONT color=#008000 size=2>//select each page in turn</P></FONT><FONT size=2><P>hr=spPDF-&gt;SetTextSize(6,&amp;rtn);</FONT><FONT color=#008000 size=2>//set the font size (6pt here)</P></FONT><FONT size=2><P>hr=spPDF-&gt;DrawText(10, 10, footer,&amp;rtn);</FONT><FONT color=#008000 size=2>//draw the footer text</P></FONT><FONT size=2><P>}</P><P>CComBSTR output="C:\\output.pdf";</FONT><FONT color=#008000 size=2>//temp output path</P></FONT><FONT size=2><P>hr= spPDF-&gt;SaveToFile(output,&amp;rtn);</FONT><FONT color=#008000 size=2>//save the file to disk</P></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2>//dont forget to call ::CoUninitialize(); in your app closure</P></FONT><FONT size=2><P>}</P></FONT><span style="font-size:10px"><br /><br />Edited by bobhall106</span>]]>
   </description>
   <pubDate>Tue, 17 Oct 2006 07:24:54 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/visual-c-starter-example-code_topic535_post2335.html#2335</guid>
  </item> 
 </channel>
</rss>