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
			
			
									
						
										
						DB ScalerichviewEdit: problems to export PDF in new version
- 
				pawnflakes
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
- 
				pawnflakes
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
- 
				pawnflakes
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
Hi pawnflakes,
here is the re-post:
			
			
									
						
										
						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=3532Here an example for Delphi: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.I hope it helps you.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;
Best regards

- 
				pawnflakes
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
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?
			
			
									
						
										
						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: 17952
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
- 
				pawnflakes
- Posts: 49
- Joined: Thu Jan 03, 2008 6:11 pm
- Location: South-Africa
