printing second page has just one line

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

printing second page has just one line

Postby robertalvarez » Mon Dec 21, 2015 10:03 pm

trying out the community vpe, I use powerbasic with windows 7 pro.

problem : when I use a different print dll (which is no longer supported) I would output a file line by line and then that dll would read the file to a preview dialog.

now with vpe the first page prints 52 lines and all the other pages from page two prints only one line per page on a loop of 130 lines. tried the height and autobreak, no change.

*************************************************************************************************************** PB code
CALLBACK FUNCTION PRTTEST()
LOCAL Result2, hWndParent, hDoc, I AS LONG, X, X2 AS SINGLE
DIM txtout1 AS STRINGZ * 40

hDoc = VpeOpenDoc(hWndParent, "Test", 0)
VpeSetUnitTransformation(hDoc, %VUNIT_FACTOR_INCH) ' // inch
VpeSetRulersMeasure(hDoc, %INCH)

txtout1 ="hello 1": X=.5: X2 =1.5
VpeWrite(hDoc, .5, X, 6, X2, txtout1)

' VpeSetPageHeight(hDoc,5)
' VpeSetAutoBreak( hDoc, %AUTO_BREAK_ON )

FOR I=2 TO 130
txtout1="hello "+STR$(I)
X = X+.2: X2=X2+.2

VpeWrite(hDoc, .5, X, 6, X2, txtout1)
NEXT

VpePreviewDoc(hDoc, BYVAL 0, %VPE_SHOW_NORMAL)
END FUNCTION

CALLBACK FUNCTION ENDPROG()
DIALOG END CBHNDL, 1
END FUNCTION
***************************************************************************************************** pb code
robertalvarez
 
Posts: 3
Joined: Thu Dec 17, 2015 4:35 am

Re: printing second page has just one line

Postby IDEAL Software Support » Tue Dec 22, 2015 3:07 am

x and x2 grow without limit and exceed page boundaries, which causes an auto page break for each line.
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: printing second page has just one line

Postby robertalvarez » Sun Dec 27, 2015 6:26 pm

I see the problem in my code. going this way with text and images is a bit complex.

can not the auto page break be disabled and simply insert CHR$(27,12) code to do page break in vpe where I would need it?

this is what I do using my current PRINTDLL (no longer supported)
robertalvarez
 
Posts: 3
Joined: Thu Dec 17, 2015 4:35 am

Re: printing second page has just one line

Postby IDEAL Software Support » Mon Dec 28, 2015 11:03 am

VPE is not a line-printer emulation. It allows to create complex layouts of text and other objects.

The auto page break feature is intended to break long text strings automatically to the next page(s).

To emulate a line printer, i.e. when outputting line by line, handle the page break yourself.

The code is trivial (note that you interchanged x and y):

Code: Select all
Y = .5

rem Get height of a single text line for the currently selected font
VpeRenderPrint(hDoc, 1, 1, "X")
line_height = VpeGet(hDoc, VRENDERHEIGHT)

FOR I=2 TO 130
    txtout1 = "hello " + STR$(I)
    Y2 = Y + line_height
    VpeWrite(hDoc, .5, Y, 6, Y2, txtout1)
    Y = Y2

    rem test for page break
    IF Y + Y2 >= VpeGet(hDoc, VBOTTOMMARGIN)
        VpePageBreak(hDoc)
        Y = .5
    ENDIF
NEXT
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm

Re: printing second page has just one line

Postby robertalvarez » Wed Dec 30, 2015 10:18 pm

looking at the community VPE DLL Reference can not find VRENDERHEIGHT and VBOTTOMMARGIN
so getting zero for values
robertalvarez
 
Posts: 3
Joined: Thu Dec 17, 2015 4:35 am

Re: printing second page has just one line

Postby IDEAL Software Support » Sat Jan 02, 2016 1:42 pm

They are defined for PowerBasic in the file vpe_symbols.inc in the folder "PowerBasic".
IDEAL Software Support
 
Posts: 1633
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 21 guests

cron