Qrcode in Zxing in svg format how to save to file

Apr 9, 2014 at 10:50 AM
does anyone know how to save the barcode to a svg file after endeingas a svg code?
var writer = new BarcodeWriterSvg()
        {
            Format = BarcodeFormat.QR_CODE,    
            Options = new QrCodeEncodingOptions 
            {
                Height = 400, Width = 400,
            } 
        };
so far its written as a svg QR code.

and the reason if anyones asking is because i need to implement a icon into the centre of the QR code and then save it to a Svg for scalability
Coordinator
Apr 9, 2014 at 7:23 PM
Try the following:
var fileName = "<your destination filename for the svg image here>.svg";
var writer = new BarcodeWriterSvg()
{
    Format = BarcodeFormat.QR_CODE,    
    Options = new QrCodeEncodingOptions 
    {
        Height = 400, Width = 400,
    } 
};
var svgImage = writer.Write("<your content which should be encoded here>");
File.WriteAllText(fileName, svgImage.Content, System.Text.Encoding.UTF8);
Marked as answer by jaydeesale on 4/14/2014 at 1:24 AM
Apr 10, 2014 at 12:16 PM
thanx for the reply works great.

now do you perhaps know how to store a svg image into the centre of the svg barcode that is being created.?
Coordinator
Apr 11, 2014 at 7:03 PM
No, sorry, I can't help you. I'm not that familiar with SVG.
But I think it should not be that difficult. SVG images are only XML based text files. Perhaps you only have to add your XML code to the end of the barcode description in the file. On the other hand there are SVG libraries out there which might help you.
Apr 14, 2014 at 8:15 AM
thanx for all the intel didnt actualli think about just adding the xml tag at the end of it. good call.
as to the libraries any ideas as to which library specifically would be the best ? or wiuld actualli serve my purpose ?
Coordinator
Apr 15, 2014 at 7:57 PM
I don't have any experience with SVG libraries. Sorry, I can't recommed any lib.