We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Save QR barcode to file

Thread ID:

Created:

Updated:

Platform:

Replies:

125757 Sep 9,2016 10:57 AM UTC Sep 12,2016 09:04 AM UTC ASP.NET MVC 1
loading
Tags: PDF
Morny
Asked On September 9, 2016 10:57 AM UTC

The barcode doesn’t exist on the control list, so sorry for posting my question under a different control

On a website, I have a collection of items, each containing some information for a QR code, and a need for saving the QR code for each item to a separate file for download and insertion into a document in a text editor e.g. Word.

The information for the QR code is:

  • Content: The text to encode
  • Titel: A text that identifies the QR code, which I would like to have “printed” beneath the QR code. The title differs from the content.
  • Filename: The name for the file (without extension), to which the QR code should be saved.

If possible, I would like to create and save all QR codes in a loop somewhat like this:

Foreach (item in items)
{
Generate QR code
Save QR code to file
}

I would prefer the QR code saved to an image format rather than a pdf if possible.

If all the generated files automatic could be zipped into one file afterwards for easy download for the user would be awesome.

I can render the QR code to a webpage, but not save it to a file. I’m 99% sure I’ve seen an example of it done online, but now I can’t find I again.

Can this be done, and if so please provide an example.


Chinnu Muniyappan [Syncfusion]
Replied On September 12, 2016 09:04 AM UTC

Hi Morten, 
Thank you for contacting Syncfusion support. 
Yes, we can generate Barcode images and zip it in a single file, we have created a simple console application sample to achieve your requirement. The same code will work fine for MVC application. 
Required Assemblies: 
Syncfusion.Pdf.Base.dll 
Syncfusion.Compression.Base.dll 
Syncfusion.Compression.Zip.ZipArchive zip = new Syncfusion.Compression.Zip.ZipArchive(); 
            for(int i=0;i<10;i++) 
            { 
                //Create a new PDF QR barcode 
                PdfQRBarcode barcode = new PdfQRBarcode(); 
 
                //Set the barcode text 
                barcode.Text = "the text to encode"; 
 
                //Export the barcode as image 
                Image img = barcode.ToImage(); 
 
                 
                MemoryStream ms = new MemoryStream(); 
                //Save the image to stream 
                img.Save(ms, System.Drawing.Imaging.ImageFormat.Png);    
              
                //Archive the image to zip 
                zip.AddItem("img"+i.ToString ()+".png", ms, false, FileAttributes.Normal); 
            } 
            MemoryStream outputStream = new MemoryStream(); 
 
            //Save the zip file. 
            zip.Save(outputStream,false); 
 
Sample link: 

Please let us know if you have any concern. 
Regards, 
Chinnu 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;