Converting SVG image to TIFF


#1

i am trying to convert a svg image to tiff but after converting the image is not seen as whole some part of the image is visible
in my code i am converting svg image to stream and then using TiffOptions to convert, but the whole image is not visible after conversion


#2

@Sam212111

Thank you for contacting support.

Would you please share source and generated ZIP files along with SSCCE code so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using latest version of the API.


#3

New Compressed (zipped) Folder.zip (2.8 KB)

i attached the svg img and the output tiff what i am getting, please share your code to get the same img in tiff format …


#4

@Sam212111

Thank you for sharing requested data.

You may use below code snippet to convert SVG to TIFF. Feel free to contact us if you need any further assistance.

// Instantiate Document object
Document doc = new Document();

// add page to pages collection of PDF file
Page page = doc.Pages.Add();

// Create an image instance
Aspose.Pdf.Image img = new Aspose.Pdf.Image();

// Set image type as SVG
img.FileType = (ImageFileType.Svg);

// Path for source file
img.File = (@"D:\636963846810645106.svg");

// Set left margin for image instance
img.Margin.Left = (10);

// Set Top margin for image instance
img.Margin.Top = (10);

// add image to PDF file
page.Paragraphs.Add(img);

doc.ProcessParagraphs();

// Create Resolution object
Resolution resolution = new Resolution(300);

// Create TiffSettings object
TiffSettings tiffSettings = new TiffSettings();
tiffSettings.Compression = CompressionType.None;
tiffSettings.Depth = ColorDepth.Default;
tiffSettings.SkipBlankPages = false;
// Create TIFF device
TiffDevice tiffDevice = new TiffDevice(resolution, tiffSettings);
tiffDevice.Process(doc, @"D:\SVGtoTIFF.tiff");

#5

the requirement is to convert svg img into stream and then using options to convert it into tiff img stream and then in end converting tiff img stream to pdf , what i was trying to do when got the output tiff image as sent.


#6

what i want to do is take the stream having my current document and the stream of tiff got and then forming the final pdf


#7

@Sam212111

Would you please elaborate your requirements a little more. Kindly specify if you want the final output to be a TIFF file or a PDF document. Moreover, above code snippet can easily be used with streams as well; you may read an image into stream and then set img.ImageStream instead of img.File. Likewise, tiffDevice.Process and doc.Save method accept streams instead of file paths.

In case you face any problem then feel free to contact us.