Subject: Metafile manipulation - any language will do
Posted By: kunaalatwork Post Date: 8/27/2006 2:37:56 AM
Hi!

Need your ideas urgently! I have a metafile which I wish to convert to PDF on the fly. The idea is to create a metafile template with placeholder text, which will be parsed and replaced by user information at runtime before generating the PDF. When editing the metafile, I have progressed to the following steps:

1.    Called the Graphics.EnumerateMetaFile() method, which calls the callback method (lets call it ‘Play’)

2.    Called the callback method and obtain the record data

public bool Play(EmfPlusRecordType recordType, int flags, int datasize, IntPtr data, PlayRecordCallback callback)
{
byte[] dataArray = null;
      if (data != IntPtr.Zero)
      {
              dataArray = new byte[datasize];
             Marshal.Copy(data, dataArray, 0, datasize);
      }

3.    Checked whether the record pertains to writing text on the wmf as follows:

if (recordType == EmfPlusRecordType.DrawString)

4.    Called the Metafile.PlayRecord() method to draw the new metafile.

mf.PlayRecord(recordType, flags, datasize, dataArray);


What I’m unable to do is, to parse the dataarray (which contains record data), such that I can replace existing text with new text.


Thanks a LOT for any insights.

Regards,
Kunaal



Go to topic 46773

Return to index page 193
Return to index page 192
Return to index page 191
Return to index page 190
Return to index page 189
Return to index page 188
Return to index page 187
Return to index page 186
Return to index page 185
Return to index page 184