Skip to content

Calculating height of a paragraph (for the purpose of computing page size for printing) #132

@djskrien

Description

@djskrien

I'd like to be able to print the contents of a CodeArea that contains a hundred or more lines of code, which means I need to break it up into pages for printing. Each line of my code is one Paragraph. Therefore, using PageLayout.getPrintableHeight() to get the total number of points I have to work with on each page, and dividing that total by the number of points of height per paragraph, I can figure out how many paragraphs will fit on a page. But to do this, I need a way of getting the height of a paragraph. Is there a way to do it, given the font and font size of the paragraph, e.g., Courier 12? Or is there some other better way of breaking a CodeArea into pages for printing? (Also, should I have asked this question on StackOverflow instead of here?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions