You are not logged in.
Pages: 1
Hi,
I have used that code below in previous version, but after last update (1.18) when i have the image, after show that the after text do not show
-----image---------- show
text --------- not show
text --------- not show
procedure ExportaParaPdf ( handle:HWND; srve :TSRichViewEdit; Arquivo:String);
var
LDocument: TPdfDocumentGDI;
i: Integer;
LPage: TPdfPage;
LCanvas: TCanvas;
LPageSize: TSize;
LTextRect: TRect;
RVUnit: TRVUnits;
function CalcTextRect(const ADocument: TPdfDocumentGDI; const AText: TSRichViewEdit): TRect;
var
LMultiPixels: Extended;
begin
LMultiPixels := 1.0;
Result.Left := Round(AText.LeftMargin100Pix * LMultiPixels);
Result.Top := Round(AText.TopMargin100Pix * LMultiPixels);
Result.Right := Round((AText.PageWidth100Pix ) * LMultiPixels);
Result.Bottom := Round((AText.PageHeight100Pix ) * LMultiPixels);
end;
begin
srve.Update; //srve is ScaleRichViewComponent
RVUnit := srve.UnitsProgram; //Get the current value
srve.UnitsProgram := rvuPixels; //Change DBSRichviewEdit to pixels for PDF Conversion
LDocument := TPdfDocumentGDI.Create(False, 0, True, nil); //With PDF/A//
try
LDocument.DefaultPaperSize := psA4;
// LDocument.ScreenLogPixels := 300; -> here work in previous version but not in 1.18
LDocument.EmbeddedTTF := True;
LDocument.EmbeddedWholeTTF := True;
if srve.PageProperty.Orientation=poPortrait then
LDocument.DefaultPageLandscape:=false
else
LDocument.DefaultPageLandscape:=true;
for i := 1 to srve.PageCount do
begin
LPage := LDocument.AddPage();
LCanvas := LDocument.VCLCanvas;
LPageSize := LDocument.VCLCanvasSize;
LTextRect := CalcTextRect(LDocument, srve);
srve.DrawPageEx(i, LPageSize.cx, LPageSize.cy,
0, 0, LCanvas, LTextRect, True, False, False);
end;
LDocument.SaveToFile(Arquivo);
finally
LDocument.Free();
end;
ShellExecute(Handle, nil, PChar(Arquivo), nil, nil, SW_SHOWNORMAL);
srve.UnitsProgram := RVUnit; //Change back to the previous value before converted to pixels
end;
thanks
Beto
Offline
Pages: 1