dir = dir.getParentFile();
}
Settings.get().put(Settings.DIRECTORY, dir.getAbsolutePath());
try {
Writer writer = new OutputStreamWriter(new FileOutputStream(file));
Printer p = new Printer();
p.export(writer, doc);
writer.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();