How to place QRCode in Grid as column.

Hi team,

Is this possible? I need to export List of sfQRCodeGenerator

(ex. productcode) via pdfexport of the sfgrid.


Beast regards, 

Tyrone


5 Replies

JP Jeevakanth Palaniappan Syncfusion Team September 21, 2021 02:24 PM UTC

Hi Tyrone, 

Greetings from Syncfusion support. 

We have checked your query and we have forwarded your query to the corresponding development team. So we will update the further details in two business days. Until then we appreciate your patience. 

Regards, 
Jeevakanth SP. 



TY Tyrone replied to Jeevakanth Palaniappan September 22, 2021 03:16 AM UTC

Thanks  Jeevakanth, will wait for it :)



JP Jeevakanth Palaniappan Syncfusion Team September 23, 2021 08:40 AM UTC

Hi Tyrone, 

Thanks for your patience. 

We have validated your query and we would like to inform you that the image will be exported to pdf based on its base64 string. So you have to convert the image to the base64 string at your end to export it and then use the base64 string in the PdfQueryCellInfoHandler event. Also to export the template column, set the IncludeTemplateColumn as true in the PdfExportProperties. Please refer the below code snippet and the sample for your reference. 


Documentation : 

@using Syncfusion.Blazor.Grids 
 
<SfGrid ID="Grid" @ref="DefaultGrid" DataSource="@Orders" Toolbar="@(new List<string>() { "PdfExport" })" AllowPdfExport="true" AllowPaging="true"> 
    <GridEvents PdfQueryCellInfoEvent="PdfQueryCellInfoHandler" OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents> 
    <GridColumns> 
        <GridColumn HeaderText="Image"> 
            <Template> 
                @{ 
                    <span>Your image here</span> 
                } 
            </Template> 
        </GridColumn> 
         
    </GridColumns> 
</SfGrid> 
 
@code{ 
 
    string bs = "/9j/3Jf1DDo+UWsjCXEqSve3………....AAAP/9k=";//This is the base64 string of the image 
 
    private SfGrid<Order> DefaultGrid; 
    public List<Order> Orders { get; set; } 
 
    public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args) 
    { 
        if (args.Item.Id == "Grid_pdfexport")  //Id is combination of Grid's ID and itemname 
        { 
            PdfExportProperties ExportProperties = new PdfExportProperties(); 
            ExportProperties.IncludeTemplateColumn = true; 
            await this.DefaultGrid.ExportToPdfAsync(ExportProperties); 
        } 
    } 
    public void PdfQueryCellInfoHandler(PdfQueryCellInfoEventArgs<Order> args) 
    { 
        if (args.Column.HeaderText == "Image") 
        { 
//pass the base64 string as a parameter here 
            byte[] dataString = Convert.FromBase64String(bs); 
            System.IO.MemoryStream imageStream = new System.IO.MemoryStream(dataString); 
            args.Cell.Style.BackgroundImage = Syncfusion.PdfExport.PdfImage.FromStream(imageStream); 
            args.Cell.ImagePosition = Syncfusion.PdfExport.PdfGridImagePosition.Center; 
        } 
    } 


Get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 



TY Tyrone September 24, 2021 02:31 PM UTC

thanks Jeevakanth SP for the update. I'll give it a  try. :)



JP Jeevakanth Palaniappan Syncfusion Team September 27, 2021 05:25 AM UTC

Hi Tyrone, 

Thanks for the update. Please get back to us if you have any other queries. 

Regards, 
Jeevakanth SP. 


Loader.
Up arrow icon