472,348 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,348 software developers and data experts.

Converting an image for an RTF Document


I am creating an RTF document server side for a report.

However I am having problems converting images into the required RTF

I am converting the image into a string (binary) and including the
image syntax as per the RTF Specification, however the image is not
appearing when I view the document in Word or WordPad.

I would greatly appreciate any advice if anyone has done this before.

I have included some code:

Dim l_ConvertImage As New ImageConvert("images/decipher_logo.gif"))

l_RTFString.Append("{\sp{\sn fLayoutInCell}{\sv
1}}}\picscalex100\picscaley100\piccropl0\piccropr0 \piccropt0\piccropb0\picw"
& l_ConvertImage.l_ImageWidth & "\pich" & l_ConvertImage.l_ImageHeight
& " \picwgoal3615\pichgoal1200\jpegblip\bliptag-1988638119{\*\blipuid
8977ca59685e5fedce9ad02c42c5fff2\bin " & l_ConvertImage.l_ImageSize &
"}" & vbCrLf & vbCrLf)
l_RTFString.Append("}}" & vbCrLf)

Private Class ImageConvert
Private l_ImageFile As System.Drawing.Bitmap
Private l_MemStream As MemoryStream
Public l_ImageWidth As Integer
Public l_ImageHeight As Integer
Public l_ImageSize As Integer

Public Sub New(ByVal v_ImageLocation As String)
l_ImageFile = New System.Drawing.Bitmap(v_ImageLocation)
l_ImageWidth = l_ImageFile.Width
l_ImageHeight = l_ImageFile.Height

l_MemStream = New MemoryStream()
l_ImageSize = Convert.ToInt32(l_MemStream.Length)
End Sub

Public Function BinaryToString() As String
Dim l_ReturnString As New System.Text.StringBuilder()
Dim l_ImageBytes(l_ImageSize) As Byte

l_MemStream.Position = 0
l_MemStream.Read(l_ImageBytes, 0, l_ImageSize)

Dim l_Enum As System.Collections.IEnumerator =
While l_Enum.MoveNext
End While

Return l_ReturnString.ToString
End Function
End Class

Nov 17 '05 #1
0 1668

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Richard | last post by:
Considering the elemtary image swap routine in javascript: document.name.src="filename.gif" How would this be translated into PHP? So that if...
by: Mekon | last post by:
I have never written a line of script in my life but I need some help with it now. I have this auto generated code which I want to modify if...
by: Tjerk | last post by:
Hello all, I have the script below to change an image depending on the date upto january it worked fine but then it just stopped working does...
by: Andrew Poulos | last post by:
I'm using the following code to create a small table with one column and two rows. An image goes into the first cell. //create table var t =...
by: mabosch | last post by:
I'm trying to convert a DOC to JPG it works in Windows Forms, but I run under asp.net the clipboard its empty, I'm doing Dim objWord As New...
by: Tim | last post by:
Since rtf files cause so many troubles, i.e., allow the users to download the files, slow loading, incompatible with other browser, and so on. Do...
by: s.danyal.k | last post by:
Hi All, I have created an application in C# that converts HTML file to MS word documents. The HTML file may also have images , for e.g "<img...
by: ajaxnewbie | last post by:
Can someone help me convert the PHP lines below from PHP to Coldfusion? <?php $ftmp = $_FILES; $oname = $_FILES; $fname = 'upload/'.$_FILES;...
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an...
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.