0

Background: I want to render text into a PDF, using the PDFDocument framework. This framework requires you to do pagination manually. The text will be multiple pages in length, so I need to split the text once it exceeds the page size

Problem: Each page is 540x720px** in size. So basically, I need to figure out how to split a long string at each point that it would fill a 540x720px TextView.

Potential Hack: Overriding the onMeasure method of the TextView, and using a loop to continuously add text and re-measure until it exceeds 720px length

Is there a better solution to this?


**540x720px based on 8.5x11" paper, 0.5" margins, 72dpi

Community
  • 1
  • 1
Matt
  • 5,461
  • 7
  • 36
  • 43

1 Answers1

0

A PageSplitter can be used as a solution to this problem. The class can be found in the answer found below

How to break styled text into pages in Android?

Community
  • 1
  • 1
Matt
  • 5,461
  • 7
  • 36
  • 43