A Flash Developer Resource Site

Results 1 to 9 of 9

Thread: [Resolved] Pagination/printing fields - Request to Macromedia

  1. #1
    gskinner.com
    Join Date
    Feb 2002
    Location
    N.America
    Posts
    455
    This is a suggestion that I emailed to wish-flash@macromedia.com. I thought others might be interested in it, and may be able to contribute to it.

    Send email to the above email address requesting this or other features for Flash 7.

    -----

    Greetings

    Just got back from FlashForward2002, where I was a finalist for my site "zeroEra.com", and wanted to submit my wishlist for printing features in future versions of Flash.

    Currently, Flash is excellent for printing off a single page of dynamic content, or numerous pages of static content, but it provides no robust controls for paginated dynamic content.

    Most modern online administrative systems, some user systems, and a number of CDROM deployable applications benefit from printable reports or summaries, based on user entries. Currently, implementing such solutions requires developers to build the Flash application, and then create supporting HTML-based pages for printing. This was a minor issue with Flash 5, in that the user had to leave their familiar environment to print. It becomes far more of a concern now with FlashMX, where developers now can create genuine applications, independent of a server back-end, with SharedObjects.

    For instance, say I would like to build a CDROM (or even an online) piece, where users can enter variable amount of information (which would be stored with SharedObjects), and then print off a report on that information - this report could be anywhere from one page, through to tens of pages long. Currently, I could not do this in Flash, without having to have the user either: run through the print dialogue once for each page; or print off a bunch of extra blank pages. This is because Flash does not have any support for multiple page print jobs, except via the (VERY) static #P method. Currently, I would have to use a third party tool to write a temporary HTML file to their drive, then use another third party tool to open it, then instruct the user to print it out from their browser - hardly an ideal solution.

    I could go on, but I would rather provide some potential solutions for the above mentioned issues.

    One excellent solution would be a print queue object. This would allow you to queue up a number of print "objects" for a single print job. For instance:

    printJob = new PrintQueue();
    printJob.setFooter("myfooterMC",showOnFirstPage,"p ageNumberVariableName");
    printJob.setHeader("myHeaderMC",showOnFirstPage,"p ageNumberVariableName");
    printJob.addItem("target",arguments);
    // carry out some actions that modify target
    printJob.addItem("target",arguments);

    print(printJob);

    arguments would contain bounding box information, etc.

    In this fashion, you could generate any number of pages to print, 1 at a time, and then print them all in a single job. You could also specify any parameters that would be universal to the job (for instance, a footer and header).

    Another potentially useful capability would be the ability to print a field, and have Flash automatically handle pagination. A rough example would be:

    printJob = new PrintQueue();
    printJob.setHeader("myHeaderMC",showOnFirstPage,"p ageNumberVariableName");
    printJob.addItem("myCoverPageMC",arguments);
    printJob.addItem("fieldTarget",boundingBox,paginat e,backgroundColor);

    print(printJob);

    This would make it very simple to generate simple multi-page reports. Developers could format the text in the field using HTML to create titles, etc. and then add a header to give it a cohesive branded look. Developers could add text fields correlating to "pageNumberVariableName", and it would automatically update the page number in the header/footer.

    These are just my early thoughts for this, and are somewhat undeveloped. Please feel free to contact me for clarification or for more information.


    Thank you for the great product!

  2. #2
    gskinner.com
    Join Date
    Feb 2002
    Location
    N.America
    Posts
    455
    Bump.


    (don't worry, I'll only bump it once)

  3. #3
    Junior Member
    Join Date
    Jul 2002
    Posts
    2

    Bump it up again and again and again

    I absolutely need to print multiple pages of dynamic content (large multiline text fields) and am limited to using Flash 5 to do so. I have an idea, but it's turning into a heck of a lot of work and isn't coming together like I expected. If anyone has any innovative ideas, please... please send them my way.
    [Edited by mspres on 07-22-2002 at 09:05 AM]

  4. #4
    The future is now
    Join Date
    Aug 2001
    Location
    Utah
    Posts
    66

    Pagination is a needed

    I fully agree with you. As Flash is becoming a tool we are using for full application development, it needs the functionality of an application development tool. One of those features is pagination.
    President/CEO
    MediaRain
    www.mediarain.com
    boards@mediarain.com

  5. #5
    Junior Member
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    21

    one solution

    I agree, it's something we'd like to see (not that, sifting through the MX2004 hype, I can see it having changed from MX). In the meantime, buried in the movies section is a solution to this problem that I cooked up:

    http://www.flashkit.com/movies/Scrip...8445/index.php

    If you do a search for "print multiple pages" you won't find it, coz no-one's ever rated it

    It uses a motion tween to print multiple pages, with dynamic content on each page, not just text fields. If it's of value, then please, insert a comment....! It's not perfect, in that it can't print n pages, only a predefined number per tweened clip, but it goes someway towards bridging the gap.
    cheers,
    Hugh

  6. #6
    The future is now
    Join Date
    Aug 2001
    Location
    Utah
    Posts
    66
    This is a great link, thanks. I am excited when it becomes a native function in Flash
    President/CEO
    MediaRain
    www.mediarain.com
    boards@mediarain.com

  7. #7
    Senior Member
    Join Date
    Sep 2000
    Posts
    144
    Has there been any movement on this issue? I have been fighting this issue for years. I have a dynamic string of text 30 pages long. I do not know where the page breaks are. I need it to paginate.

    Any ideas? I have tryed a dozen things, and none work concitenlty accross all printers and OS's.

    ty for any ideas.

    --mm

  8. #8
    Junior Member
    Join Date
    May 2003
    Posts
    14

    Anything?

    I have the same problem, need to print dynamic textfields which I have no idea beforehand how long will be, need to paginate. Has anyone found a way to do this? I'm using Flash MX 2004.

    Thanks in advance

  9. #9
    Senior Member
    Join Date
    Sep 2000
    Posts
    144
    The most recent method I have been using involves manually inserting "fake" html tags into the text as I populate it. I use a tag I made up called "<"pagebreak">". When it come time to print the textArea out I take the HTML string and do this:
    PHP Code:
    // abriviated code ...
    var printArr:Array = s.split("<pagebreak>");
    for(var 
    k=0;k<printArr.length;k++){
    _root.print_mc.print_txt.htmlText "<p><font size='8' face='Arial'>"+printArr[k]+"</font></p>";
    my_pj.addPage(_root.print_mc,{},{printAsBitmap:Boolean});

    You still need to find out where to insert the "<"pagebreak">"'s at. That is tough, and you will need to get creative to find a way to do it. I HUGE problem is that if a textArea displayed on the screen shows 38 lines when you print the instance of it the print out may only have 35 lines, or 40 lines!!!!. There is NO CONSISTANT RELATIONSHIP between what you see on the screen and what gets printed. My team has spent over 80 man hours trying to make a soultion with counting line numbers, maxscroll, bottomScroll, etc to work. The code is fine, but the data falls apart. The reason is that if flash says that there are 30 lines visible (botScroll) and you print that out, scroll 30 lines down and print again ... well that first page actaully prints out at 30+/-3 lines ... and the math breaks really fast.

    You may have some luck with searching a text string for \n, or using a mono space font and counting the number of characters.

    e.x. Courier New 12 pnt is 3.25px per character (guess) and I can fit 50 caracters per line and 30 lines per page -- etc.

    That only goes so far b/c word wrap throws off the math ...
    By the same token you can make an array with the widths of every character, cap and lowercase, for the font that you are using. [[W,4.2][w,2.3]etc]. Then start with the first character and begin counting. Search for spaces and - characters to determin when a word will or will not wrap to the next line. Continue doing that untill you reach a point that you know a page break should be. At that point insert a "<"pagebreak">" tag. (this method has the most promise, also the most work ...)

    no good solution yet, but I am hopfull that the new type engine Saffron they are working on will solve some of these issues.

    --mm
    Last edited by Macro-Muse; 02-18-2005 at 05:32 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center