#1 2014-09-26 15:05:27

plamen_f
Member
Registered: 2014-09-26
Posts: 4

SynPDF lib on wine

Hello!

1-st sorry for my bad English....

So,  we use SynPDF lib in our apps. It works great on Windows!
As we have customers that using our apps on linux (via wine) we discover that when SynPDF render metafile - resulted pdf is blank (except lines...).
I don't know why but after last night i realize that text is here - but the color is also white... Testing with different fonts and colors did not affect on situation.

Please if anyone have idea hot to resolve the problem - let me know!

10x in advance!

Offline

#2 2014-09-29 10:50:22

hn
Member
Registered: 2014-09-29
Posts: 3

Re: SynPDF lib on wine

Hi

We had same problem with SynPDF metafile rendering under Wine (OS X): no text visible, only lines.
Looks like there is something wrong with text clipping handling. Quick workaround was switching it off:

procedure TPdfEnum.TextOut(var R: TEMRExtTextOut);
...
    // detect clipping
    //with R.emrtext.rcl do // original code
      //WithClip := (Right>Left) and (Bottom>Top); // original code
    WithClip := false; // workaround for Wine
...

Last edited by hn (2014-09-29 10:50:54)

Offline

#3 2014-09-29 11:27:20

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

Re: SynPDF lib on wine

We have added TPdfDocumentGDI.DisableMetaFileTextClipping property
and corresponding optional parameter to TPdfCanvas.RenderMetaFile().

Hope it helps.

See http://synopse.info/fossil/info/07a3fcbeab

Offline

#4 2014-10-01 08:13:15

plamen_f
Member
Registered: 2014-09-26
Posts: 4

Re: SynPDF lib on wine

Hello!

10x for the patch!
I downloaded the new version of SynPDF.pas

But unfortunately,  when I'm trying to build the project there are error on the code:


procedure DoHash(bits: pointer; size: Integer);
    begin // "4 algorithms to rule them all": all SynCommons hashers to the rescue!
      Hash[0] := crc32c(Hash[0],bits,size);
      Hash[1] := kr32(Hash[1],bits,size);
      Hash[2] := fnv32(Hash[2],bits,size);
      Hash[3] := Hash[3] xor Hash32(bits,size);
    end;

[Pascal Error] SynPdf.pas(5908): E2003 Undeclared identifier: 'crc32c'

What I'm doing wrong?

Offline

#5 2014-10-01 10:28:20

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

Re: SynPDF lib on wine

You are using a deprecated version of SynCommons.pas.

Please download the latest version, e.g. from https://github.com/synopse/SynPDF

Offline

#6 2014-10-01 11:41:47

plamen_f
Member
Registered: 2014-09-26
Posts: 4

Re: SynPDF lib on wine

Hello again!

I downloaded the new version of Commons and now compilation is ok.
Unfortunately the result under wine is the same. White paper/white fonts.

Here is the code of generating procedure:

procedure ReportExport(aReport: TQuickRep; const aFileName: TFileName);
var Pdf: TPdfDocumentGDI;
     aMeta: TMetaFile;
     i: integer;
begin
  Pdf := TPdfDocumentGDI.Create;


  try
    aReport.Prepare;
    for i := 1 to aReport.QRPrinter.PageCount do
    begin
      aMeta := aReport.QRPrinter.GetPage(i);
      try
        Pdf.DefaultPageWidth := MulDiv(aMeta.Width,72,Pdf.ScreenLogPixels);
        Pdf.DefaultPageHeight := MulDiv(aMeta.Height,72,Pdf.ScreenLogPixels);
        Pdf.AddPage;
        // draw the page content
        // Pdf.Canvas.re
        //Pdf.Canvas.RenderMetaFile(aMeta);
        Pdf.DisableMetaFileTextClipping:=true;
        Pdf.Canvas.RenderMetaFile(aMeta,1,0,0);
      finally
        aMeta.Free;
      end;
    end;
      Pdf.SaveToFile(aFileName);
  finally
    Pdf.free;
  end;
end;

If there any ideas - please, let me know!

Tank you again for your time!

Offline

#7 2014-10-01 16:38:31

hn
Member
Registered: 2014-09-29
Posts: 3

Re: SynPDF lib on wine

When calling RenderMetaFile directly, parameter DisableTextClipping is overriding DisableMetaFileTextClipping property:

procedure RenderMetaFile(MF: TMetaFile; Scale: Single=1.0;
      XOff: single=0.0; YOff: single=0.0;
      TextPositioning: TPdfCanvasRenderMetaFileTextPositioning=tpSetTextJustification;
      KerningHScaleBottom: single=99.0; KerningHScaleTop: single=101.0;
      DisableTextClipping: boolean=false);

So you can use:

Pdf.Canvas.RenderMetaFile(aMeta, 1, 0, 0, Pdf.UseMetaFileTextPositioning, Pdf.KerningHScaleBottom, Pdf.KerningHScaleBottom,
          Pdf.DisableMetaFileTextClipping);

Offline

#8 2014-10-01 16:49:09

plamen_f
Member
Registered: 2014-09-26
Posts: 4

Re: SynPDF lib on wine

10x man, but same result here...
I can send you result as pdf ...

edit:
I forget to describe - no mater what color is text (i check it with green and red) - on Windows colors are correct, but on wine - still white.

Last edited by plamen_f (2014-10-01 17:49:00)

Offline

Board footer

Powered by FluxBB