
Untitled
By: a guest on
Sep 10th, 2012 | syntax:
Ruby | size: 0.62 KB | hits: 14 | expires: Never
def self.process(working_path, pdf_name)
pdf_path = "#{working_path}\/#{pdf_name}"
pdf_text = PdfUtils.pdf_text(pdf_path)
# split off PDF for people one by one until we have no pages left
page_num = 1
person_num = 1
while PdfUtils.pdf_page_count(pdf_path)>0
# are we at the end of the person's PDF?
if PageNumMatcher.matches_page_n_of_n?(pdf_text, page_num)
puts "Splitting off PDF #{person_num}"
# pull off the person's PDF into a new one, with sequential numbering
PdfUtils.split_pdfs(pdf_path, 1, page_num+1, "#{working_path}\/{person_num}.pdf")
person_num += 1
end
page_num += 1
end
end