Solved

ASP creating RTF File with a BMP image

Posted on 2004-10-19
4
324 Views
Last Modified: 2008-01-09
My ASP code is creating an RFT document on the fly.  Here is a sample:

"{\rtf1\ansi\deff0 {\fonttbl {\f0 Arial;}{\f1 Webdings;}}\margl720\margr720\margt720\margb720 "
bol_rtf_header = "" & _
  "{\trowd\trrh400\tposyil\trpaddl90\trpaddfl3" & _
    "\clvertalc\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clmgf\cellx7200" & _
    "\clvertalc\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clmrg\cellx10800" & _
    "\pard\intbl {\b\f0\fs28\qc STRAIGHT BILL OF LADING - SHORT FORM - ORIGINAL - NOT NEGOTIABLE\cell\cell}" & _
  "\row" & _
  "\trowd\trrh590\tposyil\trpaddl90\trpaddfl3" & _
    "\clvertalt\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\clvmgf\cellx7200" & _
    "\clvertalc\clbrdrt\brdrs\brdrw10\clbrdrl\brdrs\brdrw10\clbrdrb\brdrs\brdrw10\clbrdrr\brdrs\brdrw10\cellx10800" & _
    "\pard\intbl {\f0\b\fs24\sb180 Carrier: {\*\tpltField[[carr_name]]}" & _
'NEW CODE GOES HERE
    "\par\sb180\b0\fs18 " & _

After the "Carrier:" and before the new paragraph ("\par"), I need to embed a BMP image.

I already have a function that creates the BMP binary stream, now I just need to know how to dump that stream into my RTF code so that it creates the image.

From my research so far I have gathered that I need a line somewhat like this:

{\pict\wbitmap0\picw170\pich77\wbmbitspixel1\wbmplanes1\wmbwidthbytes22\picwgoal505\pichgoal221\picscalex172\picscaley172 [BINARY CODE HERE???]

Any ideas?
0
Comment
Question by:CreateObject
4 Comments
 
LVL 4

Expert Comment

by:carlmahon
ID: 12355272
Is the BMP dynamic?

My first thought would be to take an rtf file that was created from the script. Open it up and add in the bmp in the desired location and save it. Then compare the before and after in a text editor but it looks like you may have already done that.

If the problem is writing binary data into a file that is not opened for binary writing. Then look at this article about converting binary to a string so you can easily write it in your file.

http://www.motobit.com/tips/detpg_binarytostring.htm      

Carl


0
 
LVL 5

Author Comment

by:CreateObject
ID: 12356838
I solved the problem, but I'll post the answer here in case anyone else ever runs across this issue.

I used an ASP page to generate the BMP file on the fly, and then I embedded the HTTP URL as the path to the image in the RTF document.  That code is below:

"{\field\fldedit{\*\fldinst { INCLUDEPICTURE \\d " & _
                Chr(34) & "http://myserver.com/path_to_asp/barcode.asp?parameters=y" & chr(34) & _
    " \\* MERGEFORMATINET}}{\fldrslt{}}}" & _
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12771823
PAQed with points refunded (250)

modulo
Community Support Moderator
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question