DB ScalerichviewEdit: problems to export PDF in new version
Posted: Sat Jan 30, 2010 1:31 pm
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
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