#1 2013-05-21 10:13:00

LeonardU
Member
Registered: 2013-04-23
Posts: 4

Problem with text size?

I generated this EMF file.
When I convert it to pdf it displays like this.

If you notice, there is a difference between them: especially in third (R5,R6) and fifth (R9,R10) row. The row move down and there is no space between the text and the bottom line. If the text size is smaller the problem is not visible. But when it increases the problem becomes visible.

If you help me with this I will appreciate it. Thanks in advance.


Also, I had another problem with the 0 lenght TextRect (it currently displays even if it is 0), but I solved it changing the synpdf source. I'm not an expert, I don't know if this is right, but it saved me a lot:

From:

    // detect clipping
    with R.emrtext.rcl do
      WithClip := (Right>Left) and (Bottom>Top);

To:

    // detect clipping
    with R.emrtext.rcl do
      WithClip := (Right>=Left) and (Bottom>=Top);

From synpdf source line 9247 (leaf f782f5d5e8, artifact 23cf49002b0ca9e14ad3286570b55b235e4dff29).

Last edited by LeonardU (2013-05-21 10:48:29)

Offline

#2 2013-05-21 12:44:03

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

Re: Problem with text size?

Maybe you can try to increase the resolution of the target pdf content.
It may be a floating point conversion issue when scaling.

About clipping, if I do the modification, some of our test metafile does not render correctly.
So I do not understand the point here.
What is the source of your metafiles?
sad

Offline

#3 2013-05-23 07:37:18

LeonardU
Member
Registered: 2013-04-23
Posts: 4

Re: Problem with text size?

Thank you for answering. I'm sorry, but I don't know how to increase the resolution of the target pdf content. If I increase the original size of the metafile there is no change in how the text is displayed...  If I increase the page size of the pdf the content of the metafile is displayed to it's original size, not resized to the entire page of the pdf.

Here is my code :

  Pdf := TPdfDocument.Create;
  Pdf.DefaultPageWidth := MulDiv(Image1.Picture.Metafile.Width,72,Pdf.ScreenLogPixels); // Image1 is a TImage component
  Pdf.DefaultPageHeight := MulDiv(Image1.Picture.Metafile.Height,72,Pdf.ScreenLogPixels);
  Pdf.AddPage;
  Pdf.Canvas.RenderMetaFile(Image1.Picture.Metafile);
  Pdf.SaveToFile(NameOfThePDF);
  Pdf.Free;

The metafiles are created drawing on a MetafileCanvas of a TImage Metafile. The drawing is done by parameters. So the user is able to draw text, lines or insert images with the parameters that he provides.

The user sometimes creates textrects with the width of 0. So it's obvious that the text field should not appear. In the metafile everthing works how it should, but in the PDF the text field appears. Again, I don't know if my modification was right, but it worked for me.

Here is an example of a metafile with a textfield (r2) with the width of 0. And here is the pdf generated with the original synpdf. As you can see, the r2 textfield is displayed.

Offline

Board footer

Powered by FluxBB