Sha256: 819853412f33d875905ae6e089dc7e8062d7ea3d9660a7b07481869662a2efbc
Contents?: true
Size: 1.76 KB
Versions: 3
Compression:
Stored size: 1.76 KB
Contents
#!/usr/bin/env ruby # # Rpdf2txt -- PDF to Text Parser # Copyright (C) 2003 Andreas Schrafl, Hannes Wyss # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # ywesee - intellectual capital connected, Winterthurerstrasse 52, CH-8006 Zürich, Switzerland # hwyss@ywesee.com, aschrafl@ywesee.com # # AttributesParser -- Rpdf2txt -- 19.12.2002 -- hwyss@ywesee.com require 'rpdf2txt-rockit/rockit' module Rpdf2txt GRAMMAR_PATH = File.expand_path('data/pdfattributes.grammar', File.dirname(__FILE__)) PARSER_PATH = File.expand_path('data/pdfattributes.rb', File.dirname(__FILE__)) def attributes_parser(grammar_path=GRAMMAR_PATH, parser_path=PARSER_PATH) oldpath = File.dirname(grammar_path) << "/_" << File.basename(grammar_path) src = File.read(grammar_path) unless(File.exists?(oldpath) && File.read(oldpath)==src) File.delete(oldpath) if File.exists?(oldpath) Parse.generate_parser_from_file_to_file(grammar_path, parser_path, '_attr_parser', 'Rpdf2txt') File.open(oldpath, 'w') { |f| f << src } end require parser_path Rpdf2txt._attr_parser end module_function :attributes_parser end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rpdf2txt-0.8.4 | lib/rpdf2txt/attributesparser.rb |
rpdf2txt-0.8.3 | lib/rpdf2txt/attributesparser.rb |
rpdf2txt-0.8.2 | lib/rpdf2txt/attributesparser.rb |