<?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 : Load from string</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 : Load from string]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 04 Apr 2026 19:56:05 +0000</pubDate>
  <lastBuildDate>Tue, 13 May 2008 08:27:03 +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=895</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[Load from string : Hi!Loading a pdf via url like...]]></title>
   <link>http://www.quickpdf.org/forum/load-from-string_topic895_post4299.html#4299</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=111">Ingo</a><br /><strong>Subject:</strong> 895<br /><strong>Posted:</strong> 13 May 08 at 8:27AM<br /><br />Hi!<br><br>Loading a pdf via url like you described won't work with QuickPDF.<br>Why not download (you have a browser unit in your ide) and then using one of the options you have with ShellExecute?<br><br>Best regards,<br>Ingo<br><br>]]>
   </description>
   <pubDate>Tue, 13 May 2008 08:27:03 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/load-from-string_topic895_post4299.html#4299</guid>
  </item> 
  <item>
   <title><![CDATA[Load from string : Hello  I&amp;#039;m trying to load...]]></title>
   <link>http://www.quickpdf.org/forum/load-from-string_topic895_post4296.html#4296</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.quickpdf.org/forum/member_profile.asp?PF=852">Paul Richardson</a><br /><strong>Subject:</strong> 895<br /><strong>Posted:</strong> 13 May 08 at 7:10AM<br /><br />Hello<DIV>&nbsp;</DIV><DIV>I'm trying to load a PDF file from an URL however I don't appear to be making any progress.&nbsp; I'm assuming there isn't a LoadFromUrl function available.</DIV><DIV>I'm loading the URL into a string and trying to load the pdf using LoadFromString however it doesn't appear to work.&nbsp; It will happily load the PDF from file so there isn't a problem with the file.&nbsp; If I load the pdf from file and use the saveasstring option the string only differes from the string I am trying to use in terms of non-printable characters i.e. #$D and #$A.&nbsp; Does anyone have anyideas as to how to fix the string so it can be loaded?</DIV><DIV>NB In the code that follows I've just loaded a file directly into a text string from a file it produces the same problem / string but I've included the code to load the URL into a string form completeness.</DIV><DIV>&nbsp;</DIV><DIV>Thanks</DIV><DIV>&nbsp;</DIV><DIV>Paul</DIV><DIV>&nbsp;</DIV><DIV>Code as follows :-</DIV><DIV>&nbsp;</DIV><DIV>procedure TForm1.Button1Click(Sender: TObject);<BR>var<BR>&nbsp; DefaultPrnName, instr , outstr : string;<BR>&nbsp; a,b : TQuickPDF;<BR>&nbsp; opt, res : integer;<BR>&nbsp; pdfvar : variant;<BR>begin<BR>&nbsp;&nbsp;&nbsp; res := -1;<BR>&nbsp; //&nbsp; pdffile :=&nbsp; FetchURL('&#091;insert valid http:// url here!&#093;');<BR>&nbsp;&nbsp;&nbsp; with TStringList.Create do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LoadFromFile('C:\testin.pdf');<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; instr := Text;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; finally<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Free;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;<BR>&nbsp;//&nbsp;&nbsp; instr := StringReplace(instr,#$D,'',&#091;rfReplaceAll&#093;);<BR>&nbsp;&nbsp;&nbsp; a := TQuickPDF.Create(nil);<BR>&nbsp;&nbsp;&nbsp; a.UnlockKey('32363445205D56F99BB6B52279189F55'); // DEMO key!!<BR>&nbsp;&nbsp;&nbsp; res := a.LoadFromString(instr,length(instr));<BR>&nbsp;&nbsp;&nbsp; showmessage(IntToStr(res));<BR>&nbsp;&nbsp;&nbsp; opt := a.PrintOptions(1,1,'EMACS PDF Print');<BR>&nbsp;&nbsp;&nbsp; showmessage(IntToStr(res));<BR>&nbsp;&nbsp;&nbsp; a.SaveToFile('c:\test.pdf');<BR>&nbsp;&nbsp;&nbsp; a.free;</DIV><DIV>end;</DIV><DIV>&nbsp;</DIV><DIV>function TForm1.FetchURL(const sURL: String): String;<BR>var AmtRead : Cardinal;<BR>&nbsp; Buffer : array&#091;0..1023&#093;&nbsp; of char; <BR>&nbsp; {bufferlength, dwreserv : dword;} <BR>&nbsp; i:integer;&nbsp;&nbsp;&nbsp; <BR>&nbsp; SizeString, WebPage : string;<BR>&nbsp; SomeName : string;&nbsp;&nbsp; hHttpSession, hReqUrl : HInternet;&nbsp;&nbsp; Count : integer; <BR>begin <BR>&nbsp;&nbsp;&nbsp; WebPage := ''; {a big string where the webpage will go}<BR>&nbsp;&nbsp;&nbsp; SomeName := 'Web page grabber 1.0';&nbsp; {whatever ID you want to show up in the servers log} </DIV><DIV>&nbsp;&nbsp;&nbsp; hHttpSession := InternetOpen(PChar(SomeName),&nbsp; {open a handle to the net} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0); <BR>try <BR>&nbsp;&nbsp; hReqUrl := InternetOpenURL (hHttpSession, PChar(SUrl), {request the url from the net} <BR>&nbsp;&nbsp;&nbsp;&nbsp; nil, 0,0,0); <BR>&nbsp;&nbsp; try <BR>&nbsp;&nbsp;&nbsp;&nbsp; Count := 0; <BR>&nbsp;&nbsp;&nbsp;&nbsp; repeat <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InternetReadFile (hReqUrl, @Buffer,&nbsp; {read file into 1 KB buffer}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizeof (Buffer), AmtRead); <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If AmtRead &lt;&gt; 0 then begin {code loops through that one last time} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If AmtRead = sizeof(Buffer) then <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WebPage := WebPage + string(Buffer) {store in the big string} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else begin {if Amt is less than sizeof(Buffer) on the last go round<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; and you simply append the whole buffer, you will get<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the end of the file plus whatever crap is left over in<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; the buffer from the previous kilobyte downloaded}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for i := 0 to AmtRead - 1 do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Webpage := Webpage + Buffer<em>; {the crude way} </DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end; {else begin} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Count := Count + AmtRead; {keep track of the bytes read}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SizeString := 'Retrieved ' + IntToStr (Count) + <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' of ' + SUrl;&nbsp; {a string you can display of the bytes retrieved} <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end; {AMTread &lt;&gt; 0} <BR>&nbsp;&nbsp;&nbsp;&nbsp; until AmtRead = 0;&nbsp; {the file is downloaded} <BR>&nbsp;&nbsp; finally <BR>&nbsp;&nbsp;&nbsp;&nbsp; InternetCloseHandle (hReqUrl); <BR>&nbsp;&nbsp; end; <BR>&nbsp;finally <BR>&nbsp;&nbsp; InternetCloseHandle (hHttpSession);<BR>&nbsp;end;<BR>&nbsp;result := webpage;<BR>end;</DIV>]]>
   </description>
   <pubDate>Tue, 13 May 2008 07:10:24 +0000</pubDate>
   <guid isPermaLink="true">http://www.quickpdf.org/forum/load-from-string_topic895_post4296.html#4296</guid>
  </item> 
 </channel>
</rss>