diff --git a/src/org/openbravo/localization/portugal/fiscalization/data/ExportSaftPT.java b/src/org/openbravo/localization/portugal/fiscalization/data/ExportSaftPT.java
index a5b810c..765f39f 100644
--- a/src/org/openbravo/localization/portugal/fiscalization/data/ExportSaftPT.java
+++ b/src/org/openbravo/localization/portugal/fiscalization/data/ExportSaftPT.java
@@ -8,14 +8,28 @@
  */
 package org.openbravo.localization.portugal.fiscalization.data;
 
+import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.nio.charset.Charset;
 import java.text.SimpleDateFormat;
 import java.time.YearMonth;
 import java.util.Date;
 import java.util.HashMap;
 
 import javax.servlet.ServletException;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.log4j.Logger;
 import org.codehaus.jettison.json.JSONException;
 import org.hibernate.ScrollMode;
@@ -35,6 +49,8 @@ import org.openbravo.scheduling.ProcessLogger;
 import org.openbravo.service.db.DalBaseProcess;
 import org.openbravo.service.db.DalConnectionProvider;
 import org.quartz.JobExecutionException;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
 
 public class ExportSaftPT extends DalBaseProcess {
 
@@ -121,6 +137,7 @@ public class ExportSaftPT extends DalBaseProcess {
 
             final File file = File.createTempFile("SAFTPT-", ".xml");
             createSaftFile(file);
+            prettyPrintByTransformer(file, 2);
             attachSaft(file);
 
             export = OBDal.getInstance().get(PTFISSaftptexport.class, export.getId());
@@ -164,6 +181,40 @@ public class ExportSaftPT extends DalBaseProcess {
     }
   }
 
+  private static void prettyPrintByTransformer(File file, int indent) {
+
+    try {
+      String xmlString = FileUtils.readFileToString(file, "UTF-8");
+      InputSource src = new InputSource(new StringReader(xmlString));
+      Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(src);
+
+      TransformerFactory transformerFactory = TransformerFactory.newInstance();
+      transformerFactory.setAttribute("indent-number", indent);
+      Transformer transformer = transformerFactory.newTransformer();
+      transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+      transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+      transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+      Writer out = new StringWriter();
+      transformer.transform(new DOMSource(document), new StreamResult(out));
+
+      FileUtils.write(new File(file.getAbsolutePath()), "", Charset.defaultCharset());
+
+      BufferedWriter outWriter = new BufferedWriter(new FileWriter(file.getAbsolutePath()));
+
+      try {
+        outWriter.write(out.toString());
+      } catch (IOException e) {
+        throw new RuntimeException("Error occurs when witting the pretty-printing xml:\n" + file,
+            e);
+      } finally {
+        outWriter.close();
+      }
+    } catch (Exception e) {
+      throw new RuntimeException("Error occurs when pretty-printing xml:\n" + file, e);
+    }
+  }
+
   private ScrollableResults getValidSaftExports(final int limit) {
     final String whereClause = "isProcessed = false AND active = true";
     final OBQuery<PTFISSaftptexport> saftExportList = OBDal.getInstance()
