Delphi 7 + RV12.74 + Unicode
I Refer to the Demo of ' \Demos\ThirdParty\MakePDF\'.
and my code as below
but i find if one table use many pages, and pdf is not correct.
how solve it ? thanks a lot
as code below:
Code: Select all
procedure TProModel.dxBarButton59Click(Sender: TObject);
var i: Integer;
Metafile: TMetafile;
d: Extended;
begin
if not Save1.Execute then
exit;
SRichViewEdit1.Update;
PDFDocument1.FileName := Save1.FileName;
ShowMessage('UnitsPerInchH() = ' + FloatToStr(SRichViewEdit1.UnitsPerInchH(rvuPixels)));
PDFDocument1.Resolution := Round(SRichViewEdit1.UnitsPerInchH(rvuPixels));
d := SRichViewEdit1.UnitsPerInchV(rvuPixels);
//ShowMessage(IntToStr(pdf.Resolution));
PDFDocument1.BeginDoc;
PDFDocument1.Page[0].Size := psA4;
PDFDocument1.Page[0].Orientation := poPagePortrait;
Screen.Cursor := crHourGlass;
try
Application.Hint := 'Formatting...';
for i := 0 to SRichViewEdit1.PageCount-1 do begin
if i>0 then begin
PDFDocument1.NewPage;
PDFDocument1.Page[i].Size := PDFDocument1.Page[0].Size;
PDFDocument1.Page[i].Orientation := PDFDocument1.Page[0].Orientation;
end;
Metafile := MakePageMetafile(i+1, PDFDocument1.Page[i].Width,
PDFDocument1.Page[i].Height);
Metafile.SaveToFile(gExePath + 'JPG\' + IntToStr(i + 1) + '.jpg');
Metafile.SaveToFile(gExePath + 'JPG\' + IntToStr(i + 1) + '.emf');
{ [color=red]if has a table ,and this table use many pages and pdf is not correct, But Priview the .emf file is correct why?[/color]}
PDFDocument1.CurrentPage.PlayMetaFile(Metafile);
PDFDocument1.Page[i].Comment(IntToStr(i) + 'TestCommect');
Metafile.Free;
Application.Hint := Format('Collecting PDF pages (%d of %d)... ', [i+1, SRichViewEdit1.PageCount]);
Application.ProcessMessages;
end;
Application.Hint := 'Writing PDF file...';
PDFDocument1.EndDoc;
finally
Screen.Cursor := crDefault;
Application.Hint := '';
end;
end;