Solved

ASP creating RTF File with a BMP image

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Send to Print Preview database record with one click 3 36
Select2 jquery help 9 45
asp syntax 3 24
Error viewing ASP page 12 94
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now