Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print Object graphics, Text and EMail

Status
Not open for further replies.

luanahubbart

Programmer
Jul 28, 2004
18
US
Hi,

I am creating a report with a Logo(Picture) at the top. I am using the Printer Object and the report works fine. However, the user now wants the capability to email this report.

Any thoughts on what to do?

Thanks,
Luana.
 
Luan...,

There are (a least) a couple of approaches;

1. If you have Acrobat Writer(its not free) or something similar which gives you an Acrobat Printer Object, that printer will appear in your available printers list. Print to that printer and an Acrobat PDF file will be produced, email that doc to your user. If he has Acrobat reader(it is free) he will be able to read it.

2. Create a picture box on a form the same size as your paper, print the report to the picture instead of the printer. You can make the picturebox invisible but otherwise you have basics of a print preview feature too. The code to do this can be minimal if you do stuff like;

dim Pdev as object

If IWantPrintout then
set Pdev = Printer
else 'I just want preview
set Pdev = MyPicture(0)
end if
'carry on with your normal printing using
Pdev.Print stuff
'rather than your usual Printer.Print stuff
'at the bottom do
if TypeOf Pdev is Printer then Printer.EndDoc

'new pages can be handled like
if TypeOf Pdev is Printer then
Printer.NewPage
else
set Pdev = MyPicture(PageNo)
end if

You can then save out the contents of the picture(s) to a bitmap (.bmp file) and attach that to an email. Any recipient with a basic graphics editor eg. MS Paint will be able to view the file/ report. Alternatively and a little more sophiticated copy and paste the contents of the picture and copy (wrap) it into an open Word document; then attach the Word doc to an email. The recipient will then require Word.
The quality of the image of the report contained in the bitmap will be inferior to that acheivable with Acrobat but may be adequate for most purposes.

Hope this helps.

Regards Hugh,

 
Thanks, right now I don't have Acrobat Writer, might have to invest in one, but I will give the Picture method a shot!
 
How can I make the form bigger than the screen, i.e. the size of my page?
 
There are several other PDF generators, some free, some cheap, some trialware. To see if it works for you, try pdf995 from:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

For tsunami relief donations

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
luanahubbart,

You will need a Horizontal Scrollbar control and a Vertical Scrollbar control on the form along with the picturebox then do stuff like (Example for Vscroll only), Hscroll is similar.

Place the Vscrollbar at the extreme right of the form and make it the full height of the form. If the form is resizable, keep the scroll bar sized and in place using the form's Resize event.

After setting the PictureBox size do this;

VScroll1.Max = Pic(0).Height - Me.ScaleHeight

Then you should be able to scroll the PictureBox within the Form with;

Private Sub VScroll1_Change()

Pic(0).Top = -VScroll1.value + VScroll1.Top

End Sub
'and
Private Sub HScroll1_Scroll()

HScroll1_Change

End Sub


regards Hugh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top