I would like to use iText to convert an SVG file into a PDF file. However, the Pdf file is created incorrectly. It is displayed in the wrong format. What do I have to do to solve this problem?
Here the C# code:
using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Drawing.Imaging;
using iText;
using iText.Svg.Converter;
using iText.Kernel.Pdf;
using iText.Kernel.Utils;
namespace SvgToPdf
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
FileStream svgPath = File.Open("1/1.svg", FileMode.Open);
FileStream pdfPath = File.Create("autput.pdf");
SvgConverter.CreatePdf(svgPath, pdfPath);
}
}
}
This is what the svg file looks like:
http://jakob-ofner.myds.me/svg/1.svg
and here the result:
@enxaneta I added viewBox="-283 0 1195 1289" to the SVG-File. Now it works. Thank you very much!