The theory is simple, but I'll prove that have a bug in Print method (and maybe very old) when working with documents with diferent paper sizes
I'm send my code below, use the files in the link to test,
[](http://gdicomvix.zapto.org/download/wptools/super01.rtf)
[](http://gdicomvix.zapto.org/download/wptools/super02.rtf)
if you open and print the super02.rtf only, it works !! Paper in printer with same size of original document.
if you open and print the super01.rtf first, and after, open and print super02.rtf , it not works.
regards
-------------PAS
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, WPRTEDefs, WPCTRMemo, WPCTRRich, StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
ToolPanel1: TPanel;
Button1: TButton;
lButton2: TButton;
WPRichText1: TWPRichText;
procedure Button1Click(Sender: TObject);
procedure lButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var Od: TOpenDialog;
begin
Od := TOpenDialog.Create(nil);
if Od.Execute then
WPRichText1.LoadFromFile(Od.FileName, True);
Od.Free;
end;
procedure TForm1.lButton2Click(Sender: TObject);
begin
WPRichText1.Print;
end;
end.
-----------------DFM
object Form1: TForm1
Left = 476
Top = 125
Width = 882
Height = 655
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object ToolPanel1: TPanel
Left = 0
Top = 584
Width = 866
Height = 32
Align = alBottom
BevelInner = bvLowered
BevelOuter = bvSpace
TabOrder = 0
object Button1: TButton
Left = 7
Top = 6
Width = 61
Height = 20
Caption = 'Open'
TabOrder = 0
OnClick = Button1Click
end
object lButton2: TButton
Left = 72
Top = 6
Width = 61
Height = 20
Caption = 'Print'
TabOrder = 1
OnClick = lButton2Click
end
end
object WPRichText1: TWPRichText
Left = 0
Top = 0
Width = 866
Height = 584
RTFVariables = <>
ProtectedProp = []
InsertPointAttr.TextColor = clRed
InsertPointAttr.UseTextColor = True
HyperlinkTextAttr.Underline = tsTRUE
HyperlinkTextAttr.UnderlineColor = clBlue
HyperlinkTextAttr.UseUnderlineColor = True
HyperlinkTextAttr.HotUnderlineColor = clRed
HyperlinkTextAttr.HotTextColor = clRed
HyperlinkTextAttr.HotUnderline = tsTRUE
HyperlinkTextAttr.HotStyleIsActive = True
HiddenTextAttr.Hidden = True
Align = alClient
TabOrder = 1
end
end