Solved

ASP creating RTF File with a BMP image

Posted on 2004-10-19
4
335 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 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