Beiträge von support

    21.8.2016

    Since a few days this simple code (no wp* unit involved)

    Code
    procedure TForm1.Button1Click(Sender: TObject);
    var s : String;
    begin
      s := TimeToStr(Now);
      Printer.Title := s;
      Printer.BeginDoc;
      Printer.Canvas.TextOut(500,500,s );
      Printer.EndDoc;
    end;

    will only work the first time, fail the second time, and cause the an exception the third time.

    This happens on my system with Adobe Destiller and MS Print to FAX. The Epson printer seems to work fine.

    This was probably introduced by a windows update. It is not a problem specific to WPTools.
    I reproduced the problem with Delphi 7, XE3 and also 10.1.

    Kind Regards,
    Julian

    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

    1) No, you cannot delete a watermark at present.

    2) The latest edition has a possibility to create a non-visual pdfworkbech object which supports most commands.

    This are the functions the DLL exports:

    function pdfWorkbenchCreate( licname, lickey: PWideChar; liccode: Cardinal ) : Pointer; stdcall;
    function pdfWorkbenchFree( workbench : Pointer ) : Integer; stdcall;
    function pdfWorkbenchLoad( workbench : Pointer; Filename : PWideChar; Append, InMemory : Integer ) : Integer; stdcall;
    function pdfWorkbenchCommand( workbench : Pointer; commandid : Integer; intpar : Integer; strpar : PWideChar; ptr : Pointer ) : Integer; stdcall;


    This is how I tested it

    The function pointers wpview_pdfWorkbenchLoad are initialized as usual in wpviewpdf3.pas.

    Regards,
    Julian

    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

    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 strongly recommend to check out the provided source code. Esspeically WPctrMemo.pas

    This is the docu for the beforepaste event:

    This event is executed after text was loaded from the clipboad and before
    it is inserted at the cursor position.
    This event makes it possible to modify the text before it is inserted!
    <br>
    This Example changes the attributes of the inserted text to 'Courier, 10.5, blue':
    <code>
    procedure TForm1.WPRichText1BeforePasteText(Sender: TObject;
    RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;
    Reader: TWPCustomTextReader; OnlyBodyText: Boolean;
    var LoadedText: TWPRTFDataBlock);
    var i : Integer;
    CharAttrIndex : Cardinal;
    begin
    // This is an example to change the format
    // of all inserted text to a given font and size

    // 'AttrHelper' is our working horse to create the attribute
    RTFData.RTFProps.AttrHelper.Clear;
    RTFData.RTFProps.AttrHelper.SetFontName('Courier New');
    RTFData.RTFProps.AttrHelper.SetFontSize(10.5);
    RTFData.RTFProps.AttrHelper.SetColor(clBlue);
    CharAttrIndex := RTFData.RTFProps.AttrHelper.CharAttr;

    // At this point we can calculate another CharAttrIndex

    while par<>nil do
    begin
    for i:=0 to par.CharCount-1 do
    begin
    par.CharAttr[i] := CharAttrIndex;
    end;
    par := par.next;
    end;
    end;
    </code>

    To access the hyperlinks you can read the TextObject[i] and check the objecttype and the property. The hyperlink use tpye = wpobjHyperlnk and the url in is propert Source.

    Hi,

    you need to capture the text before it is pased. There is the event BeforePasteText. You get a paragraph pointer (which can be manipulated) and so you have the possibility to loop through the paragraphs and text to collect the information.

    Julian

    I am not sure if you would get an exception.

    WPTools has the ability to edi multiple text within one editor since the data is seperated from the editor logic. So it is possible to edit an "unlimited" number of texts within one editor without duplication of window handles.

    If there is a resource probelem I don't know what I can do. WPTools does not use many handles.

    Hi,

    is this a resource problem. Do you run out of handles?

    Are there timers involved.

    Is this a threaded application - I mean do the forms run in different tasks (as written in your intro).
    That would not work.

    WPTools is threadsave, but not as editor - editing is always done in main thread.

    Julian

    There is no highlight method, found text can be selected though.

    You can use the Finder with Next() to go through the complete text and set a highlight color using CurrAttr. But this will really apply attributes.

    This can be caused by another 3rdparty component. WPTools is using messages a lot - you see that in unit WPCtrMemo.pas

    If you see the text after reformatall and then not anymore this means the messages are not received anymore.

    You can try to give
    WM_WPTOOLSUPDATE

    a different message number in WPCtrMemo.pas. I hope this helps.

    Julian