Convert word document to JPEG. The word doc may contain headerfoo

V

Vijayaram B

Can anyone help me out ,
How to convert the first page of a word document to JPEG image, as we see it
in the print prview window.

Methods tried: Copy Headerfooter and doc content and then read from
clipboard meta file and finally form a image.

Issues faced: Content may get truncated, or automatically the doc content in
the image get wrapped according to the image size.

Method tried: Document image writer method,
Issues faced : It has to be installed during office installation itself,
this is not possible right now, as we don't know who has installed this and
who does not.

May be if i get a freely distributable msi kit for Document image writer
alone it will be fine.
 
G

Graham Mayor

Download the trial version of SnagIt. 'Print' the first page of the document
to the SnagIt driver with the output format set to jpg.

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
T

Tony Jollans

You might want to take a look at the EnhMetaFileBits property of the page in
the Pages collection - this will not create a jpeg directly (but you can
write a bmp from it), but can be fed to a graphics program for conversion.
 
V

Vijayaram B

Hi Tony,
Thanks for coming closer to the discussion. Can you explain a bit clear how
to convert it to bmp. For me bmp format is also ok.
 
T

Tony Jollans

This code does create a bmp file of the page --- but --- it doesn't open in
Windows (Vista) default viewer and it takes ages (15 minutes plus on my
machine) to open in MS Paint; Snagit, however, opens it in seconds.

Sub SavePage()

Dim ImageStream ' As ADODB.Stream
Dim UserView As WdViewType

Application.ScreenUpdating = False
UserView = ActiveWindow.View
ActiveWindow.View = wdPrintView

Set ImageStream = CreateObject("ADODB.Stream")
With ImageStream
.Type = 1 ' adTypeBinary
.Open
.Write ActiveWindow.ActivePane.Pages(1).EnhMetaFileBits
.SaveToFile "C:\Page.bmp"
.Close
End With

ActiveWindow.View = UserView

Set ImageStream = Nothing

End Sub

You will need a reference to Microsoft ActiveX Data Objects Library, version
2.5 or later, to use early binding and the commented out names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top