<?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 : C&#111;nvert string from RenderPageToString</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 : C&#111;nvert string from RenderPageToString]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Fri, 01 May 2026 06:28:57 +0000</pubDate>
  <lastBuildDate>Fri, 06 Jan 2006 00:40:39 +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=188</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[C&#111;nvert string from RenderPageToString : I&amp;#039;m glad things are working...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post882.html#882</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=116">frankjr</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 06 Jan 06 at 12:40AM<br /><br /><P>I'm glad things are working for you Pirmin.</P><P>Since you pointed out the BSTR issue, and I modified the wrapper code to implement your suggestion, the library has been working beautifully for me.</P><P>&nbsp;</P><P>-Frank</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Fri, 06 Jan 2006 00:40:39 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post882.html#882</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : The &amp;#034;more problems&amp;#034;...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post881.html#881</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=167">Pirmin</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 05 Jan 06 at 11:28PM<br /><br />The "more problems" in my last post have been just programming errors of myself. So I'm more more happy with the library now.]]>
   </description>
   <pubDate>Thu, 05 Jan 2006 23:28:26 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post881.html#881</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Hi Frank, I have tried your wrapper...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post859.html#859</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=167">Pirmin</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 04 Jan 06 at 3:14AM<br /><br /><P>Hi Frank,</P><P>I have tried your wrapper code.<BR>For my first tests, it did not resolve my problems.<BR>I have posted a new topic (<U>Blank bitmaps from RenderDocumentToFile</U>) because I think, this problem is the result of a different fault of the iSED library.<BR>I've had more problems that I will describe soon (in new topics also).</P><P>Best regards,<BR>Pirmin</P><span style="font-size:10px"><br /><br />Edited by Pirmin</span>]]>
   </description>
   <pubDate>Wed, 04 Jan 2006 03:14:14 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post859.html#859</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Primin, If you cut and paste...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post850.html#850</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=116">frankjr</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 03 Jan 06 at 1:14PM<br /><br /><P>Primin,</P><P>If you cut and paste the wrapper code I posted, and compile it with your app, does it not work?</P><P>Since implementing the change you pointed out (BSTR instead of C# strings 0 terminated etc), the library seems to work wonderfully for me.&nbsp;&nbsp; All the issues I was having have disappeared.</P><P>&nbsp;</P><P>Of course if you use the ActiveX version of the library, you should have no issues either because the activeX version uses BSTR.</P><P>-Frank</P>]]>
   </description>
   <pubDate>Tue, 03 Jan 2006 13:14:39 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post850.html#850</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Hi Pirmin!  Perhaps i&amp;#039;m wrong...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post842.html#842</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=111">Ingo</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 03 Jan 06 at 5:01AM<br /><br />Hi Pirmin!<br /><br />Perhaps i'm wrong but ... ;-)<br />QuickPDF-functions are separated modules which you can bind with your code... The functioncode stay the same. So i don't think that C# should be a problem. For example i've made dlls including quickpdf-functionality and they were used in .net-environments (without problems).<br /><br />Your second point (while rendering always the first document was rendered):<br />You must get the id of the second document and have to change the actual documents with this id then it should work.<br />]]>
   </description>
   <pubDate>Tue, 03 Jan 2006 05:01:39 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post842.html#842</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Hi Frank A happy new year and...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post841.html#841</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=167">Pirmin</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 03 Jan 06 at 4:31AM<br /><br /><P>Hi Frank</P><P>A happy new year and thank you for your post. I haven't seen it before, sorry.<BR>I don't know, why my code compiled correctly without the additional <strong><FONT color=red>unsafe</FONT></strong> and your code did not. Maybe it's a matter of a different .NET version?</P><P>In the last days I have been trying other iSED functions in the C# environment.<BR>Unfortunately I have found, that the ones I need, all have awful errors.<BR>For instance I can not even render the iSED manual (iSEDQuickPDF 5.11 Reference Guide.pdf) to a file. All pages appear blank.<BR>Another error is, I can not render one&nbsp; file and - without closing and restarting my software - render a second file. When I apply the same function calls to a second PDF document, the rendering result will be two times from the first PDF file.<BR>Tonight or tomorrow, when I have time to examine the effects more precisely, I will post my experience <strong>in new topics</strong>.<BR>Perhaps with all the changes you applied to the wrapper file, the library would become more stable.</P><P>I'm wondering if all my problems with the library for C# do not exist in the Delphi environment. Maybe for the Delphi environment the code has been tested more thoroughly.<BR>If this is the case, I'm thinking about&nbsp;starting my work from scratch in the Delphi environment.<BR><BR>Best regards,<BR>Pirmin</P>]]>
   </description>
   <pubDate>Tue, 03 Jan 2006 04:31:26 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post841.html#841</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Thank you Pirmin for your analysis...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post743.html#743</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=116">frankjr</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 21 Dec 05 at 2:01AM<br /><br /><p>Thank you Pirmin for your analysis and work..I found myself headeddown the exact same trail, and then decided to check here before Ijumped off the cliff...</p><p>For me to compile the wrapper, I&nbsp;needed one more necessary change in the dll import section...</p><p><u>old import:<br></u><font color="blue" face="Courier New, Courier, mono">&#091;DllImport("iSEDQuickPDF.dll")&#093; static extern string iSED<span>RenderPage</span>ToString(int iDPI, int iPage, int iOptions);</font></p><p><u>new import:<br></u><font color="blue" face="Courier New, Courier, mono">&#091;DllImport("iSEDQuickPDF.dll")&#093; <strong><font color="red">unsafe</font></strong> static extern <strong>sbyte*</strong> iSED<span>RenderPage</span>ToString(int iDPI, int iPage, int iOptions);</font></p><p>&nbsp;</p><p><font color="#0000ff" face="Courier New">Forgive me if I am wrong, but that is what I had to do to get it to compile.</font></p><p><font color="#0000ff" face="Courier New">I took the liberty of using Emacs and a macro to modify each and every call the returned a string as Pirmin has told us to do.</font></p><p><font color="#0000ff" face="Courier New">The newly modified wrapper is as follows:</font></p><p><font color="#0000ff" face="Courier New">----- CUT HERE -----</font></p><p>//======================================================================================<br>//iSEDQuickPDF 5.11<br>//DLL wrapper for .NET<br>//1 April 2005<br>//http://www.isedquickpdf.com/<br>//======================================================================================</p><b><font color="#990000">(Remainder of post deleted by the Administrator as it was too long, and was causing the SQL Server to crash. Sorry). Michel.</font></b><span style="font-size:10px"><br /><br />Edited by Michel_K17 - 17 Nov 07 at 11:37AM</span>]]>
   </description>
   <pubDate>Wed, 21 Dec 2005 02:01:50 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post743.html#743</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Hi Folks, Finally I found the...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post615.html#615</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=167">Pirmin</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 05 Dec 05 at 6:16PM<br /><br /><P>Hi Folks,</P><P>Finally I found the solutions to my problems. Last night I couldn't sleep until I got it.</P><P>As I thought, the reason for the first problem was the assignement of one string type to a different one.</P><P>In the file iSQP0511DLLSource\DLLiSED.pas I saw, that the Delphi return type of the function iSEDRenderPageToString was PChar, which is only a pointer to characters with no length info.<BR>In the file iSQP0511DotNet.cs, which is the DLL wrapper for .NET, the function iSEDRenderPageToString is imported from iSEDQuickPDF.dll as a string returning function and the wrapper function RenderPageToString calls iSEDRenderPageToString with the same parameters and returns the resulting string. Obviously the length info will be lost when the assignement from the pointer to the string is executed. The in this case used C# string constructor casts the pointer from the return value to a string, which only goes to the first contained zero. The original string with the proper length (I think) will be destroyed by the garbage collection.<BR>My task was, to find a way to avoid this mechanism. Instead of importing and using the function iSEDRenderPageToString as a string returning function, I imported and used it as a pointer returning function, which it actually is.<BR>To achieve this in C#, the function must use the "unsafe" statement and the wrapper library must be compiled with the /unsafe option.<BR>So the file iSQP0511DotNet.cs has been patched the following way:<BR><U>old import:<BR></U><FONT face="Courier New, Courier, mono" color=blue>&#091;DllImport("iSEDQuickPDF.dll")&#093; static extern string iSEDRenderPageToString(int iDPI, int iPage, int iOptions);</FONT></P><P><U>new import:<BR></U><FONT face="Courier New, Courier, mono" color=blue>&#091;DllImport("iSEDQuickPDF.dll")&#093; static extern <strong>sbyte*</strong> iSEDRenderPageToString(int iDPI, int iPage, int iOptions);</FONT></P><P><U>old implementation of the wrapper function:<BR></U><FONT face="Courier New, Courier, mono" color=blue>public string RenderPageToString(int DPI, int Page, int Options)<BR>{<BR>&nbsp;&nbsp;&nbsp; return iSEDRenderPageToString(DPI, Page, Options);<BR>}</FONT></P><P><U>new implementation of the wrapper function:<BR></U><FONT face="Courier New, Courier, mono" color=blue>public string RenderPageToString(int DPI, int Page, int Options)<BR>{<BR>&nbsp;&nbsp;&nbsp; <strong>unsafe</strong><BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return new System.String( iSEDRenderPageToString(DPI, Page, Options), 0, StringResultLength() );<BR>&nbsp;&nbsp;&nbsp; }<BR>}</FONT></P><P>Using this patch, the function RenderPageToString does, what it is expected to do. The only drawback of my patch is, the library has to be compiled slightly different as described by iSED (using the option <FONT face="Courier New, Courier, mono" color=blue>/unsafe</FONT>). Maybe later on, I will try to the job better. For now the result is satisfactory to me.</P><P>The second problem (assigning the string to an Image object) was just finding the proper functions. Hints I have found in the file of which chicks posted the URL. Thanks!</P><P>To show the effects of the original iSEDQuickPDF 5.11 DLL wrapper for .NET and the patched one, you can write a C# console program (call it Test.cs) and put it to somewhere what I will call the working directory.<BR>Test.cs should have the following content:<BR><FONT face="Courier New, Courier, mono" color=blue>using System;<BR>using System.IO;<BR>using System.Text;<BR>using System.Drawing;<BR>using iSED = SEDTech.iSED;<BR>class Test<BR>{<BR>&nbsp;&nbsp;&nbsp; public static void Main() <BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iSED.QuickPDF qp = new iSED.QuickPDF();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.Write( "iSEDQuickPDF version: " );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine( qp.LibraryVersion() );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qp.UnlockKey( "<FONT color=green>your unlock key goes here</FONT>" );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine( "Loading PDF file..." );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qp.LoadFromFile( "Test.pdf" );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine( "Rendering page 1 to file..." );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; qp.RenderDocumentToFile(72, 1, 1, 0, "Page_%p_of_Test_A.bmp" );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine( "Rendering page 1 to string..." );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string bitMapStr = qp.RenderPageToString( 72, 1, 0 );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Image img = Image.FromStream( new MemoryStream( Encoding.Default.GetBytes( bitMapStr ) ) );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine( "Saving image from string..." );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; img.Save( "Page_1_of_Test_B.bmp", System.Drawing.Imaging.ImageFormat.Bmp );<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Console.WriteLine( "Finished!" );<BR>&nbsp;&nbsp;&nbsp; }<BR>}</FONT></P><P>Don't forget to replace the parameter string for the function UnlockKey with your unlock key.</P><P>From the file iSQP0511DLL.zip extract iSEDQuickPDF.dll and iSQP0511DotNet.cs to your working directory. Rename iSQP0511DotNet.cs to iSQP0511DotNet0.cs and make a copy of it, named iSQP0511DotNet1.cs. To iSQP0511DotNet1.cs apply the patches described before.</P><P>Then create a batch file (you may call it build.cmd) in the working directory with the following content:<BR><FONT face="Courier New, Courier, mono" color=blue>csc /out:iSED0.dll /t:library&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; iSQP0511DotNet0.cs<BR>csc /out:iSED1.dll /t:library <strong>/unsafe</strong> iSQP0511DotNet1.cs<BR>csc /out:Test0.exe /t:exe&nbsp;&nbsp;&nbsp;&nbsp; /reference:iSED0.dll Test.cs<BR>csc /out:Test1.exe /t:exe&nbsp;&nbsp;&nbsp;&nbsp; /reference:iSED1.dll Test.cs</FONT></P><P>Execute build.cmd, which should create the two files Test0.exe and Test1.exe in the working directory.</P><P>Copy a PDF file you like to the working directory (don't use the "iSEDQuickPDF 5.11 Reference Guide.pdf") and rename it to Test.pdf.<BR>Open a command line window and execute Test0.exe, see the results and then execute Test1.exe to compare with.</P><P>Test0.exe only will produce Page_1_of_Test_A.bmp (and some temporary files) and trows an exeption while Test1.exe will output Page_1_of_Test_A.bmp and Page_1_of_Test_B.bmp. If you compare the two BMP-files you see, they differ in&nbsp;a few&nbsp;bytes. I don't know why. When you open the two BMP-files with a Graphic Viewer, you won't see any difference.</P><P>As I indicated before, the file "iSEDQuickPDF 5.11 Reference Guide.pdf" causes problems. Page_1_of_Test_A.bmp produced from it, in a Graphik Viewer shows only a blank page, while Page_1_of_Test_B.bmp appears to be a good bitmap.<BR>So the work is not over yet. But now I will concentrate on what I wanted to do one week ago, hoping all goes well.<BR><BR>Best regards,<BR>Pirmin</P><span style="font-size:10px"><br /><br />Edited by Pirmin</span>]]>
   </description>
   <pubDate>Mon, 05 Dec 2005 18:16:20 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post615.html#615</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Hi Pirmin,  Yip! I always tend...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post610.html#610</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=1">Michel_K17</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 04 Dec 05 at 12:19AM<br /><br />Hi Pirmin,<br /><br />&nbsp;&nbsp;&nbsp;Yip! I always tend to check the manual last too!<img border="0" src="http://www.quickpdf.org/forum/smileys/smiley1.gif" border="0"><br /><br />&nbsp;&nbsp;&nbsp;For my VB6 project, I switched from the DLL to the ActiveX version as it was much better behaved: With ActiveX, the library it does not take down my app if it crashes, which used to happen with an older version.]]>
   </description>
   <pubDate>Sun, 04 Dec 2005 00:19:59 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post610.html#610</guid>
  </item> 
  <item>
   <title><![CDATA[C&#111;nvert string from RenderPageToString : Hi Michel_K17 You are right,...]]></title>
   <link>http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post609.html#609</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=167">Pirmin</a><br /><strong>Subject:</strong> 188<br /><strong>Posted:</strong> 03 Dec 05 at 3:42AM<br /><br /><P>Hi Michel_K17</P><P>You are right, my ticket is still open.</P><P>Unexpectedly I have found a part of a solution for my first problem (getting the length of the returned string from RenderPageToString).</P><P>Till now I have worked, using the DLL version. I thought, there must be something wrong. A DLL made for C++ can not make strings with a lenght information. Only the position of the string terminator (zero) is used to show where it ends.</P><P>With this in mind, I wanted to do my trials with the ActiveX library.<BR>Still not started, I saw the Readme-file in the zip-file of the DLL Edition. There I found a sentence which makes me feel bad of not having read it before and makes me feel better about the correctness of the iSEDQuickPDF library.<BR>The sentence is: "Use the StringResultLength function to determine the length of the data returned by the most recent function with a PChar result."</P><P>When I tried the function StringResultLength after RenderPageToString, it got exactly the same number as the size of the BMP-file produced with RenderDocumentToFile.</P><P>I see, I have to say RTFM to myself. <IMG src="http://www.quickpdf.org/forum/smileys/smiley6.gif" border="0"></P><P>My first attempts afterwards let me assume that, when I want to access the string part after the zero, the garbage collector already has killed it.</P><P>So next week in my spare time, I must find out, how to get the entire data of the string.</P><P>Best regards,<BR>Pirmin</P>]]>
   </description>
   <pubDate>Sat, 03 Dec 2005 03:42:15 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/convert-string-from-renderpagetostring_topic188_post609.html#609</guid>
  </item> 
 </channel>
</rss>