Beiträge von support

    Thanks for this hint - no the DC was forgotten. The code should read like:

    Code
    public bool PrintTo(uint PageNO, Graphics Canvas, uint ResX, uint ResY)		{			bool res;			IntPtr DC = Canvas.GetHdc();			Command(commands.COMPDF_PrintHDCSetXRes, ResX);			Command(commands.COMPDF_PrintHDCSetYRes, ResY);			Command(commands.COMPDF_PrintHDCSetHDC, DC.ToInt32());			res = (Command(commands.COMPDF_PrintHDC, PageNO) >= 0);			Canvas.ReleaseHdc(DC);			GC.KeepAlive(Canvas);			return res;		}

    Please also update:

    Wrap arround is not possible, but you can change the WordWrapMode for objects which are connected to a paragraph to allow left or right wrapping.

    WPRichText1.TextObjects.ChangePositionMode( CurrentPTextObj, wpotPar, wpwrAutomatic);

    is an object reference, for example the one provided to the TextObject events.

    If you insert a new object you can se the properties
    WPRichText1.TextObjects.DefaultPositionMode
    WPRichText1.TextObjects.DefaultWrapMode

    For a quick replacement of all fonts in the text with one use this loop:

    Delphi:
    for i:=0 to FONTMAXANZ do
    WPRichText1.Header.FontName[i] := 'Courier Dark';
    WPRichText1.ReformatAll;

    C++Builder:
    for(int i=0; i<=FONTMAXANZ; i++)
    WPRichText1->Header->FontName[i] = "Courier Dark";
    WPRichText1->ReformatAll();

    The code with HideInsertpoints is not required. Simply switch on 'Hidden' in the property InsertpointTextAttr.

    I hope this helps,

    Julian Ziersch

    a) and c) are connected. In unit WPWrite2 (line 463..) you will find the code which converts the fields into text:
    p := FMemo.TxtObjLst.Data[save_pa^.tag]; // V4.x
    if (p <> nil) and (p^.obj <> nil) and (p^.obj is TWPObjectField) then
    ...

    Here it is possible to add special code to handle fields which are not always known at export time, most important PAGE and NUMPAGES:

    b) I assume each record means 'each page'? The #10#13 codes are written in procedure WriteParagraphEnd and it apperas to be to be the correct way in ANSI mode.

    (Note: I combined your two posts since they were related)

    Julian Ziersch

    >>1) speed: sometimes the characters appear as fast as I type them, and other times the display of characters is considerably behind my typing. I do not know what kind of processing is required in the background, and I wish I could provide more information as to when it occurs. Do you have any ideas? <<

    RightToLeft writing should not reduce the speed characters are inserted since in memory they of course are inserted left-to-right so the same code is running. If there is a dealy maybe you have a running process on your system consuming a lot of CPU? I had that in the past quite often.

    >>2) backspace key: the backspace key does nothing in right-to-left mode. It should delete the last character typed. <<

    In V4.20 it should work alright - I just tested it.

    >> 3) disappearing characters on right: text is normally right justified. When you type a space, the entire line moves to the right, hiding part of the first character on the line (the character on the right). As you type more spaces, more characters on the right are hidden. As soon as you type a non-space character, the line moves to the left and all characters come into view. This also occurs during word-wrapping if a space is the last character in the line of a paragraph. <<

    I can see that.

    >> 4) what is the difference between the wpRightToLeft and wpAutoRightToLeft settings? My thought was that wpRightToLeft forced the mode all of the time and the wpAutoRightToLeft setting used the current Windows language mode. Is this correct?<<

    The language mode is not used, the font is used. So if you are using arabic or hebrewic fonts it switches to RTL otherwise use LTR. This is the mode which works most like Word.

    Julian Ziersch

    With the licensed version of WPViewPDF do this:


    In this code we first retrieve a metafile from the PDF viewer and then render that metafile on a bitmap. This bitmap can then be assigned to a TJPEGImage and finally to a TImage.Picture.

    The complete project is available here:
    https://www.wpcubed.com/ftp/ex/WPViewPDF_BMP.zip

    WPForm uses cm or inch natively. When you change the property FD.Units this affects the way the objects are handled. This system avoids possible rounding errors.

    The values displayed are the RulerUnits which can be either of both and don't affect the handling.

    I think if I sent Units to wpfInch it will work fine.

    Julian