Posts by mbertolani

    Hi,

    sometimes, when I load and print a file, the text of header goes to the footer,

    if I do a preview before print, always work,

    I think this is a refresh issue, I'm using Delphi 7 + Wptools 8


    var

    St: TMemoryStream;


    WPRichText1.LoadFromStream(St);

    WPRichText1.Refresh;

    WPRichText1.ReformatAll();

    WPRichText1.Print;

    Sorry, it worked, we solved the problem of paper size,

    but we had a side effect on a third printer (Argox os-214)

    instead of one label, it started printing 6 labels (1 ok and 5 blanks)

    I have identified that the editor only obeys the setting for 2-sided printing if the printer is set to default (windows configuration). Otherwise it prints on two pages, could you check ?

    the problem continues, try verify what the "PrintDialog" do, that "Print" don't do.


    procedure TForm1.lButton2Click(Sender: TObject);
    begin
    WPRichText1.UpdatePrinterProperties(Printer, 0);
    WPRichText1.Print;
    end;



    Regards

    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,




    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

    I'm not printing the documents in a single file,
    I need to send one, and then send other, using "WPRichtext.Print",
    there's a bug in Print method that not update paper definitions,
    if I call PrintDialog instead Print, it works, but I can't show a dialog before print,
    In next links I show the tests results:


    (first print)


    (second print)


    (correct size print, using printdialog)


    regards