Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

At 27 NOV 2001 06:15:49AM Kendal Hulbert wrote:

I have had the OIPI module installed and am in the process of updating our print routines to make use of the various functions now available. What I have not been able to get to grips with is the line count function. Ie. The old print module had 'PrintPageStatus' where the number of lines left on a page could be checked and a decision made whether to print another line or advance a page and carry on.

What is the equivalent in OIPI. I am probably missing something particularly obvious, but I am under some pressure here and would like to take the shortest easiest route possible to the solution…

Kendal


At 27 NOV 2001 07:58AM Oystein Reigem wrote:

Kendal,

Use POS and various CALC… messages.

E.g, say you want to print some text value with the TEXT message. Then

- first get the current position with a Get_Printer POS call

- then look at the Y value of the current position

- then use Set_Printer CALCTEXT and Get_Printer CALCTEXT calls to find out the height of the new text

- then add that height to the current Y position to check if there's room for the new text

- Oystein -


At 04 DEC 2001 01:26AM Kendal Hulbert wrote:

I can't beieve this is the only way to check the linecount on a page. The original print module has a very efficient line counting function but the newer, better printing module requires calculations and measurements etc, sounds like a step backward doesn't it?


At 04 DEC 2001 02:56AM Donald Bakke wrote:

Kendal,

It is important to first understand that the OIPI is not "new" at all. It was originally developed several years ago (I believe even before Revelatin Printer.DLL functions) by Tony Splaver as a much needed solution to the all but absent printing features in OpenInsight.

Line counters and such are nice, but I would easily sacrifice them for the multitude of benefits and features that the OIPI provides. I am also thankful that Revelation has worked out a deal where they now own the OIPI and are in a position to help it become even better and more integrated with OpenInsight.

You could easily write a generic routine to do the work that Oystein was outlining for you. That way this can be re-used with all your forms and reports and it will also have the benefit of being a single-line statement in your OIPI code which is almost what you would get using a line counter.

dbakke@srpcs.com

SRP Computer Solutions, Inc.


At 04 DEC 2001 03:30AM Oystein Reigem wrote:

Kendal,

If you print all your lines with the same font and size you can certainly control page breaks by using just TEXT and PAGEBREAK messages and counting lines. Actually, in my current use of OIPI that is what I do. But TEXT will wrap long lines, so you must take measures not to lose your count. I use a monospace font - New Courier - and count characters and do my own wrapping.

- Oystein -


At 04 DEC 2001 11:16AM Tony Splaver wrote:

Hi Kendal,

Your assessment of the "line count" issue is correct – it is more difficult. I have attached a simple example that should give you the equivalent functionality (as Oystein described), but it will only work for simple reports. The OIPI gives you complete freedom to print anything. If you are using the TEXTXY or have an image printing at the bottom of each page or are using RTF and FONTs, then this function may not work perfectly.

Tony Splaver

Function OIPI_LineCount()

Declare Function Set_Printer, Get_Printer

* returns the number of line remaining on the current page.

*debug

LinesRemaining=0

* get height of the "W" character

stat=Set_Printer("CALCTEXT", "W")

If stat

* get y position

Pos=Get_Printer("POS")

YPos=Pos

* get page height

PageSize=Get_Printer("PAGESIZE")

PageHeight=PageSize

* get bottom margin

Margins=Get_Printer("MARGIN")

TopMargin=Margins

BottomMargin=Margins

* calculate the amount of space left on the current page

SpaceLeft=PageHeight - YPos - TopMargin - BottomMargin

* calculate the number of lines remaining

LinesRemaining=Int(SpaceLeft / CurrentFontHeight)

Return LinesRemaining


At 10 DEC 2001 05:15AM Kendal Hulbert wrote:

Thank you Tony and Oystein for your kind assistance, and Tony, your code put me on the right track. Having looked at the code you kindly put up for me I was able to create a generic linecount function for the system I am working on and it works a treat.

Now that I have come to grips with this OIPI, things are looking ggod for other printing development that has been in the wings for a while,

Once again, thanks

Kendal

View this thread on the forum...

  • third_party_content/community/commentary/forums_nonworks/eb12925e6761fb6885256b11003ddfa9.txt
  • Last modified: 2023/12/28 07:40
  • by 127.0.0.1