Is it possible to convert directly from
- xps to jpg
- xps to txt
- svg to jpg
- svg to txt
Thanks.
Is it possible to convert directly from
Thanks.
You may use Aspose.PDF and Aspose.Imaging APIs to achieve the tasks. Following are the details.
XPS to TXT:
Aspose.Pdf.LoadOptions options = new Aspose.Pdf.XpsLoadOptions();
Aspose.Pdf.Document PDFDocument = new Aspose.Pdf.Document(@"inputfile", options);
Aspose.Pdf.Text.TextAbsorber PdfTextAbsorber = new Aspose.Pdf.Text.TextAbsorber();
PDFDocument.Pages.Accept(PdfTextAbsorber);
string FileText = PdfTextAbsorber.Text;
XPS to JPG:
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@"inputfile", new XpsLoadOptions());
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(300);
Aspose.Pdf.Devices.JpegDevice objjpeg = new Aspose.Pdf.Devices.JpegDevice(resolution);
objjpeg.Process(pdfDocument.Pages[0], @"output.jpeg");
SVG to JPG:
string srcPath = @"input.svg";
string destPath = @"output.jpg";
using (SvgImage image = (SvgImage)Image.Load(srcPath))
{
JpegOptions options = new JpegOptions();
image.Save(destPath, options);
}
For detail, please visit the link Converting SVG to Raster Format. Hope that above information helps. Feel free to contact us in case of any query or comments.
Thanks a lot.
Image.png (35.4 KB)
TestXps.zip (141.6 KB)
We have looked into the issue. Please use the following code snippet to convert XPS to JPG.
CODE:
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(@"TestXps.xps", new XpsLoadOptions());
Aspose.Pdf.Devices.Resolution resolution = new Aspose.Pdf.Devices.Resolution(100);
Aspose.Pdf.Devices.JpegDevice objjpeg = new Aspose.Pdf.Devices.JpegDevice(resolution);
objjpeg.Process(pdfDocument.Pages[1], @"output.jpeg");
Thanks a lot. It works!