trichview.com

trichview.support




Re: RichAction and TPDFDocument componant


Return to index


Author

Message

Mike Anderson

Posted: 02/18/2005 23:20:31


Thanks Sergey for reply,


The easy way to explain; add two component to RichAction demo.


pdf: TPDFDocument; // i have registered version, I think you too, if not

please use demo version

rvrh:TRVReportHelper ;


Here is the code


procedure TForm3.Button5Click(Sender: TObject);

var

i:smallint;

pt: TPoint;

begin


  RichViewEdit1.SaveRTF('C:\test.rtf',False);

  RichViewEdit1.Modified:=False;


  rvrh.RichView.Style := RVStyle1;

  rvrh.RichView.RTFReadProperties.ParaStyleMode := rvrsAddIfNeeded;

  rvrh.RichView.RTFReadProperties.TextStyleMode := rvrsAddIfNeeded;

  rvrh.RichView.RTFReadProperties.UnicodeMode := rvruMixed;


  rvrh.RichView.Clear;

  rvrh.RichView.DeleteUnusedStyles(True,True,True);



  rvrh.RichView.LoadRTF('C:\test.rtf'); // not working no page loaded

  showmessage(inttostr(rvrh.PagesCount));


// Also you can ignore lines bellow, just above line..


if  rvrh.Ready then

begin

  Screen.Cursor := crHourGlass;


  pdf.Resolution := Screen.PixelsPerInch;

  pdf.FileName := 'c:\test1.pdf';

  pdf.BeginDoc;

  pdf.Page[0].Size := GetPageSize;

  pdf.Page[0].Orientation := GetPageOrientation;



  try

    rvrh.Init(pdf.Canvas, 641); // here is the error because no page loaded

in rvrh -


    while rvrh.FormatNextPage(971) do;

    for i := 0 to rvrh.PagesCount-1 do begin

      if i>0 then begin

        pdf.NewPage;

        pdf.Page[i].Size        := pdf.Page[0].Size;

        pdf.Page[i].Orientation := pdf.Page[0].Orientation;

      end;

      SetViewportOrgEx(pdf.Canvas.Handle, 5, 5, @pt);

      rvrh.DrawPage(i+1, pdf.Canvas, False, 971);

      SetViewportOrgEx(pdf.Canvas.Handle, pt.x, pt.y, nil);

    end;

    pdf.EndDoc;

  finally


  end;


  end;



end;


Thnaks






"Sergey Tkachenko" <svt@trichview.com> wrote in message

news:42164156$1@support.torry.net...

> Not enough information.

> Did you copy document to rvrh correctly?

> Did you initialize pdf? (called pdf.BeginDoc)

>

>

>> Hello,

>>

>> I have TPDFDocument from http://www.llion.net/ I would like to use

>> TPDFDocument  with RichAction

>> I mean, use RichAction and create PDF from same program. but I'm getting

>> error

>> List Index out of bound (0) on line

>> rvrh.Init(pdf.Canvas, DocWidth);

>>

>> {

>> rvrh: TRVReportHelper;

>> rvrh using same TRVStyle with in RichView form.

>> }

>>

>> any idea ?

>>

>> Thanks

>>

>>

>>

>>

>

>





Powered by ABC Amber Outlook Express Converter