title: PDFsharp image to XImage
body: <p>I created a barcode as an image in my ASP.NET MVC app.</p>
  
  <pre><code>BarcodeLib.Barcode barcode = new BarcodeLib.Barcode()                   
  {                        
      IncludeLabel = false,
      Alignment = AlignmentPositions.LEFT,
      Width = element.BarcodeWidth,
      Height = element.BarcodeHeight,
      RotateFlipType = RotateFlipType.RotateNoneFlipNone,
      BackColor = Color.Transparent,
      ForeColor = Color.Black,
      ImageFormat = System.Drawing.Imaging.ImageFormat.Png
   };
  </code></pre>
  
  <p>This will create a barcode with the BarcodeLib.<br>
  How do I convert it to an XImage of PDFsharp?</p>
  
  <pre><code>Image img = barcode.Encode(TYPE.CODE128, "123456789");
  gfx.DrawImage(xImage, 0, 0, 100, 100);
  </code></pre>