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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting metafile from crystal viewer

Status
Not open for further replies.

Frush

Programmer
Jun 27, 2002
75
CA
Short story: I need to create pictures from reports.I found a good piece of code that seem to work great with PreviewPrintController now I was wondering if there was something similar I could do with Crystal.


Friend Class PrintControllerFile
Inherits PreviewPrintController
.....

Public Overloads Overrides Sub OnEndPage(ByVal document As PrintDocument, ByVal e As PrintPageEventArgs)
MyBase.OnEndPage(document, e)

' Get the current Metafile
Dim ppia As PreviewPageInfo() = GetPreviewPageInfo()
Dim ppi As PreviewPageInfo = ppia(ppia.Length - 1)
Dim image As Image = ppi.Image
_Metafile = DirectCast(image, Metafile)

' using ( _Metafile )
If _Format Is ImageFormat.Emf Then
_Metafile.Save(PagePath, _Format)
Return
End If
If _Format Is ImageFormat.Wmf Then
_Metafile.Save(PagePath, _Format)
Return
End If

' _Metafile.Save( PagePath, _Format );
SaveViaBitmap(document, e)
End Sub

In a normal "Print Preview" the PreviewPrintController generate metafiles and save these as the output. By inheriting the PreviewPrintController class you can then override the saving process and save those metafiles as jpeg or whatever. I want to the same thing with Crystal if possible.

This is where I took my code:

Any help, hint, suggestion will be appreciate. Thanks in advance and sorry for my poor english.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top