Page 1 of 1

Metafile are created differently

Posted: Tue Sep 20, 2016 2:33 pm
by yagui
Hi,
I really need help with this issue. I'm generating the EMF files to create a PDF in different machines but I can see that the resulting EMF file are different.

I upload the resulting EMF files and the rvf original file. You can download from https://uploadfiles.io/baf23

Why the EMFs are different if they were created from the same rvf document with the same source code but in different PCs?

The source code that I'm using is:

Code: Select all

  SRichViewEdit1.RichViewEdit.ClearLiveSpellingResults;
  SRichViewEdit1.RichViewEdit.LiveSpellingMode := rvlspManualStart;

  rve := SRichViewEdit1.ActiveEditor;
  rve.SetSelectionBounds(rve.CurItemNo, rve.OffsetInCurItem, rve.CurItemNo, rve.OffsetInCurItem);
  rve.Invalidate;

  SRichViewEdit1.ViewProperty.ZoomPercent := 100;

  TempFile := GenerateTempFilename;
  WPPDFPrinter1.FileName := TempFile;
  WPPDFPrinter1.CompressStreamMethod := TWPCompressStreamMethod.wpCompressFlate;

  WPPDFPrinter1.FontMode := TWPPDFFontMode.wpEmbedSymbolTrueTypeFonts; //solamente incrusta los Fonts symbol como el codigo de barra
  WPPDFPrinter1.Info.Title := IntToStr(_idTexto);
  WPPDFPrinter1.BeginDoc;

  Impares := 1;

  try
    for LI := 1 to SRichViewEdit1.PageCount do
    begin
         a := TMetafile.Create;
         a.Width :=  SRichViewEdit1.PageWidthPix;
         a.Height := SRichViewEdit1.PageHeightPix;

         SRichViewEdit1.DrawMetafile(LI, a ,SRichViewEdit1.PageProperty.PageNoVisible,true,false);

         a.SaveToFile('C:\Users\mandres\AppData\Roaming\SimpCivil\' + IntToStr(LI) + '.emf');

         Impares := Impares * -1;

         WPPDFPrinter1.DrawMetafile(0, 0, a.Handle);

         a.Free;

    end;
  finally
    WPPDFPrinter1.EndDoc;
  end;



I really appreciate your help in this issue.

Thanks and regards,
Martin

Posted: Tue Sep 20, 2016 4:21 pm
by Sergey Tkachenko
Answered by email

Posted: Thu Sep 22, 2016 6:47 am
by Sergey Tkachenko
Summary of our conversation.

The problem happens when generating metafiles while accessing a computer via a remote desktop, with a changed desktop resolution.
Previously, a similar problem was reported for metafiles generated in a virtual machine, in a windowed mode.

This problem is not related to our components, it affects all TMetafile metafiles created on such computers. Horizontal and vertical dpi values are calculated incorrectly. A workaround - using remote desktops and virtual machines in a full screen mode.