#1 2013-07-19 13:41:13

harisma
Member
Registered: 2013-07-19
Posts: 4

Bad result with RenderMetafile

I have some .emf file (i. e. Form4.emf). This file was generated by our ReportCreator, which based on TQuickRep, so i receive this .emf file from follow code

  Report.QRPrinter.GetPage(1)

I wrote simple project with only one button. Button OnClick event have follow code:

procedure TForm1.Button1Click(Sender: TObject);
var
  PDF: TPDFDocument;
  AMeta: TMetafile;
begin
  PDF := TPdfDocument.Create;
  try
    AMeta := TMetafile.Create;
    try
      aMeta.LoadFromFile('C:\Form4.emf');
      Pdf.DefaultPageWidth := MulDiv(aMeta.Width, 72, Pdf.ScreenLogPixels);
      Pdf.DefaultPageHeight := MulDiv(aMeta.Height, 72, Pdf.ScreenLogPixels);
      Pdf.AddPage;
      Pdf.Canvas.RenderMetaFile(aMeta, 1, 0, 0);
    finally
      aMeta.Free;
    end;
    Pdf.SaveToFile('C:\Form4.pdf');
  finally
    Pdf.free;
  end;
end;

But in result Form4.pdf file i see not the same as in Form4.emf file. (Part of text string was cut).

Original files you can look here:
http://ab.inf.ua/pdf/Form4.pdf
http://ab.inf.ua/pdf/Form4.emf

Last edited by harisma (2013-07-19 13:53:38)

Offline

#2 2013-07-19 14:10:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Bad result with RenderMetafile

I just checked with current "unstable" version from http://synopse.info/fossil/wiki?name=Get+the+source

No rendering problem with Form4.emf as you supplied it.

Ensure you download the latest revision.

Offline

#3 2013-07-19 14:54:46

harisma
Member
Registered: 2013-07-19
Posts: 4

Re: Bad result with RenderMetafile

I just download latest version, recompile my test project and rebuild result PDF file. For this simple PDF file all OK, but when I replace .emf file with other (link to this file placed bellow), result PDF file again is bad sad (look at jpg file, where I marks bad places)

Links to new files:
http://ab.inf.ua/pdf/Form.pdf
http://ab.inf.ua/pdf/Form.emf
http://ab.inf.ua/pdf/Form.jpg

Offline

#4 2013-07-19 15:38:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Bad result with RenderMetafile

Form.jpg file is not available.
sad

You may try with the new option named "tpExactTextCharacterPositining" for RenderMetaFile() method.
It is not set by default to ensure pdf files are as small as possible, but it may help you solve your layout concern.

Offline

#5 2013-07-22 06:51:33

harisma
Member
Registered: 2013-07-19
Posts: 4

Re: Bad result with RenderMetafile

ab wrote:

new option named "tpExactTextCharacterPositining"

This value should be a four parameter in method RenderMetafile?

Offline

#6 2013-07-22 07:59:06

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Bad result with RenderMetafile

I guess yes.

Offline

#7 2013-07-22 08:04:57

harisma
Member
Registered: 2013-07-19
Posts: 4

Re: Bad result with RenderMetafile

Thanks. Now i'm happy. Result PDF file look as expected. I awaiting that all my report will be the same correct. smile
Can i ask to you if get any problems with your component again?

Offline

#8 2013-07-22 09:54:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Bad result with RenderMetafile

harisma wrote:

Can i ask to you if get any problems with your component again?

Of course, Yes.

Offline

Board footer

Powered by FluxBB