<?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 : Adding Drawing.Bitmap</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 : Adding Drawing.Bitmap]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 01 May 2026 05:04:44 +0000</pubDate>
  <lastBuildDate>Wed, 22 Jul 2009 05:55:17 +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=1117</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[Adding Drawing.Bitmap : Hi Jim,It looks as if you&amp;#039;re...]]></title>
   <link>http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5330.html#5330</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1000">Rowan</a><br /><strong>Subject:</strong> 1117<br /><strong>Posted:</strong> 22 Jul 09 at 5:55AM<br /><br /><div>Hi Jim,</div><div><br></div><div>It looks as if you're trying to convert&nbsp;from a byte array to a string and then back to a byte array.&nbsp;The code we've provided below should provide a more direct way.</div><div><div><br></div><div>The ToArray method of the stream class returns a byte array that can be passed directly to the AddImageFromString function.</div></div><div><br></div><div>--------------------------</div><div>Dim bitmap As New Bitmap(100, 100)</div><div>Dim graphics As Graphics = graphics.FromImage(bitmap)</div><div>Dim brush As New SolidBrush(Color.Red)</div><div>graphics.FillRectangle(brush, 0, 0, 100, 100)</div><div>brush = New SolidBrush(Color.Blue)</div><div>graphics.FillEllipse(brush, 20, 20, 60, 60)</div><div><br></div><div>Dim ms As New IO.MemoryStream()</div><div>bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp)</div><div>Dim imageData As Byte() = ms.ToArray()</div><div><br></div><div>Dim qp As New QuickPDFDLL0714.PDFLibrary("&lt;path&gt;\QuickPDFDLL0714.dll")</div><div><br></div><div>qp.UnlockKey("&lt;Insert License Key&gt;")</div><div><br></div><div>' Set the images to be compressed</div><div>qp.CompressImages(1)</div><div><br></div><div>' Load the image from the byte array</div><div>qp.AddImageFromString(imageData, 0)</div><div><br></div><div>' Draw the image onto the page</div><div>qp.DrawImage(100, 500, 200, 200)</div><div><br></div><div>' Save the PDF</div><div>qp.SaveToFile("&lt;path&gt;\system.drawing.pdf")</div><div>--------------------------</div><div><br></div><div>I hope this helps.</div><div><br></div><div>Cheers,</div><div>- Rowan.</div>]]>
   </description>
   <pubDate>Wed, 22 Jul 2009 05:55:17 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5330.html#5330</guid>
  </item> 
  <item>
   <title><![CDATA[Adding Drawing.Bitmap : Jim,Did you get any further with...]]></title>
   <link>http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5328.html#5328</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1003">deabrew</a><br /><strong>Subject:</strong> 1117<br /><strong>Posted:</strong> 20 Jul 09 at 2:21PM<br /><br />Jim,<div><br></div><div>Did you get any further with this?</div>]]>
   </description>
   <pubDate>Mon, 20 Jul 2009 14:21:44 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5328.html#5328</guid>
  </item> 
  <item>
   <title><![CDATA[Adding Drawing.Bitmap : Well... since I&amp;#039;m using the...]]></title>
   <link>http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5198.html#5198</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=155">Jim Sullivan</a><br /><strong>Subject:</strong> 1117<br /><strong>Posted:</strong> 25 Jun 09 at 2:39PM<br /><br />Well... since I'm using the DLL and the wrapper, it does work.&nbsp; The 12 one just references the namespace, which I can set to anything I want.&nbsp; The only time it would cause a problem is if the function call within the DLL were changed.&nbsp; Or I'd be missing a reference to a new function.&nbsp; Neither applies in this case.<DIV>&nbsp;</DIV><DIV>But anyway, I threw this code together in a new project, and my original project has all of the references correct.</DIV>]]>
   </description>
   <pubDate>Thu, 25 Jun 2009 14:39:02 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5198.html#5198</guid>
  </item> 
  <item>
   <title><![CDATA[Adding Drawing.Bitmap :    Jim Sullivan wrote:Dim pr...]]></title>
   <link>http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5197.html#5197</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1000">Rowan</a><br /><strong>Subject:</strong> 1117<br /><strong>Posted:</strong> 25 Jun 09 at 9:57AM<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by Jim Sullivan" alt="Originally posted by Jim Sullivan" style="vertical-align: text-bottom;" /> <strong>Jim Sullivan wrote:</strong><br /><br />Dim pr As New QuickPDFDLL0712.PDFLibrary(Server.MapPath("~\") + "bin\QuickPDFDLL0713.dll")<br></td></tr></table><div><br></div><div>This is probably just an error in your post, but you've listed both&nbsp;QuickPDFDLL0712 and&nbsp;QuickPDFDLL0713 there, which won't work.</div>]]>
   </description>
   <pubDate>Thu, 25 Jun 2009 09:57:56 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5197.html#5197</guid>
  </item> 
  <item>
   <title><![CDATA[Adding Drawing.Bitmap : I created a new app so that I...]]></title>
   <link>http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5196.html#5196</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=155">Jim Sullivan</a><br /><strong>Subject:</strong> 1117<br /><strong>Posted:</strong> 24 Jun 09 at 5:30PM<br /><br />I created a new app so that I could isolate my requrements.&nbsp; Here's the function:<DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim bmp As New Drawing.Bitmap("C:\temp\b.bmp")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim pr As New QuickPDFDLL0712.PDFLibrary(Server.MapPath("~\") + "bin\QuickPDFDLL0713.dll")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pr.UnlockKey("mykey")</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim x As Int32 = pr.AddImageFromFile("C:\temp\a.bmp", 0)</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim buffer As Byte()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; buffer = stream.ToArray<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim y As Int32 = pr.AddImageFromString(buffer, 0)<BR></DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pr.SelectImage(x)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pr.DrawImage(50, 100, 300, 100)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pr.SelectImage(y)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pr.DrawImage(50, 300, 300, 100)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pr.SaveToFile("c:\temp\a.pdf")</DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>The variable y returns a 0, meaning that it couldn't add the image.<BR></DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Wed, 24 Jun 2009 17:30:47 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5196.html#5196</guid>
  </item> 
  <item>
   <title><![CDATA[Adding Drawing.Bitmap : I&amp;#039;m using ASP.NET and one...]]></title>
   <link>http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5195.html#5195</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=155">Jim Sullivan</a><br /><strong>Subject:</strong> 1117<br /><strong>Posted:</strong> 23 Jun 09 at 8:06PM<br /><br />I'm using ASP.NET and one of my systems generates a Drawing.Bitmap object.&nbsp; I need to then add that to my PDF.&nbsp; I tried encoding the bitmap and then using AddImageFromString, but it doesn't seem to work.<DIV>&nbsp;</DIV><DIV>Has anyone else tried to use an AddImage function to add a bitmap from memory, not from a file?</DIV><DIV>&nbsp;</DIV><DIV><table width="99%"><tr><td><pre class="BBcode"></DIV><FONT size=2></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2></P><DIV>Dim</FONT></FONT><FONT size=2> stream </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT size=2> IO.MemoryStream()</DIV><P>bmp.Save(stream, Drawing.Imaging.ImageFormat.Bmp)</P><P></FONT><FONT size=2>bitmapString =&nbsp;enc.GetString(stream.ToArray())</P></FONT></FONT></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> encoding </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>New</FONT></FONT><FONT size=2> System.Text.ASCIIEncoding</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Dim</FONT></FONT><FONT size=2> buffer </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>As</FONT></FONT><FONT size=2> </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>Byte</FONT></FONT><FONT size=2>()</P><P>buffer = encoding.GetBytes(bitmapString)</P><P>qp.AddImageFromString(buffer, 0)</FONT><FONT size=2></P><DIV></DIV><DIV></pre></td></tr></table></DIV><DIV>&nbsp;</DIV><DIV>bmp is the drawing.bitmap and enc is a Text.Encoding</FONT></DIV>]]>
   </description>
   <pubDate>Tue, 23 Jun 2009 20:06:36 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/adding-drawingbitmap_topic1117_post5195.html#5195</guid>
  </item> 
 </channel>
</rss>