Get a strings from page number to end page in PDF

Simple example to get a string from PDF with fromPage number toPage number.

use framework "Foundation"
use framework "Quartz"
use scripting additions

set thePath to POSIX path of (choose file of type {"pdf"})
set theURL to current application's |NSURL|'s fileURLWithPath:thePath

its stringFromPDF:theURL fromPage:4 toPage:4
on stringFromPDF:theURL fromPage:pageBegin toPage:pageEnd
	set pdfDoc to current application's PDFDocument's alloc()'s initWithURL:theURL
	set endCharacter to (pdfDoc's pageAtIndex:(pageEnd - 1))'s numberOfCharacters()
	(pdfDoc's selectionFromPage:(pdfDoc's pageAtIndex:(pageBegin - 1)) atCharacterIndex:0 toPage:(pdfDoc's pageAtIndex:(pageEnd - 1)) atCharacterIndex:(endCharacter - 1))'s |string|() as text
end stringFromPDF:fromPage:toPage: