ok , in this case I use 4 TRichView, 1 RVStyle and a RVPrint
Code: Select all
// Dispatch
RVStyle.TextEngine := rvteWindows;
RVPrint.TitlePage := True;
RVPrint.SetHeader(RVHeader.RVData, TRVHFType.rvhftFirstPage);
RVPrint.SetFooter(RVFooter.RVData, TRVHFType.rvhftFirstPage);
RVPrint.SetHeader(RVHeader2.RVData, TRVHFType.rvhftNormal);
RVPrint.SetFooter(RVFooter2.RVData, TRVHFType.rvhftNormal);
RVPrint.AssignSource(RVBody);
// Save PDF
RVPrint.PDF := 'FORMAT';
RVPrint.FormatPages(rvdoALL);
RVPrint.PDF := 'FileName.PDF';
RVPrint.Print('ePrescription', 1, True);
I've set the RVStyle textEngin but it change nothing, I still don't have space between the words and the page numbers are scalled.
Note that I've made a change in your code to support PDF (hence ce RVPRint.PDF property)
when I set this property, my code use SynPDF's VCLCanvas to print the document.
for instance, in TPrintableRVData.InitPrinterCanvas I have this
Code: Select all
{$IFDEF PDF}
if FPdfDocument <> nil then
begin
Canvas := FPdfDocument.VCLCanvas;
ExtraData := nil;
end else
{$ENDIF}
begin
RVPrint := GetRVPrint(Self) as TRVPrint;
...
in GetPageHeight
Code: Select all
{$IFDEF PDF}
if FPdfDocument <> nil then
Exit(FPdfDocument.VCLCanvasSize.Height);
{$ENDIF}
etc...so basically I use your printing logic on SynPDF canvas, I did that on a old version of RichView (before Uniscribe) and ported my modifications to the last version. Except the space bug that I've fixed with MetafileCompatibility everithing works great...until I've tried to add the page number.
as a workaround, I've put a text item that I update myself
for the footer of the first page
Code: Select all
RVFooter.RVData.SetItemText(PageCount1, '1/' + RVPrint.PagesCount.ToString); // PageCount is made public
and on PagePrepaint, for the other pages
Code: Select all
RVFooter2.RVData.SetItemText(PageCount2, PageNo.ToString + '/' + RVPrint.PagesCount.ToString);
I have to check your code for the difference between a simple text item and TCustomRVPageNumberItemInfo...there must be special treatment
BTW: I have to check the "new"
VirtualPrinter property