Question

I got a "new job" to "archive" some data with QR Filter.

When the data structure modified and saved to database then we start a "silent printing" with WMF filter, I catch the files, and I store them all in log record, in a DataBase BLOB.

Everything was ok, but later they are needed to avoid repeating the same reports.

We disabled the "timestamp QR fields", but the record repeated.

I put some CRC in the database, and I calculated it from page data (WMF).

What was interesting was that when I exited the program, the newly generated WMF changed - so the CRC changed too.

I thought this was caused by QR, then I checked this with a simple Delphi program:

procedure TForm1.BitBtn1Click(Sender: TObject);
var
    WMF : TMetaFile;
    mfc : TMetaFileCanvas;
begin
    WMF := TMetaFile.Create;
    mfc := TMetaFileCanvas.Create(WMF, 0);
    try
        WMF.Width := 1000;
        WMF.Height := 1000;
        mfc.Brush.Color := clRed;
        mfc.FillRect(Rect(0, 0, 100, 100));
    finally
        mfc.Free;
        WMF.SaveToFile('test1.wmf');
        WMF.Free;
    end;
end;

When I restart the app, the new wmf file is different from the previous.

I thought that I solve the problem with stretch the wmf into the bmp.Canvas, but this has slowed down the logging, because every bmp was 4 MB, and with 10 pages I must CRC on 4 * 10 MB... (The WMF is only 85-100 KByte per page vs 4 MB bitmap)

So I am searching for some easy way I CAN calculate CRC on WMF, maybe if I can split the WMF header fully, then I get solve this problem... I don't know in this moment.

Do you have some idea? Please let me know!

Thanks.

Était-ce utile?

La solution

Export the report as text, then compare its crc.

This is the easiest solution.

You can also enumerate the metafile elements, but it will be more difficult.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top