Problem with headers and footers for export to PDF

General TRichView support forum. Please post your questions here
Post Reply
Jmich
Posts: 19
Joined: Mon Apr 30, 2007 10:10 am

Problem with headers and footers for export to PDF

Post by Jmich »

Have a big problem with the Header / Footer.

My print preview is working with three RichViewEdit (rich_header, rich_table and rich_footer) and in the preview of RVPrint1 it works well.

Well, the preview is not only print but also exported.
This edocengine I want to implement.

My Code:

procedure Thaupt_aufmass.PreparePrinting;
begin
if hauptpager.ActivePage = rechnung_daten then
begin
RVPrint1.AssignSource(rich_table2);
end;
if hauptpager.ActivePage = rechnung_rech then
begin
RVPrint1.AssignSource(rich_rech);
end;
if hauptpager.ActivePage = aufmass then
begin
RVPrint1.AssignSource(rich_aufmass);
end;

if not IsEmpty(rich_header) then begin
if StrToIntDef(txtHeader.Text,-1)<0 then
txtHeader.Text := '10';
RVPrint1.SetHeader(rich_header.RVData);
end
else

RVPrint1.SetHeader(nil);
if not IsEmpty(rich_footer) then begin
if StrToIntDef(txtFooter.Text,-1)<0 then
txtFooter.Text := '10';
RVPrint1.SetFooter(rich_footer.RVData)
end
else

RVPrint1.SetFooter(nil);
if hauptpager.ActivePage = aufmass then
begin
RVPrint1.LeftMarginMM := 6;
RVPrint1.RightMarginMM := 6;
RVPrint1.TopMarginMM := StrToIntDef(txtTop.Text,0);
RVPrint1.BottomMarginMM := StrToIntDef(txtBottom.Text,0);
RVPrint1.HeaderYMM := StrToIntDef(txtHeader.Text,-1);
RVPrint1.FooterYMM := StrToIntDef(txtFooter.Text,0);
RVPrint1.FormatPages(rvdoALL);
end
else begin

RVPrint1.LeftMarginMM := StrToIntDef(txtLeft.Text,0);
RVPrint1.RightMarginMM := StrToIntDef(txtRight.Text,0);
RVPrint1.TopMarginMM := StrToIntDef(txtTop.Text,0);
RVPrint1.BottomMarginMM := StrToIntDef(txtBottom.Text,0);
RVPrint1.HeaderYMM := StrToIntDef(txtHeader.Text,-1);
RVPrint1.FooterYMM := StrToIntDef(txtFooter.Text,0);
RVPrint1.FormatPages(rvdoALL);
end;
end;


My Call:

procedure Thaupt_aufmass.Rechnung2Click(Sender: TObject);
begin
hauptpager.ActivePage := rechnung_daten;
rich_header.Update;
rich_table2.Update;
rich_footer.Update;
printer.Orientation := poPortrait;
PreparePrinting;

// Specify output PDF filename
gtPDFEngine1.FileName := 'Output.pdf';

// Export the RVF file to PDF
gtRichViewInterface1.RenderDocument(RVPrint1,false);

end;



Header is very large display, the rest
works.
How should the code be if everything right to be exported?
With the TRVRTFReaderProperties.SetHeader I can not be right.

War may me a right code type?

Perhaps the manufacturers of TRichview soon as a quick and easy solution, users are waiting to turn.

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

Post by Sergey Tkachenko »

I need to study Gnostice code before I can answer to this question.
TRVPrint was designed only for printing, not for drawing on other canvas, so I do not know how they used it for PDF generation...
Post Reply