You are not logged in.
Pages: 1
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
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
We have added TPdfDocumentGDI.DisableMetaFileTextClipping property
and corresponding optional parameter to TPdfCanvas.RenderMetaFile().
Hope it helps.
Offline
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
You are using a deprecated version of SynCommons.pas.
Please download the latest version, e.g. from https://github.com/synopse/SynPDF
Offline
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
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
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
Pages: 1