Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6586305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:46:28+00:00 2026-05-25T16:46:28+00:00

I need to find a way to upsample text from 72dpi (screen) to 300dpi

  • 0

I need to find a way to “upsample” text from 72dpi (screen) to 300dpi (print) for rendered client generated text. This is a true WYSIWYG application and we’re expecting a ton of traffic so client side rendering is a requirement. Our application has several fonts, font sizes, colors, alignments the user can modify in a textarea. The question is how to convert 72dpi to 300dpi. We have the editior complete, we just need to make 300dpi versions of the textarea.

MY IDEA

1) Get textarea and increase the height, width, and font size by 300/72. (if ints are needed on font size I may need to increase the font then down-sample to the height/width)

2) use BitmapUtil.getSnapshot on the textarea to get a rendered version of the text

THE QUESTION

How can I render text inside of a textarea without the component lifecycle? Imagine:

var textArea:TextArea = new TextArea();
textArea.text = "This is a test";    
var bmd:BitmapData = textArea.render();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:46:29+00:00Added an answer on May 25, 2026 at 4:46 pm

    Here is the final method I used to solve the problem of creating a printable version of the text and style of a Spark TextArea component. I ended up placing the custom component TextAreaRenderer (see below) in the MXML and setting the visibility to false. Then using the reference to this component to process any text field (renderObject) and get back a BitmapData object.

    public class TextAreaRenderer extends TextArea implements IAssetRenderer
    {
    
        public function render(renderObject:Object, dpi:int = 300):BitmapData{
    
            // CAST THE OBJECT
            //.................
            var userTextArea:TextArea = TextArea(renderObject);
    
            // SCALE IS THE DIVISION OF THE NEW DPI OVER THE SCREEN DPI 72
            //............................................................
            var scale:Number = dpi / 72;
    
            // COPY THE USER'S TEXT AREA INTO THE OFFSCREEN TEXT AREA
            //.......................................................
            this.text = userTextArea.text;                          // the actual text
            this.height = Math.floor(userTextArea.height * scale);  // scaled height
            this.width = Math.floor(userTextArea.width * scale);    // scaled width
    
    
            // GET THE LAYOUT FORMATS AND COPY TO OFFSCREEN
            // - the user's format =  userTextAreaLayoutFormat
            // - the hidden format = thisLayoutFormat
            //...............................................
            var editableLayoutProperties:Array = ['fontSize', 'fontFamily', 'fontWeight', 'fontStyle', 'textAlign', 'textDecoration', 'color']
            userTextArea.selectAll();
            var userTextAreaLayoutFormat:TextLayoutFormat = userTextArea.getFormatOfRange();
            this.selectAll();
            var thisLayoutFormat:TextLayoutFormat = this.getFormatOfRange();
            for each(var prop:String in editableLayoutProperties){
                thisLayoutFormat[prop] = userTextAreaLayoutFormat[prop];
            }
    
            // SCALE THE FONT SIZE
            //....................
            thisLayoutFormat.fontSize = thisLayoutFormat.fontSize * scale;
    
            // SET THE FORMAT BACK IN THE TEXT BOX
            //...................................
            this.setFormatOfRange(thisLayoutFormat);
    
            // REDRAW THE OFFSCREEN
            // RETURN THE BITMAP DATA
            //.......................
            this.validateNow();
            return BitmapUtil.getSnapshot(this);
        }
    }
    

    Then calling the TextAreaRenderer after the text area is changed to get a scaled up bitmap.

    // COPY THE DATA INTO THE OFFSCREEN COMPONENT
    //............................................
    var renderableComponent:IAssetRenderer = view.offScreenTextArea;
    return renderableComponent.render(userTextArea, 300);
    

    Thanks to the advice from http://www.Flextras.com for working through the issue with me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to find a way to spin off a thread from a static
I need to find a way to store 250 KB of plain text numbers
I need to find a way how to create files from specific folder in
I need to find a way to pass the visible div to javascript. This
I need to find a way to hide HTML Rows (or Tables) from view
I need to find a way to call a vb.net function in my aspx
I need to find some way of displaying a drop-down menu that depending on
I need to find a way to be notified when a System.IO.Pipe.NamedPipeServerStream opened in
I need to find a way to use with(nolock) in every SELECT I do
I need to find a way to pass some strings to my word 2003

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.