pdfファイルからcsvファイル作成プログラム


pdftotextを使って、pdfファイルからcsvファイルを作成するプログラムを作成してみた。ま、ただ、改行コードを「,」に置き換えているだけなので、たいしたものではないんだけど・・・。

#!/usr/bin/ruby
#********************************************************
# 置換プログラム (Ruby版)
#********************************************************

system 'c:\xpdf\pdftotext.exe -enc Shift-JIS c:\xpdf\test.pdf'

infile = open("test.txt")
outfile = open("test1.txt","w")

while infile.gets
	gsub(/\n/,",")
	outfile.print
end

infile.close
outfile.close