PDF Export - Flex Grid

Posted by: chhavi.sethi on 17 August 2020, 9:12 am EST

    • Post Options:
    • Link

    Posted 17 August 2020, 9:12 am EST

    Hi,

    I see a sample of the product-sheet(https://www.grapecity.com/wijmo/demos/Grid/TransposedGrid/ProductSheet) with transposed grid and I really liked it.

    What I was trying to do with it is PDF export. I actually want to export the product-sheet as a PDF which is all the way possible with FlexGridPdfConverter but there is one issue that the images won’t appear in the PDF. In the column of images, only the URLs of images appear.

    Could you please share a fiddle for this?

  • Posted 18 August 2020, 3:38 am EST

    Hi Chhavi,

    The FlexGridPdfConvertor only exports the data bound to the grid. Since, images are added using formatItem, you will have to manually add the images while exporting the TransposedGrid to PDF. Please refer to the sample attached.

    Regards,

    Ashwin

    pdf grid.zip

  • Posted 18 August 2020, 12:32 pm EST

    Thanks Ashwin,

    It worked. Just one small thing if we can set horizontal alignment of the image into PDF.

    I tried the following but didn’t work.

    event.canvas.drawImage(url, rect.left, rect.top, { align: PdfImageHorizontalAlign.Center });
    
  • Posted 19 August 2020, 1:30 am EST

    Hi Chhavi,

    The align property will not work while rendering image into a cell. You will need to calculate the exact coordinates using the rect and the image to center align the images. Please refer to the updated sample attached.

    Note that in this sample, the dimensions of image is greater than the that of the rect itself (due to some extra white space in the image) so the image may not seem to be center aligned but it actually is.

    ~regards

    tgrid.zip

  • Posted 19 August 2020, 11:38 am EST

    Thanks. Will stick with left-aligned images since it seems quite complex.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels