SrichViewEdit Use llPDFLib make pdf problem

General TRichView support forum. Please post your questions here
Post Reply
iambeijing086
Posts: 22
Joined: Mon Dec 02, 2013 1:41 am

SrichViewEdit Use llPDFLib make pdf problem

Post by iambeijing086 »

environment: windows xp sp3(Language = simple chinese )
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;
i wait your answer online ,thanks a lot
iambeijing086
Posts: 22
Joined: Mon Dec 02, 2013 1:41 am

Post by iambeijing086 »

PDF PDF Incorrect why ? i don't understand ,where question?
i am so anxious¡£ :cry:
iambeijing086
Posts: 22
Joined: Mon Dec 02, 2013 1:41 am

Post by iambeijing086 »

admin help me!!!
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I assume you use ScaleRichView.
Unfortunately, LLPDFLib has a bug in clipping ScaleRichView content. You can see yourself - a metafile is correct, but the resulting PDF is wrong.
LLPDFLib developer knows about this problem for many year, but I am afraid he does not want to fix it.

I suggest to try a new version of ScaleRichView. It optimizes table output, so, very possible, a correct clipping is not so critical now.

However, probably the best solution is switching to wPDF or eDocEngine.
iambeijing086
Posts: 22
Joined: Mon Dec 02, 2013 1:41 am

my question has solved

Post by iambeijing086 »

my question has solved , i can make pdf file use eDocEngine

step below:
first, make bmp file by SrichViewEdit
second ,make Pdf File use eDocEngine. It's ok,
not exist the question about one table in many pages
Sergey Tkachenko
Site Admin
Posts: 17569
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Bmp is not a good solution - the resulting file will be large and printed with a low quality.

eDocEngine must support ScaleRichView natively.
Post Reply