Class MetaFile
Class used engine to read/write metafiles.
Inherited Members
Namespace: Reportman.Drawing
Assembly: Reportman.Drawing.dll
Syntax
public class MetaFile : IDisposable, ICloneable
Constructors
MetaFile()
Constructor
Declaration
public MetaFile()
Fields
AlignmentFlags_AlignBottom
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_AlignBottom = 16
Field Value
| Type | Description |
|---|---|
| int |
AlignmentFlags_AlignHCenter
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_AlignHCenter = 4
Field Value
| Type | Description |
|---|---|
| int |
AlignmentFlags_AlignHJustify
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_AlignHJustify = 1024
Field Value
| Type | Description |
|---|---|
| int |
AlignmentFlags_AlignLeft
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_AlignLeft = 1
Field Value
| Type | Description |
|---|---|
| int |
AlignmentFlags_AlignRight
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_AlignRight = 2
Field Value
| Type | Description |
|---|---|
| int |
AlignmentFlags_AlignVCenter
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_AlignVCenter = 32
Field Value
| Type | Description |
|---|---|
| int |
AlignmentFlags_SingleLine
Constant used for storing all alignment information into a single integer value
Declaration
public const int AlignmentFlags_SingleLine = 64
Field Value
| Type | Description |
|---|---|
| int |
AsyncReading
If set to true, the MetaFile will be read asynchronously
Declaration
public bool AsyncReading
Field Value
| Type | Description |
|---|---|
| bool |
AutoScale
Default scale type when previewing the MetaFile
Declaration
public AutoScaleType AutoScale
Field Value
| Type | Description |
|---|---|
| AutoScaleType |
BackColor
Default page back color
Declaration
public int BackColor
Field Value
| Type | Description |
|---|---|
| int |
CollateCopies
Default collate copies setting
Declaration
public bool CollateCopies
Field Value
| Type | Description |
|---|---|
| bool |
Copies
Default number of copies to print
Declaration
public int Copies
Field Value
| Type | Description |
|---|---|
| int |
CurrentPage
Current page index, page being processed actually, the report can be processed asynchronously
Declaration
public int CurrentPage
Field Value
| Type | Description |
|---|---|
| int |
CustomX
Width in twips of the page
Declaration
public int CustomX
Field Value
| Type | Description |
|---|---|
| int |
CustomY
Height in twips of the page
Declaration
public int CustomY
Field Value
| Type | Description |
|---|---|
| int |
DocAuthor
Declaration
public string DocAuthor
Field Value
| Type | Description |
|---|---|
| string |
DocCreationDate
Declaration
public string DocCreationDate
Field Value
| Type | Description |
|---|---|
| string |
DocCreator
Declaration
public string DocCreator
Field Value
| Type | Description |
|---|---|
| string |
DocKeywords
Declaration
public string DocKeywords
Field Value
| Type | Description |
|---|---|
| string |
DocModificationDate
Declaration
public string DocModificationDate
Field Value
| Type | Description |
|---|---|
| string |
DocProducer
Declaration
public string DocProducer
Field Value
| Type | Description |
|---|---|
| string |
DocSubject
Declaration
public string DocSubject
Field Value
| Type | Description |
|---|---|
| string |
DocTitle
Declaration
public string DocTitle
Field Value
| Type | Description |
|---|---|
| string |
DocXMPContent
Declaration
public string DocXMPContent
Field Value
| Type | Description |
|---|---|
| string |
Duplex
Default duplex setting
Declaration
public byte Duplex
Field Value
| Type | Description |
|---|---|
| byte |
EmbeddedFiles
Declaration
public List<EmbeddedFile> EmbeddedFiles
Field Value
| Type | Description |
|---|---|
| List<EmbeddedFile> |
Empty
Flag available for information of metafile status, default false, empty.
Declaration
public bool Empty
Field Value
| Type | Description |
|---|---|
| bool |
ForwardOnly
ForwardOnly is set to true when there is no need to store processed pages in memory that is usable for long reports with lot of pages that are printet directly to printer so the memory consumption is minimized
Declaration
public bool ForwardOnly
Field Value
| Type | Description |
|---|---|
| bool |
LinesPerInch
Default lines per inch in the page, have sense only when printing to Pos devices
Declaration
public short LinesPerInch
Field Value
| Type | Description |
|---|---|
| short |
MAX_NUMBER_PAGES
Maximum number of pages that can contain a MetaFile (32000)
Declaration
public const int MAX_NUMBER_PAGES = 32000
Field Value
| Type | Description |
|---|---|
| int |
OpenDrawerAfter
True if the program should open the Pos drawer after printing
Declaration
public bool OpenDrawerAfter
Field Value
| Type | Description |
|---|---|
| bool |
OpenDrawerBefore
True if the program should open the Pos drawer before printing
Declaration
public bool OpenDrawerBefore
Field Value
| Type | Description |
|---|---|
| bool |
Orientation
Page orientation
Declaration
public OrientationType Orientation
Field Value
| Type | Description |
|---|---|
| OrientationType |
PDFCompressed
Declaration
public bool PDFCompressed
Field Value
| Type | Description |
|---|---|
| bool |
PageSizeArray
Array of page sizes
Declaration
public static int[,] PageSizeArray
Field Value
| Type | Description |
|---|---|
| int[,] |
PageSizeIndex
Default page size index in PageSizeArray
Declaration
public int PageSizeIndex
Field Value
| Type | Description |
|---|---|
| int |
Pages
Collection of pages
Declaration
public MetaPages Pages
Field Value
| Type | Description |
|---|---|
| MetaPages |
PaperSource
Default paper source, this integer value is understandable by the print driver
Declaration
public int PaperSource
Field Value
| Type | Description |
|---|---|
| int |
PreviewAbout
True if the about box in preview window should be visible
Declaration
public bool PreviewAbout
Field Value
| Type | Description |
|---|---|
| bool |
PreviewMargins
True if the hard margins should be visible in preview
Declaration
public bool PreviewMargins
Field Value
| Type | Description |
|---|---|
| bool |
PreviewWindow
Default window size when previewing the MetaFile
Declaration
public PreviewWindowStyleType PreviewWindow
Field Value
| Type | Description |
|---|---|
| PreviewWindowStyleType |
PrinterFonts
Default printer fonts selection
Declaration
public PrinterFontsType PrinterFonts
Field Value
| Type | Description |
|---|---|
| PrinterFontsType |
PrinterSelect
Printer to select when printing the MetaFile
Declaration
public PrinterSelectType PrinterSelect
Field Value
| Type | Description |
|---|---|
| PrinterSelectType |
Properties
Finished
Indicates if the MetaFile processing have been finished, the report processing can be done asynchronously
Declaration
public bool Finished { get; }
Property Value
| Type | Description |
|---|---|
| bool |
PDFConformance
Declaration
public PDFConformanceType PDFConformance { get; set; }
Property Value
| Type | Description |
|---|---|
| PDFConformanceType |
Reading
Indicates if the MetaFile is still reading from original stream, the report reading can be done asynchronously, so you can show the first page while receiving the other pages using a low bandwidth connection
Declaration
public bool Reading { get; }
Property Value
| Type | Description |
|---|---|
| bool |
SharedStream
Stream used to save image streams shared between multiple pages
Declaration
public MemoryStream SharedStream { get; }
Property Value
| Type | Description |
|---|---|
| MemoryStream |
Version
Declaration
public MetaFile.MetaFileVersion Version { get; set; }
Property Value
| Type | Description |
|---|---|
| MetaFile.MetaFileVersion |
Methods
AddMetaFiles(List<MetaFile>)
Declaration
public void AddMetaFiles(List<MetaFile> nlist)
Parameters
| Type | Name | Description |
|---|---|---|
| List<MetaFile> | nlist |
BeginPrint(PrintOut)
Starts printing
Declaration
public void BeginPrint(PrintOut driver)
Parameters
| Type | Name | Description |
|---|---|---|
| PrintOut | driver | Report preocessing driver |
CalcTextExtent(PrintOut, Point, TextObjectStruct)
Calculates the extent of a text, given a output driver
Declaration
public static int CalcTextExtent(PrintOut adriver, Point maxextent, TextObjectStruct objt)
Parameters
| Type | Name | Description |
|---|---|---|
| PrintOut | adriver | Report processing driver |
| Point | maxextent | Maximum extent |
| TextObjectStruct | objt | Text content and options like font, alignment |
Returns
| Type | Description |
|---|---|
| int | Returns the current text position if the text does not fit in the bounding box |
Clear()
Clear MetaFile, that is clear all pages and objects
Declaration
public void Clear()
Clone()
Declaration
public object Clone()
Returns
| Type | Description |
|---|---|
| object |
Dispose()
Free resources
Declaration
public virtual void Dispose()
DoSearch(string)
Executes a word search in the metafile, a list of coincidences will be updated
Declaration
public void DoSearch(string svalue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | svalue | String value to search in the entire MetaFile |
Finish()
Finish the report processing
Declaration
public void Finish()
LoadFromFile(string)
Load the stream from a file
Declaration
public void LoadFromFile(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | File name to load |
LoadFromStream(Stream, bool)
Load a MetaFile from a stream
Declaration
public void LoadFromStream(Stream astream, bool ClearFirst)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | astream | Source stream |
| bool | ClearFirst | Set it to true to clear the MetaFile before reading |
NewEmbeddedFile(string, string, PDFAFRelationShip, string, string, string, MemoryStream)
Declaration
public void NewEmbeddedFile(string fileName, string mimeType, PDFAFRelationShip AFRelationShip, string description, string creationDate, string modificationDate, MemoryStream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| string | fileName | |
| string | mimeType | |
| PDFAFRelationShip | AFRelationShip | |
| string | description | |
| string | creationDate | |
| string | modificationDate | |
| MemoryStream | stream |
NextPageFound(int)
Returns the next page index where the last search occur
Declaration
public int NextPageFound(int currpage)
Parameters
| Type | Name | Description |
|---|---|---|
| int | currpage |
Returns
| Type | Description |
|---|---|
| int |
ObjectFound(MetaObject)
Returns true if the object was found in the previous search
Declaration
public bool ObjectFound(MetaObject aobject)
Parameters
| Type | Name | Description |
|---|---|---|
| MetaObject | aobject | MetaObject to search |
Returns
| Type | Description |
|---|---|
| bool |
ReadStringFromStream(Stream)
Declaration
public string ReadStringFromStream(Stream stream)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream |
Returns
| Type | Description |
|---|---|
| string |
Release()
Release resources
Declaration
public void Release()
RequestPage(int)
Wait until the page requested is already calculated
Declaration
public bool RequestPage(int pageindex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | pageindex | Page index to wait for |
Returns
| Type | Description |
|---|---|
| bool | Returns true if the page exists |
SaveToFile(string, bool)
Save the MetaFile to a file
Declaration
public void SaveToFile(string filename, bool compressed)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | File name |
| bool | compressed | Set to true to compress the MetaFile |
SaveToStream(Stream, bool)
Save the MetaFile to a stream
Declaration
public void SaveToStream(Stream astream, bool compressed)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | astream | Destination stream |
| bool | compressed | Set it to true to compress the stream |
StopWork()
Forces stop of the asynchronous reading of MetaFile
Declaration
public void StopWork()
UnFinish()
Finish the report processing
Declaration
public void UnFinish()
UpdateTotalPages(TotalPages)
Updates all references to total pages to the total page count. This is useful to update the page count when concatenating MetaFiles
Declaration
public void UpdateTotalPages(TotalPages alist)
Parameters
| Type | Name | Description |
|---|---|---|
| TotalPages | alist | Total pages list |
UpdateTotalPagesPCount(TotalPages, int)
Updates all references to total pages to the total page count. This is useful to update the page count when concatenating MetaFiles
Declaration
public void UpdateTotalPagesPCount(TotalPages alist, int pcount)
Parameters
| Type | Name | Description |
|---|---|---|
| TotalPages | alist | Total pages list |
| int | pcount | Page count |
WorkAsyncError(string)
Fires a OnWorkAsyncError
Declaration
public void WorkAsyncError(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | Error message |
WorkProgress(int, int, ref bool)
Fires the event OnWorkProgress
Declaration
public void WorkProgress(int records, int pagecount, ref bool docancel)
Parameters
| Type | Name | Description |
|---|---|---|
| int | records | Number of records processed |
| int | pagecount | Current page count |
| bool | docancel | Set this reference variable to true to cancel report processing |
WriteStringToStream(string, Stream)
Declaration
public void WriteStringToStream(string astring, Stream deststream)
Parameters
| Type | Name | Description |
|---|---|---|
| string | astring | |
| Stream | deststream |
Events
OnBeginPrint
Event to monitor when the printing starts
Declaration
public event BeginPrintOut OnBeginPrint
Event Type
| Type | Description |
|---|---|
| BeginPrintOut |
OnLoadError
Event to monitor error while loading a report
Declaration
public event MetaFileLoadError OnLoadError
Event Type
| Type | Description |
|---|---|
| MetaFileLoadError |
OnLoadProgress
Event to monitor loading of MetaFile
Declaration
public event MetaFileLoadProgress OnLoadProgress
Event Type
| Type | Description |
|---|---|
| MetaFileLoadProgress |
OnRelease
Release resources (database connections if Report Active
Declaration
public event MetaStopWork OnRelease
Event Type
| Type | Description |
|---|---|
| MetaStopWork |
OnRequestPage
Event to monitor when a page have been requested
Declaration
public event RequestPageEvent OnRequestPage
Event Type
| Type | Description |
|---|---|
| RequestPageEvent |
OnSaveWorkProgress
Event to monitor saving of MetaFile
Declaration
public event MetaFileSaveWorkProgress OnSaveWorkProgress
Event Type
| Type | Description |
|---|---|
| MetaFileSaveWorkProgress |
OnStopWork
Event to monitor user cancels the work
Declaration
public event MetaStopWork OnStopWork
Event Type
| Type | Description |
|---|---|
| MetaStopWork |
OnWorkAsyncError
Event to monitor error while processing the report
Declaration
public event MetaFileWorkAsyncError OnWorkAsyncError
Event Type
| Type | Description |
|---|---|
| MetaFileWorkAsyncError |
OnWorkProgress
Event to monitor report processing
Declaration
public event MetaFileWorkProgress OnWorkProgress
Event Type
| Type | Description |
|---|---|
| MetaFileWorkProgress |