title: Barcode4j + qr not working
body: <p>I have problems trying to generate an image with qr code via barcode4j library.
  I've read the <a href="http://barcode4j.sourceforge.net/2.1/fop-ext.html" rel="nofollow">following guide</a> but that didn't work out.
  So here is my code:</p>
  
  <p>pom.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;fopqr&lt;/groupId&gt;
      &lt;artifactId&gt;fopqr&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                      &lt;encoding&gt;UTF-8&lt;/encoding&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.xmlgraphics&lt;/groupId&gt;
              &lt;artifactId&gt;fop&lt;/artifactId&gt;
              &lt;version&gt;1.0&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.barcode4j&lt;/groupId&gt;
              &lt;artifactId&gt;barcode4j&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;net.sf.barcode4j&lt;/groupId&gt;
              &lt;artifactId&gt;barcode4j-fop-ext&lt;/artifactId&gt;
              &lt;version&gt;2.1&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;com.google.zxing&lt;/groupId&gt;
              &lt;artifactId&gt;core&lt;/artifactId&gt;
              &lt;version&gt;3.2.0&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>2. Main.java</p>
  
  <pre><code>import org.apache.fop.apps.Fop;
  import org.apache.fop.apps.FopFactory;
  import org.apache.xmlgraphics.util.MimeConstants;
  
  import javax.xml.transform.Result;
  import javax.xml.transform.Source;
  import javax.xml.transform.Transformer;
  import javax.xml.transform.TransformerFactory;
  import javax.xml.transform.sax.SAXResult;
  import javax.xml.transform.stream.StreamSource;
  import java.io.BufferedOutputStream;
  import java.io.File;
  import java.io.FileOutputStream;
  import java.io.OutputStream;
  
  
  public class Main {
      public static void main(String[] args) throws Exception{
          FopFactory fopFactory = FopFactory.newInstance();
          OutputStream out = new BufferedOutputStream(new FileOutputStream(new File("/home/user/fop.pdf")));
  
          try {
              Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, out);
              TransformerFactory factory = TransformerFactory.newInstance();
              Transformer transformer = factory.newTransformer(); // identity transformer
              Source src = new StreamSource(new File("/home/user/template.xsl"));
              Result res = new SAXResult(fop.getDefaultHandler());
              transformer.transform(src, res);
          }
          finally {
              out.close();
          }
      }
  }
  </code></pre>
  
  <p>template.xsl </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="sans-serif" font-size="10pt"&gt;
    &lt;fo:layout-master-set&gt;
      &lt;fo:simple-page-master master-name="A4" page-height="29.7cm" page-width="21cm" margin-top="2cm" margin-bottom="0.4cm" margin-left="2cm" margin-right="2cm"&gt;
        &lt;fo:region-body margin-bottom="2.3cm"/&gt;
        &lt;fo:region-after extent="2.2cm"/&gt;
      &lt;/fo:simple-page-master&gt;
    &lt;/fo:layout-master-set&gt;
    &lt;fo:page-sequence master-reference="A4" language="en"&gt;
      &lt;fo:flow flow-name="xsl-region-body"&gt;
                  &lt;fo:block&gt;
                    &lt;fo:instream-foreign-object&gt;
                      &lt;bc:barcode xmlns:bc="http://barcode4j.krysalis.org/ns" message="hello world"&gt;
                        &lt;bc:qr/&gt;
                      &lt;/bc:barcode&gt;
                    &lt;/fo:instream-foreign-object&gt;
                  &lt;/fo:block&gt;
                   &lt;/fo:flow&gt;
    &lt;/fo:page-sequence&gt;
  &lt;/fo:root&gt;
  </code></pre>
  
  <p>When I try to launch the application with</p>
  
  <pre><code>kirill@kirill:~/work/source/fop$ java -jar target/fopqr-1.0-SNAPSHOT-jar-with-dependencies.jar
  </code></pre>
  
  <p>I get</p>
  
  <pre>
  Mar 07, 2015 10:42:02 PM org.apache.fop.events.LoggingEventListener processEvent
  WARNING: Unknown formatting object "{http://barcode4j.krysalis.org/ns}barcode" encountered (a child of fo:instream-foreign-object}. (See position 13:99)
  Mar 07, 2015 10:42:02 PM org.apache.fop.events.LoggingEventListener processEvent
  WARNING: Unknown formatting object "{http://barcode4j.krysalis.org/ns}qr" encountered (a child of barcode}. (See position 14:31)
  Mar 07, 2015 10:42:02 PM org.apache.fop.events.LoggingEventListener processEvent
  SEVERE: The intrinsic dimensions of an instream-foreign-object could not be determined. (See position 12:47)
  </pre>
  
  <p>What am I doing wrong?</p>
  
  <p><strong>UPDATE</strong>: I also want to add that I read <a href="http://barcode4j.sourceforge.net/faq.html" rel="nofollow">FAQ</a>: 4.1. The FOP extension fails. But as you can see I added all required libraries to my pom.xml file.</p>