TSRichViewEdit / TSRVPrint and PrintFrames()

Public forum for discussing TScaleRichView (shareware addon to TRichView providing WYSIWYG editing)
Post Reply
Tavo
Posts: 114
Joined: Sat Sep 24, 2005 9:25 pm
Location: Buenos Aires, Argentina
Contact:

TSRichViewEdit / TSRVPrint and PrintFrames()

Post by Tavo » Thu Jun 09, 2016 8:01 pm

Hi, I am using ScaleRichView and I need to do my own routine for printing only a few pages.
I need to print pages-for example 1,4,13,15,16
I'm storing numbers desired pages in a list.
My code is something like this:

Code: Select all

  SRVPrint := TSRVPrint.Create(nil);
  try

     SRVPrint.SRichViewEdit := Edit;   // Edit is TSRichViewEdit
     SRVPrint.PrintMode := srvpAuto;
     SRVPrint.MetafileCompatibility := MainRVAControlPanel.MetafileCompatibility;

     for Page := 0 to Pages2.Count-1 do
        SRVPrint.PrintFrames(TituFinal, Pages2[Page]) ;

  finally
    SRVPrint.Free;
  end;
It seems to work, however there is something that I think is wrong: In the job list of the printer generates many jobs as pages I need.
I'm sure I'm doing something wrong, but I do not know what.
I hope you understand my bad English :-)
Thanks

Sergey Tkachenko
Site Admin
Posts: 13636
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Fri Jun 10, 2016 5:52 pm

SRVPrint.PrintFrames starts a new printing job.
Use PrintFramesEx instead

Code: Select all

  SRVPrint := TSRVPrint.Create(nil); 
  try 

     SRVPrint.SRichViewEdit := Edit;   // Edit is TSRichViewEdit 
     SRVPrint.PrintMode := srvpAuto; 
     SRVPrint.MetafileCompatibility := MainRVAControlPanel.MetafileCompatibility; 

     Printer.Title := TituFinal;
     Printer.BeginDoc;
     for Page := 0 to Pages2.Count-1 do 
        SRVPrint.PrintFramesEx(Pages2[Page]) ; 
     Printer.EndDoc;

  finally 
    SRVPrint.Free; 
  end;

Tavo
Posts: 114
Joined: Sat Sep 24, 2005 9:25 pm
Location: Buenos Aires, Argentina
Contact:

Post by Tavo » Mon Jun 13, 2016 8:23 pm

Hello Sergey, thank you very much for answering. Now everything are in the same job, but for some reason does not print the first page.

If my list of pages is printed only 1.3 page 3
If my list of pages is printed only 2.4 page 4

Some clue? What am I doing wrong?
Thank you very much

Sergey Tkachenko
Site Admin
Posts: 13636
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko » Mon Jun 13, 2016 8:29 pm

Try

Code: Select all

   SRVPrint := TSRVPrint.Create(nil); 
   try 

      SRVPrint.SRichViewEdit := Edit;   // Edit is TSRichViewEdit 
      SRVPrint.PrintMode := srvpAuto; 
      SRVPrint.MetafileCompatibility := MainRVAControlPanel.MetafileCompatibility; 

      Printer.Title := TituFinal; 
      Printer.BeginDoc; 
      for Page := 0 to Pages2.Count-1 do 
      begin
         [color=red]if Page > 0 then
           Printer.NewPage;[/color]
         SRVPrint.PrintFramesEx(Pages2[Page]) ; 
      end;
      Printer.EndDoc; 

   finally 
     SRVPrint.Free; 
   end;

Tavo
Posts: 114
Joined: Sat Sep 24, 2005 9:25 pm
Location: Buenos Aires, Argentina
Contact:

Post by Tavo » Tue Jun 14, 2016 12:38 pm

Yes! It works perfect!
thanks Sergey

Post Reply