DB ScalerichviewEdit: problems to export PDF in new version

General TRichView support forum. Please post your questions here
Post Reply
pawnflakes
Posts: 49
Joined: Thu Jan 03, 2008 6:11 pm
Location: South-Africa

DB ScalerichviewEdit: problems to export PDF in new version

Post by pawnflakes »

Hi

I'm using eDocengine to export to .pdf in DBSRichviewEdit. With the previous version of DBSRichviewEdit it was working 100% but with the new version I am unable to export any text (tables and pictures are exported correctly). The text in the pdf is just blank. This is my code - what has changed?

function TfrmMain.MakePageMetafile(PageNo, Width, Height: Integer): TMetafile;
begin
Result := TMetafile.Create;
Result.Width := Width;
Result.Height := Height;
pdfPageNo := PageNo;
DBSRichViewEdit.CanUpdate := False;
DBSRichViewEdit.UseDrawHyperlinksEvent := True;
DBSRichViewEdit.DrawMetafile(PageNo, Result, true, true, False);
DBSRichViewEdit.UseDrawHyperlinksEvent := False;
DBSRichViewEdit.CanUpdate := True;
end;

procedure TfrmMain.BarButton_ExportClick(Sender: TObject);
var r: Boolean;
SaveOptions: TRVSaveOptions;
Metafile : TMetafile;
i:integer;
RVUnit: TRVUnits;
begin
if not sdExport.Execute then exit;

if sdExport.FilterIndex=1 then //PDF
begin
with gtPDFEngine1 do
begin
gtRichViewInterface1.Engine := gtPDFEngine1;
FileName := sdExport.filename;

//Page format
Page.PaperSize := A4;

//Orientation
gtDocSettings1.Page.Orientation:= poPortrait;

gtPDFEngine1.BeginDoc;

if (gtPDFEngine1.EngineStatus <> esStarted) then Exit;
RVUnit:= DBSRichViewEdit.UnitsProgram; //Get the current value
DBSRichViewEdit.UnitsProgram:= rvuPixels; //Change DBSRichviewEdit to pixels for PDF Conversion
for i := 0 to DBSRichViewEdit.PageCount-1 do
begin
DBSRichViewEdit.Update;
if i > 0 then
begin
gtPDFEngine1.NewPage;
end;
Metafile := MakePageMetafile(i+1, ROUND(DBSRichViewEdit.PageProperty.PageWidth),
Round(DBSRichViewEdit.PageProperty.PageHeight));
PlayMetafile(Metafile);
end;
Metafile.Free;
end;
gtPDFEngine1.EndDoc;
DBSRichViewEdit.UnitsProgram:= RVUnit; //Change back to the previous value before converted to pixels
r:= true;
end
pawnflakes
Posts: 49
Joined: Thu Jan 03, 2008 6:11 pm
Location: South-Africa

Post by pawnflakes »

The PaintMetafile demo in the Basic Demos folder produces the same results - is this a bug with Metafiles in the new version?
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Post by Crowbar »

pawnflakes
Posts: 49
Joined: Thu Jan 03, 2008 6:11 pm
Location: South-Africa

Post by pawnflakes »

Hi Crowbar

There is no such topic - could you please re-post?

Thank You
:)
Crowbar
Posts: 82
Joined: Wed Oct 11, 2006 8:54 pm
Location: Germany

Post by Crowbar »

Hi pawnflakes,

here is the re-post:
Crowbar wrote:Hi,
in TRichView 12.0.3 has been as follows changed:

see info http://www.trichview.com/forums/viewtopic.php?t=3532
TRichView 12.0.3
..
new: global variable ScaleRichViewTextDrawAlwaysUseGlyphs: Boolean = True in RVStyle.pas. If affects text drawing in ScaleRichView. If you have problems drawing content of TSRichViewEdit in a metafile, set this variable to False before making a metafile, and restore after.
Here an example for Delphi:

Code: Select all

...
Var
 Meta : TMetafile;
 savTextDraw : Boolean;

begin
  savTextDraw:=ScaleRichViewTextDrawAlwaysUseGlyphs;
{ new in TRichView 12.0.3 }
  ScaleRichViewTextDrawAlwaysUseGlyphs:=false;  //* <= !!!
  Meta:=TMetafile.Create;
  RechnungSRichViewEdit.DrawMetafile(PageNo,Meta,edtPageNo,true,false);
  ...
  ScaleRichViewTextDrawAlwaysUseGlyphs:=savTextDraw;
end;
I hope it helps you.

Best regards
:wink:
pawnflakes
Posts: 49
Joined: Thu Jan 03, 2008 6:11 pm
Location: South-Africa

Post by pawnflakes »

Thanks for your help Crowbar

I think i'm getting somewhere but it's still not working correctly. The text are rendered the entire page now e.g: a number "2" will show the entire page.

If I apply your suggestion to the PaintMetafile demo in the Basic Demos folder, the results are correct but not with pdf?? I can for the life of me not understand why??

I have tried this from all angles the whole day and I don't know what to do anymore..

Sergey could you please help?
Sergey Tkachenko
Site Admin
Posts: 17522
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I believe a large text size is a problem of eDocEngine PDF generation.
Internally, new version ScaleRichView draws text in a very large size, but it is scaled down using window/viewport commands.
Please contact Gnostice to fix this problem.
pawnflakes
Posts: 49
Joined: Thu Jan 03, 2008 6:11 pm
Location: South-Africa

Post by pawnflakes »

Thank you Sergey

I have contacted Gnostice support and will keep you updated of any new developments..
Post Reply