Solved

ASP creating RTF File with a BMP image

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
If-Then-Else ASP problem 6 78
age from date of birth 4 63
Table doesn't show the lines! 3 33
Adding Clickable Links to JQuery Data Items 24 52
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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/…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

736 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