?
Solved

ASP creating RTF File with a BMP image

Posted on 2004-10-19
4
Medium Priority
?
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

771 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