WPTools 4 vs WPTools 5

  • Another set of richtext that looks different between WPTools 4 and 5. This one seems to be on when the page breaks occur. Notice on the first page that the pagebreak occurs before the Sincerely, but in WPTools 5, both the {M018} and {M019} get on the page. Also, on page 3, following the forced page break on page 2, the page break for WPTools 4 occurs before the How can you elect continuation coverage? section while in 5 it is after.

    Thoughts?

    • Offizieller Beitrag

    Hello,

    differences in page break were already possible when using just wptools 4 and install it on different computers with different printers attached or, while switch the printers. WPTools 4 always used the printer as reference and so was affected by the font handling of the printer driver.

    WPTools 5 is not affected by the printer unless you explicitely activate this (see WYSIWYG in the manual) and will NOT change the page breaks when switching printers. But it is still influenced by the way windows calculates the font height. Internally it has a more advanced method to measure the characters: it uses the same resolution for measuring, paint, and print. But since that code is different it can calculate different font heights and so page breaks can also change.

    On my screen with wptools 5, I see the text after "Sincerely," on page 2.

    This flags in format options influence the measuring:

    FormatOptions:
    wpUseAbsoluteFontHeight
    wpNoMinimumCellPadding

    FormatOptionsEx:
    wpDontAddExternalFontLeading
    wpDontIgnoreSpacebeforeOnTopOfPage

    Kind Regards,

    Julian Ziersch

  • With this in mind, then shouldnt the same richtext on the same machine show the same results between 4 and 5? I posted the richtext below last week for a tab formatting issue, but it shows a similar problem where the line height seems to be different. The richtext was printed on the same machine, to the same printer with the only difference between the two being one was loaded in WPTools 4 and the other was loaded in WPTools 5. However, the bottom line in WPTools 5 is a least 1/2 inch off from the one in WPTools 5. Since our clients use these templates for cutting checks, this 1/2 inch difference causes the templates to no longer have correct positioning. I just need the positioning to be consistent with what it was in WPTools 4. Based on your options listed above, what do i need to have set to mimic the WPTools 4 positioning?

    {\rtf1\ansi\deff0\deftab720{\fonttbl{\f0\swiss\fcharset0 Arial;}{\f1\fnil\fcharset0 Times New Roman;}{\f2\fnil\fcharset2 WingDings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wptoolsver4\wpprheadfoot0\paperw12240\paperh15840\margl360\margr1886\margt1440\margb1440\headery720\footery720{\*\listtable{\list\listtemplateid19690212{\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc1{\leveltext\'02\'00.;}{\levelnumbers\'01;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc3{\leveltext\'02\'01.;}{\levelnumbers\'01;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc0{\leveltext\'02\'02.;}{\levelnumbers\'01;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc4{\leveltext\'02\'03);}{\levelnumbers\'01;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc0{\leveltext\'03(\'04);}{\levelnumbers\'02;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc4{\leveltext\'03(\'05);}{\levelnumbers\'02;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc2{\leveltext\'03(\'06);}{\levelnumbers\'02;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc4{\leveltext\'03(\'07);}{\levelnumbers\'02;}}
    {\listlevel\leveljc0\levelfollow0\levelstartat1\levelspace0\levelindent720\levelnfc0{\leveltext\'03(\'08);}{\levelnumbers\'02;}}
    \listid1194737}}{\*\listoverridetable{\listoverride\listid1194737\listoverridecount0\ls1}}\endnhere\sectdefaultcl{\pard{\tx4860 \qc\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \{M001\}\par
    \qc\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \{M002\}\par
    }{\tx180\tx6480 \qj\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab Name: \{M053\}\par
    }{\tx180\tx6210 \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab SSN: \{M020\}\tab \tab Location: \{M046\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab Branch: \{M045\}\tab \tab Department: \{M047\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    }{\tx180\tx1170\tx3870\tx5220\tx2610 \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab Date\tab Number\tab Amount Paid\tab Amount\tab Description\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \{E101\}\tab \{E201\}\tab \{E501\}\tab \{E601\}\tab \{E401\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \tab \tab \{E701\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \{E102\}\tab \{E202\}\tab \{E502\}\tab \{E602\}\tab \{E402\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \tab \tab \{E702\}\tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \{E103\}\tab \{E203\}\tab \{E503\}\tab \{E603\}\tab \{E403\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \tab \tab \{E703\}\tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \{E104\}\tab \{E204\}\tab \{E504\}\tab \{E604\}\tab \{E404\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \tab \tab \{E704\}\tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \{E105\}\tab \{E205\}\tab \{E505\}\tab \{E605\}\tab \{E405\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \tab \tab \{E705\}\tab \tab \tab \tab \tab \tab \tab \tab \tab \tab \par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    }\ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 Account Balance; Medical Expense: \{M084\}\tab \tab Dependent Care: \{M072\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    {\tx5760 \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \{M009\}\par
    }{\tx8640 \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \par
    }\ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \par
    {\tx5760\tx1440 \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \tab \{M053\}\tab \{M100\}\tab \par
    }\ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 \{M101\}\par
    \ql\li0\fi0\ri0\sb0\sl1000\sa0 \plain\f1\fs20\cf0 }
    }


    Thanks again,

  • OK, i put together two sample projects. You can download the projects, the richtext I am using, and the pdfs I printed out from the following link:


    The wp4 project was written in Delphi 4 using WPTools 4. I then converted the project to Delphi 7 using WPTools 5 and named it wp5. The two printouts (wp4.pdf and wp5.pdf) to the same printer on the same machine and you can see that the page breaks are in different places. Please let me know if you need anymore info from on this.[/url]

    • Offizieller Beitrag

    Hi,

    I still dont agree that a complete different formatting routine should get the same font width and height. WPTools 4 used the printer for format the text (when property WYSIWYG = true) but then converted the result into screen units. This handling was not entirely correct and required some adjustments later when doing the printing to get propper results. Version 5 does not need this kind of tricks.

    However

    I see you use WYSIWYG = true so you need to use
    WPRichText1.RTFData.UpdateReformatMode(true,false);
    in the version 5 project to get comparable reference DCs.

    When I load your text here in a V4 and a V5 demo I get almost the same page and line breaks.

    If you want to enlarge the font a little you can open the unit WPRTEPaint.pas, locate

    {$IFDEF WPCOMPRESSTEXT}
    aCanvas.Font.Height := Trunc(h);
    {$ELSE}
    aCanvas.Font.Height := Round(h);
    {$ENDIF}

    and change it to

    {$IFDEF WPCOMPRESSTEXT}
    aCanvas.Font.Height := Trunc(h);
    {$ELSE}
    aCanvas.Font.Height := Round(h-2);
    {$ENDIF}

    Such a change would compensate that the rounding error which was in V4 does not exist anymore in V5.

    An alternative is to give your customers access to the "Resizing" property. So the fonts can be slightly adjusted, say 105%, to get similar page breaks.

    Regards,

    Julian Ziersch