View difference between Paste ID: SwrpQJFm and 23tkEUir
SHOW: | | - or go back to the newest paste.
1
def self.process(working_path, pdf_name)
2
	pdf_path = "#{working_path}\/#{pdf_name}"
3
	pdf_text = PdfUtils.pdf_text(pdf_path)
4
5
	# split off PDF for people one by one until we have no pages left
6
	page_num   = 1
7
	person_num = 1
8
	while PdfUtils.pdf_page_count(pdf_path)>0
9
		# are we at the end of the person's PDF?
10
		if PageNumMatcher.matches_page_n_of_n?(pdf_text, page_num)
11
			puts "Splitting off PDF #{person_num}"
12
			# pull off the person's PDF into a new one, with sequential numbering
13
			PdfUtils.split_pdfs(pdf_path, 1, page_num+1, "#{working_path}\/{person_num}.pdf")
14
			person_num += 1
15
		end
16
		page_num += 1
17
	end
18
end