<?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 : AddImageFromString() in C++ DLL Project (RESOLVED)</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 : I need help - I can help : AddImageFromString() in C++ DLL Project (RESOLVED)]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sun, 05 Apr 2026 13:23:08 +0000</pubDate>
  <lastBuildDate>Sat, 11 Feb 2012 08:03:06 +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=2144</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[AddImageFromString() in C++ DLL Project (RESOLVED) : Thank you for your reply today,...]]></title>
   <link>http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9105.html#9105</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1853">barqyDev</a><br /><strong>Subject:</strong> 2144<br /><strong>Posted:</strong> 11 Feb 12 at 8:03AM<br /><br />Thank you for your reply today, it helped!<div><br></div><div>Unfortunately, I remained my own worst enemy. &nbsp;After the the RCDATA update, I was getting the data and length right, but it wasn't working.</div><div><br></div><div>After dinner I came back and took a look at the actual call to AddImageFromString() that I was making. &nbsp;Turns out I wasn't getting all the data stuffed into the std::string I thought I was. &nbsp;I only got the first chunk of bytes up to the first NULL.</div><div><br></div><div>Builidng my input parameter with this helped: std::string test( res_data, res_size );</div><div><br></div><div>So....Here's the working code block for anybody else that might stroll by:</div><div><br></div><div><div>&nbsp; &nbsp; &nbsp; int result = 0;</div><div>&nbsp; &nbsp; &nbsp; HINSTANCE Instance = AfxGetInstanceHandle();</div><div>&nbsp; &nbsp; &nbsp; HRSRC res = FindResource( Instance,MAKEINTRESOURCE( IDB_BINARY ), RT_RCDATA );</div><div>&nbsp; &nbsp; &nbsp; if( res )</div><div>&nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;HGLOBAL res_handle = LoadResource( Instance , res );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if( res_handle )</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; char *res_data = (char *) LockResource( res_handle );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if( res_data )</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;DWORD res_size = SizeofResource( Instance, res );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if( res_size )</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::string test( res_data, res_size );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result = m_PdfWriter-&gt;AddImageFromString( test, 0 );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_PdfWriter-&gt;SelectImage( result );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_PdfWriter-&gt;DrawImage( 550, 5, 60, 60 );</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} // got the length</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } // locked it..i.e. got pointer to 1st byte</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;} // loaded the resource</div><div>&nbsp; &nbsp; &nbsp; } // found the resource item</div></div><div><br></div>]]>
   </description>
   <pubDate>Sat, 11 Feb 2012 08:03:06 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9105.html#9105</guid>
  </item> 
  <item>
   <title><![CDATA[AddImageFromString() in C++ DLL Project (RESOLVED) : AddImage from file expects a full...]]></title>
   <link>http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9102.html#9102</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1483">AndrewC</a><br /><strong>Subject:</strong> 2144<br /><strong>Posted:</strong> 11 Feb 12 at 2:13AM<br /><br />AddImage from file expects a full BMP, JPG, PNG or TIFF file. &nbsp;It sounds like you are on the right track extracting the JPEG resource.<div><br></div><div>Here is a post that gives some hope. &nbsp;The last reply indicates that it might work better when the JPG is marked as RCDATA in the resource file.</div><div><br></div><div><a href="http://www.sfml-dev.org/forum/viewtopic.php?p=33890&amp;sid=ba955874d6e717c8b858ede78a74c029" target="_blank">http://www.sfml-dev.org/forum/viewtopic.php?p=33890&amp;sid=ba955874d6e717c8b858ede78a74c029</a></div>]]>
   </description>
   <pubDate>Sat, 11 Feb 2012 02:13:47 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9102.html#9102</guid>
  </item> 
  <item>
   <title><![CDATA[AddImageFromString() in C++ DLL Project (RESOLVED) : Another update....loaded a JPG...]]></title>
   <link>http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9099.html#9099</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1853">barqyDev</a><br /><strong>Subject:</strong> 2144<br /><strong>Posted:</strong> 10 Feb 12 at 10:24PM<br /><br />Another update....loaded a JPG from disk into a PDF file:<div>CImage image;</div><div>image.LoadFromResource( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_LOGO) &nbsp;);</div><div>image.Save( L"test.jpg" );</div><div>index = pdf.AddImageFromFile( L"test.jpg", 0 );</div><div>pdf.SelectImage( index );</div><div>pdf.DrawImage( 0, 0, 100, 100 );</div><div>// all that above works</div><div><br></div><div>// now, let's what data got stuffed into the PDF</div><div>index = pdf.GetPageImageList(0);</div><div>std::string Grab = pdf.GetImageListItemDataToString( index, 1, 0 );</div><div>// and it looks like the exact same content as what's in my JPG file on disk.</div><div><br></div><div><br></div><div>Assuming I have that right, I'm now chunking through some more API calls:</div><div>FindResource</div><div>LoadResource</div><div>LockResource</div><div>SizeofResource</div><div><br></div><div>Hopefully I'm on the right track.</div>]]>
   </description>
   <pubDate>Fri, 10 Feb 2012 22:24:21 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9099.html#9099</guid>
  </item> 
  <item>
   <title><![CDATA[AddImageFromString() in C++ DLL Project (RESOLVED) : I do have a working project using...]]></title>
   <link>http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9097.html#9097</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1853">barqyDev</a><br /><strong>Subject:</strong> 2144<br /><strong>Posted:</strong> 10 Feb 12 at 9:19PM<br /><br />I do have a working project using AddImageFromFile() it just makes me unhappy for the reasons mentioned.]]>
   </description>
   <pubDate>Fri, 10 Feb 2012 21:19:15 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9097.html#9097</guid>
  </item> 
  <item>
   <title><![CDATA[AddImageFromString() in C++ DLL Project (RESOLVED) :   I&amp;#039;m using Visual Studio...]]></title>
   <link>http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9096.html#9096</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1853">barqyDev</a><br /><strong>Subject:</strong> 2144<br /><strong>Posted:</strong> 10 Feb 12 at 8:30PM<br /><br />I'm using Visual Studio 2010 in a MFC Dialog App and I would like to be able to&nbsp;<div>place images in my PDF that come from bitmaps stored in my resource file</div><div><br></div><div>reason 1 - don't want to have files travelling with the app. &nbsp;I'd like it as standalone as possible</div><div>reason 2 - don't want to create temporary files on disk just to load with AddImageFromFile()</div><div><br></div><div>I've tried loading the image into memory with CImage:</div><div>CImage Image;</div><div>&nbsp;Image.LoadFromResource( AfxGetInstanceHandle(), MAKEINTRESOURCE(IDB_VESSIX) );</div><div><br></div><div>I have access to the bitmap data via Image.GetBits(), but it's not clear to me</div><div>what format data AddImageFromString() actually wants.</div><div><br></div><div>I know it takes a std::string parameter, but that doesn't say what it's expecting.</div><div><br></div><div>Any help would be appreciated!</div><div><br></div><span style="font-size:10px"><br /><br />Edited by barqyDev - 11 Feb 12 at 8:04AM</span>]]>
   </description>
   <pubDate>Fri, 10 Feb 2012 20:30:40 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/addimagefromstring-in-c-dll-project-resolved_topic2144_post9096.html#9096</guid>
  </item> 
 </channel>
</rss>