[IMP] Changed some things dur to uk localization module renamming
bzr revid: nicolas.vanhoren@openerp.com-20101028094758-ghhwgkk7rgz9xxv7
This commit is contained in:
parent
5b7affd49f
commit
1fc401534e
|
@ -34,7 +34,7 @@ with flatten, everything is turned into text.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import netsvc,logging
|
import tempfile
|
||||||
|
|
||||||
|
|
||||||
HEAD="""%FDF-1.2
|
HEAD="""%FDF-1.2
|
||||||
|
@ -91,14 +91,30 @@ def write_fields(out, fields):
|
||||||
|
|
||||||
def extract_keys_from_pdf(filename):
|
def extract_keys_from_pdf(filename):
|
||||||
# what about using 'pdftk filename dump_data_fields' and parsing the output ?
|
# what about using 'pdftk filename dump_data_fields' and parsing the output ?
|
||||||
os.system('pdftk %s generate_fdf output /tmp/toto.fdf' % filename)
|
tmp_file = tempfile.mkstemp(".fdf")[1]
|
||||||
lines = file('/tmp/toto.fdf').readlines()
|
try:
|
||||||
|
os.system('pdftk %s generate_fdf output \"%s\"' % (filename, tmp_file))
|
||||||
|
with open(tmp_file, "r") as ofile:
|
||||||
|
lines = ofile.readlines()
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
os.remove(tmp_file)
|
||||||
|
except:
|
||||||
|
pass # nothing to do
|
||||||
return extract_keys(lines)
|
return extract_keys(lines)
|
||||||
|
|
||||||
|
|
||||||
def fill_pdf(infile, outfile, fields):
|
def fill_pdf(infile, outfile, fields):
|
||||||
write_fields(file('/tmp/toto.fdf', 'w'), fields)
|
tmp_file = tempfile.mkstemp(".fdf")[1]
|
||||||
os.system('pdftk %s fill_form /tmp/toto.fdf output %s flatten' % (infile, outfile))
|
try:
|
||||||
|
with open(tmp_file, "w") as ofile:
|
||||||
|
write_fields(ofile, fields)
|
||||||
|
os.system('pdftk %s fill_form \"%s\" output %s flatten' % (infile, tmp_file, outfile))
|
||||||
|
finally:
|
||||||
|
try:
|
||||||
|
os.remove(tmp_file)
|
||||||
|
except:
|
||||||
|
pass # nothing to do
|
||||||
|
|
||||||
def testfill_pdf(infile, outfile):
|
def testfill_pdf(infile, outfile):
|
||||||
keys = extract_keys_from_pdf(infile)
|
keys = extract_keys_from_pdf(infile)
|
||||||
|
|
|
@ -162,7 +162,7 @@ License: GPL-2+
|
||||||
On Debian systems, the complete text of the GNU General Public License
|
On Debian systems, the complete text of the GNU General Public License
|
||||||
can be found in /usr/share/common-licenses/GPL-2 file.
|
can be found in /usr/share/common-licenses/GPL-2 file.
|
||||||
|
|
||||||
Files: bin/addons/l10n_minimal_chart_uk/*
|
Files: bin/addons/l10n_uk/*
|
||||||
Copyright:
|
Copyright:
|
||||||
(C) 2004-2008 Tiny.be <info@tiny.be>
|
(C) 2004-2008 Tiny.be <info@tiny.be>
|
||||||
(C) 2004-2008 Seath Solutions Ltd.
|
(C) 2004-2008 Seath Solutions Ltd.
|
||||||
|
|
Loading…
Reference in New Issue