Page 1 of 2
Print
Posted: Wed Apr 20, 2011 5:31 pm
by Ceprotec
Hello Sergey!
I'm having problems with the printing of documents.
I need to have the possibility to choose between printing odd or even pages and also the possibility to choose which pages to print. Currently there are: "to" 1 "through" 10 "I need to choose" 1, 2, 5, 6, 8, 9.
This is very important for our company.
Posted: Wed Apr 20, 2011 6:10 pm
by Sergey Tkachenko
Posted: Wed Apr 20, 2011 7:51 pm
by Ceprotec
I needed it to be implemented in the print dialog. For I am not good with codes and functions. Would have to be coupled with the window that exists when run TsrvActionPrint .. Is it possible?
Posted: Thu Apr 21, 2011 4:40 pm
by Sergey Tkachenko
Do you use ScaleRichView (TSRichViewEdit) instead of TRichViewEdit+TRVPrint?
In this case, you should use different method: create TSRVPrint, assign a TSRichViewEdit control to its SRichViewEdit property, srvpAuto to its PrintMode property, and call SRVPrint.PrintFrame(PageNo, 1) to print one page. The rest of code is the same as in the example above.
As for the user interface. RichViewActions, both for TRichViewEdit and TSRichViewEdit, uses the standard printing dialog (TPrintDialog). This dialog does not support a sophisticated definition of the pages to print. And, since this is a standard windows dialog, it cannot be modified.
I am afraid you need to create a new dialog yourself.
Posted: Mon Apr 25, 2011 3:01 pm
by Ceprotec
TPrintDialog The component can be inserted in the project but can not associate it with the SRICHVIEWEDIT. In TPrintDialog there are some options within and have the option of selection. Do you know if this can help?
Posted: Fri Apr 29, 2011 11:54 am
by Ceprotec
Ceprotec wrote:TPrintDialog The component can be inserted in the project but can not associate it with the SRICHVIEWEDIT. In TPrintDialog there are some options within and have the option of selection. Do you know if this can help?
you understood what I need?
Posted: Fri Apr 29, 2011 6:34 pm
by Sergey Tkachenko
TPrintDialog allows choosing the printer, define a range of pages to print (all / from-to / selection), define a number of copies.
Depending on the values chosen in this dialog, TsrvActionPrint calls either SRichView.PrintAll or SRichView.PrintRange as many times as the number of copies specified.
Do you ask about printing a selection?
In TsrvActionPrint, selection printing is not implemented, so it is disabled.
In TrvActionPrint (for TRichViewEdit), it is implemented in the following way: a temporal hidden TRichView is created, the selection is copied to this TRichView, it is printed, then destroyed.
If you need, I can implement it in TsrvActionPrint for TSRichViewEdit in the same way.
But if you want to modify this dialog to allow more complex defining of pages to print, like in your first post, it is not possible. You need to create your dialog instead.
Posted: Mon May 02, 2011 6:40 pm
by Ceprotec
Sergey'm with questions regarding how to print. I currently use the action srvActionPrint1.Execute; to print the pages of SRichViewEdit.
I would like to print the pages without using the srichviewedit this action and use the component TPrintDialogs therefore not how to connect to each other?
Posted: Wed May 04, 2011 6:32 am
by Sergey Tkachenko
If you want to see how to display TPrintDialog and then print SRichViewEdit according to settings made in this dialog, open SRVActions.pas and see the code in TsrvActionPrint.ExecuteTarget.
You can copy the code from this method to your unit.
Posted: Sat May 14, 2011 1:21 pm
by Ceprotec
Sergey procedure is giving this error in the "Printer": Undeclared identifier 'Printer'. You know why?
PrintSomePages procedure (const Title: String;
RVPrint: TRVPrint; const Pages: array of Integer);
var i: Integer;
begin
Printer.Title: = Title;
Printer.BeginDoc;
for i: = Low (Pages) to High (Pages) do begin
if i <> Low (Pages) then
Printer.NewPage;
RVPrint.rv.DrawPage (Pages , Printer.Canvas, False, False)
end;
Printer.EndDoc;
end;
Posted: Sat May 14, 2011 3:27 pm
by Sergey Tkachenko
Add Printers in uses.
Posted: Mon May 16, 2011 4:44 pm
by Ceprotec
Is giving this error when you run the procedure under "RVPrint.rv.DrawPage (Pages , Printer.Canvas, False, False);"this error:
"style of printable TRichView component is not assigned"
I also needed to pick the leaves as well as for printing, choose which printer and size of leaves .. how?
Posted: Tue May 17, 2011 12:53 pm
by Sergey Tkachenko
Before printing, you need to specify what to print and prepare RVPrint for printing. Did you call RVPrint.AssignSource and RVPrint.FormatPages before calling this code?
To specify the printer and its properties, you can create TPrintDialog and call its Execute method.
Posted: Fri Jun 03, 2011 7:49 pm
by Ceprotec
Hey sergey
I used this command to print a check but when he returns to printing, the screen is only a selection that was printed
begin
/ / copying the selection
Stream: = TMemoryStream.Create;
try
Edit.RichViewEdit.SaveRVFToStream (Stream, True);
Stream.Position: = 0;
Edit.LoadRVFFromStream (Stream);
finally
Stream.Free;
end;
/ / printing
Edit.PrintAll;
end;
know why this happens?
Posted: Sat Jun 04, 2011 10:49 am
by Sergey Tkachenko
SaveRVFToStream(... True) copies the selection.
Use SaveRVFToStream(... False) to copy the complete document.