Link to home
Start Free TrialLog in
Avatar of pakku
pakku

asked on

Converting a Word Document to a BMP file

I have a very peculiar requirement. I have to convert a MsWord document to a BMP file.  The word document has text as well as image in it (signature in bmp format).

Could anyone help me to do this please. This is very urgent.

Thanks
Prakash
Avatar of Zoplax
Zoplax

Open two instances of MSPAINT.

Open MSWord.

Assuming the document is one page, view the top half of the document and hit the PrintScreen key (usually in the upper-right area of the keyboard to the left of the Scroll Lock key).

Go to one of the MSPAINT sessions, and hit Ctrl-V, or click Edit => Paste.  The top half of the document should appear there.

Go back to the MSWord window and view the bottom half of the document.  Hit the PrintScreen key.

Go to the second MSPAINT session and paste the image.  Then, use the selection tool to highlight the bottom half of the document (basically, where the top of the document ends, the bottom of the document begins).

Click on Edit => Copy to copy the highlighted portion of the bottom of the doc.  Then, Paste that selection into the first MSPAINT session.

Slide the second part of the doc until the entire doc is visible on the screen.  Then, use the selection tool to highlight the document, and click Edit => Copy.

Click File => New in MSPAINT to open a new image.  Click Paste to paste the document.  Click File => Save As, and save the document as a 16-color BMP file.
Avatar of Brendt Hess
There are printer drivers out there for Windows that will print to BMP.  If this is a one-time thing, you can use one of their free trial installs.  If it will be ongoing, I believe that the commercial programs will be most efficient for this.

http://www.peernet.com/drivers/F._BMP_Driver.html
Demo available
1 end user license: $59.95
Developer kit (redistributable with your program) available.

http://www.informatik.com/tiffwork.html

Designed for printing to TIFF files, but has an add-on for printing BMPs.
Demo Available
1 User $70.00
Does not appear to have a re-distributable version.
hi pakku,

the brute force way would be to print out each page and then scan the pages with your scanner and save as .BMP..
usually the default file type..also you could save each page as .jpg  for much smaller file size and easy to send over the internet.  also you can check and modify the layout of each page and modify, if required for the final scan and .BMP file for your requirement.

sincerely

leo
Dim WordApp As Word.Application
Dim WordDoc As Word.Document



Private Sub Form_Click()
Dim rng As Range
Set rng = WordDoc.Content
With rng
   .WholeStory
   .CopyAsPicture
End With

Picture1.PaintPicture Clipboard.GetData(vbCFEMetafile), 0, 0, , , , , , vbMergePaint
SavePicture Picture1.Image, "E:\VB Proj\Doc to bmp\doctobmp.bmp"
End Sub

Private Sub Form_Load()
Set WordApp = New Word.Application
Set WordDoc = WordApp.Documents.Open("E:\VB Proj\Doc to bmp\doctobmp.doc")
WordApp.Visible = True
End Sub
Using BMP files has its penalties.
Even a little word document could expand to several KB.
By the way, any progress with this matter?
NOte: Set Autoredraw and autosize properties to true for picture1 control.
Cheers
ASKER CERTIFIED SOLUTION
Avatar of Richie_Simonetti
Richie_Simonetti
Flag of Argentina image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pakku

ASKER

Thanks Zoplax.
I am sorry. But my question was related to Word macro programming. I should have mentioned in my question. Sorry about that.

Thanks anyway.
Pakku
Avatar of pakku

ASKER

Thanks bhess1,

Your answer was one of the closest.  
The first link you mentioned, I tried. But the developers kit is too expensive. So I had to drop it.  I could not try the second link. Sorry about that.

Thanks anyway.

Avatar of pakku

ASKER

Thanks leo. But I am sorry that my question is word macro programming related.

Avatar of pakku

ASKER

Thanks Ritchi.  You answer is the closest and I had already tried it Except I did not try the vbCFEMetafile while getting data from the clip board.

I have two questions. My word document has a digital signature and regular word contents. Will your program work. I will be trying it tomorrow. I shall get back to you on that after that. As of now I think that the points belong to you.

Second is what happens if my word document has 10 pages.
Just curious.

Pakku
Avatar of pakku

ASKER

Ritchi,

I could do this program using a very little known ActiveX control called Kodak Image Control in a word macro. I would admit that yours is the simplest solution.

Thanks
Prakash.
Thanks. If your doc has several pages, it would be a bmp of several MB in size.
BMP is not the best way to store a picture.
Avatar of pakku

ASKER

Richie,

Your solution worked. Thanks for your help. The points are yours.

I agree with what are your saying about the size. But unfortunately I am trying to integrate my program with an existing product that takes data either in text format or BMP format.

Since the word document has electronic digital signature in it, I have to store it as BMP. I dont have a choice.

With your program, the bmp file size of a single page signed word document is 1.8MB.  But with Kodak control and a complex programming logic I could bring down the size to around 900 KB. Well, the BMP is stored as a 256 color bitmap not 24 bit.

I would vote for your solution as it simple and elegant.

Thanks once again.
Prakash
Thanks. I have been working hard to find the solution. Surely, you don't want to know about my experiments, really.
How much color depth do you need?, it could be monochrome?
Avatar of pakku

ASKER

256 Colors is enough.