• Hi,
    I think that I found other bug,
    I'm using supermerge to generate a report and do a simple print (like the demo in wptools source)

    WPSuperMerge.Execute;
    WPReportDest.Print;

    The problem is when I print files with diferent paper sizes, follow the link with examples:

    http://gdicomvix.zapto.org/download/wptools/super01.rtf
    http://gdicomvix.zapto.org/download/wptools/super02.rtf

    I generate a report and print a document with "super01" (bigger paper) and after do the same with "super02", in the last, the paper assume the size of first.

    If I print "super02" first, then works.

    If I do a preview before print (WPPreviewDlg1.Execute), It show me with the correct size in the screen, but when a I send to printer, the paper goes wrong.

    If I call "WPReportDest.PrintDialog" instead "Print" it works, but I need to comment a line in source code (//Paint;) cause this give me a error (Control with no parent...) when executed.

    I'm using Delphi7 + Wptools7

    Sorry by my english,

    regards

    • Offizieller Beitrag
    Zitat

    I generate a report and print a document with "super01" (bigger paper) and after do the same with "super02", in the last, the paper assume the size of first

    Thats by design, no bug. The demo transfers the page size when you start the document. It will not auatomatically create a section which can have a different page size.

    If you need to print multiple documents with different page sizes on one printer cue, you can do this. You need to use BeginPrint / EndPrint then.

  • 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:

    http://gdicomvix.zapto.org/download/wptools/super01.tif (first print)

    http://gdicomvix.zapto.org/download/wptools/super02.tif (second print)

    http://gdicomvix.zapto.org/download/wptoo…r02_correct.tif (correct size print, using printdialog)

    regards

    • Offizieller Beitrag

    Hi,

    *** just a side note: If somebody comes accross this thread because the page size is not loaded when using LoadFromString - please note that the WithClear parameter in Load...() must be set to TRUE to make wptools also load page information. Otherwise the text is inserted at the current positions. ***

    to the subject

    PrintDialog calls
    UpdatePrinterProperties(Printer, 0);

    unless wpDoNotChangePrinterDefaults was used, PrintPages should also calls this method.

    Julian

  • 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

  • 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

    • Offizieller Beitrag

    I found the reson for this problem.

    To fix please open unit wpctrmemo.pas

    and add a
    changed := TRUE;//inserted 21.8.2016

    after the code

    DevMode^.dmFields := DevMode^.dmFields or DM_PAPERSIZE or
    DM_PAPERWIDTH or DM_PAPERLENGTH;

    and also after the code

    DevMode^.dmFields := DevMode^.dmFields or DM_PAPERSIZE or
    DM_PAPERWIDTH or DM_PAPERLENGTH;

    Regards,
    Julian