Visit Gigasoft's Web Site
 ProEssentials v9 Help

EmfToStream Method

Scope All ProEssentials Interfaces

 

EmfToStream (nWidth As Integer, nHeight As Integer, nEmfType As eEmfType, nEmfDC As eEmfDC, bEmfBitmapGradients As Boolean) As Variant

 

Parameter

Description

nWidth

Width in 1/100th millimeters. The dimensions must not equal zero. To insure image quality, the aspect ratio (width/height) must be between 0.333 and 10.0

nHeight

Height in 1/100th millimeters. The dimensions must not equal zero. To insure image quality, the aspect ratio (width/height) must be between 0.333 and 10.0

nEmfType

PEET_EMF_GDI (0)

Legacy GDI enhanced metafile, converted via GDIPlus to simulate GDIPlus within GDI . Highly supported.

Dual format: renders as GdiPlus if available, else renders as Gdi if GdiPlus is not available. File size is usually quite large. MS Office and Adobe supported, though large sized fonts tend to be quirky. Test for Adobe support if you want to print to a PDF. Hopefully Microsoft will improve their poor support for this image format.

Renders as GdiPlus only. File size is very small. GdiPlus must be present and this format has limited support. MS Office/Adobe may not fully support. Test thoroughly if using this setting. Hopefully more support will arrive as file-size and image-quality is best within this format.

nEmfDC

PEEDC_DISPLAY_DPI_ADJ (0)

Uses the current video display Device Context. Metafile header is not modified, and DPI of the metafile will match the DPI of the video display. Best if export will only be viewed on a monitor and never printed.

Uses the current default printer driver. This setting may be the best solution if ExportImageDpi will be set to 300 DPI.

bEmfBitmapGradients

If True, file sizes may be large and radial gradients may show artifacts when nEmfType is 0. Linear gradients are well supported. If False and BitmapGradientMode = True, then the background region will be transparent. In this case, it's best to use black or dark colored chart text.

 

The EmfToStream method is used primarily within an Active Server Page to produce a dynamically generated EMF image upon page request. This is somewhat rare but Internet Explorer does support the EMF format. It may take some tinkering with ExportImageDPI and nWidth and nHeight parameters to find a working solution.

 

Comments

We've only slightly experimented in this direction, but it may be best to have pages designed for screen, and other pages designed for print (using IMG tag WIDTH and HEIGHT attributes to force a physical size, though preparing EMF in a higher DPI, (in this case IE doesn't draw the image high quality to screen (a bug in IE), but does print high quality with a very small sized image (~15K), very ideal for web based high quality printed reports where bandwidth should be absolute efficient.))

 

HTML / ASP Example

The following is an example of using EmfToStream. The example contains two parts, the first part is an HTML page that references the ASP page, the second part contains the ASP page.

 

Part1: HTML page references ASP page containing EmfToStream.

 

<HTML>

<HEAD></HEAD>

<BODY>

<P>Run ASP Server Script via image src to display EMF</P>

<IMG src = "http://www.yourserver.com/buildemf.asp">

</BODY></HTML>

 

Part2: ASP page "buildemf.asp" containing EMFToStream.

 

<%

dim myobj

Set myobj = server.CreateObject("PEGOD.Pegodctrl.1")

myobj.MainTitle = "Hello Internet"

myobj.Subsets = 4

myobj.Points = 12

 

dim i

dim j

for i = 0 to 3

  for j = 0 to 11

    myobj.YData(i,j) = 5 + Rnd(20)

  next

next

 

myobj.ExportImageDpi = 100

Response.BinaryWrite (myobj.EmfToStream(15240, 10160, 0, 0, 0))

 

Set myobj = Nothing

%>