# Printing partially working

**URL:** <https://forum.kirupa.com/t/printing-partially-working/256021>\
**Category:** flash\
**Created:** [March 29, 2008, 1:52pm UTC](https://forum.kirupa.com/t/printing-partially-working/256021 "2008-03-29T13:52:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Germaris](https://avatars.discourse-cdn.com/v4/letter/g/8797f3/32.png) [@Germaris](https://forum.kirupa.com/u/Germaris)\
**Post date:** [March 29, 2008, 1:52pm UTC](https://forum.kirupa.com/t/printing-partially-working/256021/1 "2008-03-29T13:52:15Z")

</div>

Hi there!

I implemented a printing function which is working nice even for multiple pages.

Problem is as follows…  
Say we have a text 100 lines long.  
Each page can hold 80 lines.  
We should have:  
Page 1 = from line 1 to line 80  
Page 2 = from line 81 to line 100

Instead, I get:  
Page 1 = from line 1 to line 80  
Page 2 = from line 20 to line 100 !!!  
i.e. lines 20 to 80 are printed twice!

I think problem is in maxScroll but can’t find the mistake…  
Could you help me find it?

Many thanks in advance.

Best regards,  
Gerry

```auto
import mx.controls.TextArea;
var printStyles = new TextField.StyleSheet();
printStyles.setStyle("html", {fontFamily:"verdana,sans-serif", fontSize:"12", color:"#336699"});
printing = function () {
	myPrintStr = _root.printFld.htmlText;
	this.createEmptyMovieClip("mc2", this.getNextHighestDepth());
	mc2.createClassObject(TextArea, "text2", mc2.getNextHighestDepth());
	mc2._x = 910;
	mc2.text2.move(1000, 0);
	mc2.text2.setSize(525, 700);
	mc2.text2.html = true;
	mc2.text2.wordWrap = true;
	mc2.text2.styleSheet = printStyles;
	mc2.text2.antiAliasType = "advanced";
	mc2.text2.text = myPrintStr;
	PrintText(mc2.text2);
};
function PrintText(theTextarea:Object) {
	theTextarea.depthChild0._alpha = 0;
	var visibleRows:Number = theTextarea.viewableRows;
	var maxScroll:Number = theTextarea.maxVPosition + visibleRows;
	theTextarea.vSB.visible = false;
	var the_pj:PrintJob = new PrintJob();
	if (the_pj.start()) {
		var counter:Number = 0;
		if (!isNaN(maxScroll)) {
			while (counter < maxScroll) {
				theTextarea.vPosition = counter;
				counter += visibleRows;
				the_pj.addPage(theTextarea, {xMin:-25, xMax:600, yMin:-30, yMax:800}, {printAsBitmap:false});
			}
		}
		else {
			the_pj.addPage(theTextarea, {xMin:-25, xMax:600, yMin:-30, yMax:800}, {printAsBitmap:false});
		}
		the_pj.send();
		delete the_pj;
	}
	theTextarea.vSB.visible = true;
}

```
