Scalerichview - export to pdf
Posted: Wed Apr 08, 2015 1:06 pm
Hi,
I exported to pdf file with serious problem
there is a paragraph of duplication (justified) when it involves two pages.
For some reason the first page, it duplicates part of the paragraph invading the footer, and the second page prints the end of the paragraph correctly.
see this file:
http://www.sispaic.com.br/PFNsis/testepdf.pdf
below the code generate with synopse:
procedure ExportaParaPdf ( handle:HWND; srve :TSRichViewEdit; Arquivo:String);
var
i: Integer;
Metafile: TMetafile;
RVUnit: TRVUnits;
R : TRect;
//synopse
PdfDoc : TPDFDocument;
begin
srve.Update; //srve is ScaleRichViewComponent
RVUnit := srve.UnitsProgram; //Get the current value
srve.UnitsProgram := rvuPixels; //Change DBSRichviewEdit to pixels for PDF Conversion
PdfDoc := TPdfDocument.Create;
PdfDoc.GeneratePDF15File:=true;
for i := 1 to srve.PageCount do
begin
Metafile := MakePageMetafile(srve,i, Round(srve.PageWidth100Pix), Round(srve.PageHeight100Pix));
try
PdfDoc.DefaultPageWidth := MulDiv(srve.PageWidth100Pix,72,PdfDoc.ScreenLogPixels);
PdfDoc.DefaultPageHeight := MulDiv(srve.PageHeight100Pix,72,PdfDoc.ScreenLogPixels);
PdfDoc.AddPage;
PdfDoc.Canvas.RenderMetaFile(MetaFile,1,0,0);
finally
Metafile.Free;
end;
end;
PdfDoc.SaveToFile(Arquivo);
PdfDoc.Free;
ShellExecute(Handle, nil, PChar(Arquivo), nil, nil, SW_SHOWNORMAL);
srve.UnitsProgram := RVUnit; //Change back to the previous value before converted to pixels
end;
some reference already solved involving about this occurrence?
Thanks
I exported to pdf file with serious problem
there is a paragraph of duplication (justified) when it involves two pages.
For some reason the first page, it duplicates part of the paragraph invading the footer, and the second page prints the end of the paragraph correctly.
see this file:
http://www.sispaic.com.br/PFNsis/testepdf.pdf
below the code generate with synopse:
procedure ExportaParaPdf ( handle:HWND; srve :TSRichViewEdit; Arquivo:String);
var
i: Integer;
Metafile: TMetafile;
RVUnit: TRVUnits;
R : TRect;
//synopse
PdfDoc : TPDFDocument;
begin
srve.Update; //srve is ScaleRichViewComponent
RVUnit := srve.UnitsProgram; //Get the current value
srve.UnitsProgram := rvuPixels; //Change DBSRichviewEdit to pixels for PDF Conversion
PdfDoc := TPdfDocument.Create;
PdfDoc.GeneratePDF15File:=true;
for i := 1 to srve.PageCount do
begin
Metafile := MakePageMetafile(srve,i, Round(srve.PageWidth100Pix), Round(srve.PageHeight100Pix));
try
PdfDoc.DefaultPageWidth := MulDiv(srve.PageWidth100Pix,72,PdfDoc.ScreenLogPixels);
PdfDoc.DefaultPageHeight := MulDiv(srve.PageHeight100Pix,72,PdfDoc.ScreenLogPixels);
PdfDoc.AddPage;
PdfDoc.Canvas.RenderMetaFile(MetaFile,1,0,0);
finally
Metafile.Free;
end;
end;
PdfDoc.SaveToFile(Arquivo);
PdfDoc.Free;
ShellExecute(Handle, nil, PChar(Arquivo), nil, nil, SW_SHOWNORMAL);
srve.UnitsProgram := RVUnit; //Change back to the previous value before converted to pixels
end;
some reference already solved involving about this occurrence?
Thanks