Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-09-2004, 03:05 PM
Senior Member
 
Join Date: Feb 2003
Posts: 212
Default Autoflow text to Printer Object

I've managed to print and printpreview some text and images.
But there's something not quit working when I'm printing a large text variable.
When I reach the end of the page, the rest of the variable should be printed on the next page. But it doesn't.

How can I make this work?

Must I divide the var into two seperate vars?
How do I know where to split the var?
Or is there a function I can call to do this automaticly?
Reply With Quote
  #2 (permalink)  
Old 07-12-2004, 03:35 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Autoflow text to Printer Object

The current version has no such functions. We will provide the feature in SWFKit Pro 2.2. You have to split the var into two seperate parts in version 2.1.
Reply With Quote
  #3 (permalink)  
Old 10-23-2004, 11:08 AM
Member
 
Join Date: Oct 2004
Posts: 53
Default Re:Autoflow text to Printer Object

me too facing the same prom?
pl provide an example how to accomplish this.
Reply With Quote
  #4 (permalink)  
Old 10-26-2004, 12:27 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Autoflow text to Printer Object

The developing edition of SWFKit at http://www.swfkit.com/download/swfkit.exe has the following two methods

1. getWrappedTextExtent(text, columnWidth[, tabstop[, wordwrap]])
Get the text extent that will be drawn in a column. The tabstop and wordwrap are two optional parameters. The tabstop parameter specifies the tab stop position, the default value is -1. The default value of wordwrap paramter is true.


2. printText2(text, left, top, width, height[, tabstop[, wordwrap]]
Print text in a rectangle. The default value of tabstop is -1, the default value of wordwrap is true.

If the text is too long to draw in the rectangle, the printText2 method will returns the remain charactors.

Code:
var string = "";
for (i = 0; i < 26; i++)
{
for (j = 0; j < 3000; j++)
string += String.fromCharCode(65 + i);
}

var strToBePrinted;


Printer.onNewPage = function (page)
{
if (page == 1)
{
strToBePrinted = string;
this.continuePrinting = true;

return;
}

if (strToBePrinted == "") this.continuePrinting = false;
}

Printer.onPrint = function (page)
{    // put the image on the center of the paper
    var width = this.pageWidth;
    var height = this.pageHeight;
    
    var font = new FontObject;
    font.size = 12;
    font.name = "System";
    font.color = 0xFF0000;
    
    this.font = font;

strToBePrinted = this.printText2(strToBePrinted, 0, 0, width, height);
}

Printer.printPreview();
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 03:13 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.