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. Image for the cookie policy date

How to export Grid or Hierarchy grid to pdf inside code

As we need to have a image  file of the report in order to print on Esc-pos printers and exporting to image is not possible , we are going to export the report to pdf file located in specific directory programatically  and then change it to jpg format.

I would appreciate to have a sample code for this.

Thanks in advance

9 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team October 8, 2019 01:28 PM UTC

Hi Afshin, 

Greetings from Syncfusion support. 

Based on your query we suspect that you want to export hierarchy Grid and we have already discuss about this query in the following documentation. 


If we misunderstood your query then please get back to us. 

Regards, 
Thavasianand S. 



AL Albert October 8, 2019 07:51 PM UTC

No its not the same query.

This is the requirement. we have a syncfusion grid that we show customer order inside that and we have a div showing order summary. we are going to print them on Esc-pos printer . in order to print we have to prepare an image containing the div and the grid. we have an export to pdf button that user can export the grid. my question in this : how can we do export to pdf programaticaly in order to convert it to image.

If its not possible do you have other solution in mind like having html of the grid in order to convert it to image?

Thanks


TS Thavasianand Sankaranarayanan Syncfusion Team October 9, 2019 10:58 AM UTC

Hi Albert, 

Thanks for explaining about your requirement. 

We have validated your requirement. If your requirement was to print the grid element as image you can use Print feature of the Grid which allows you print the grid element as image. If it is not possible in your case please explain about the difficulty you are facing, that will help us to provide a better solution as soon as possible. 

If possible, please share the screenshot or video demo of the Grid that you need to print. 

Refer the following documentations and demo links for more information. 



Regards, 
Thavasianand S. 



AL Albert October 9, 2019 04:25 PM UTC

The problem is this . As we are going to print on android device and using Esc-pos printer, using the print button will not print on android device and just prints on windows devices .We have a printer library that we have to pass the image of the report to it and it prints based on different esc-pos printers.

What we need is to get the image of the report ( grid to print ) programatically.

Thanks


TS Thavasianand Sankaranarayanan Syncfusion Team October 11, 2019 01:45 PM UTC

Hi Afshin, 

By default, In our EJ2 Grid is purely web component(HTML, CSS and JavaScript) and its printing feature perform web page printing not windows, ESC Pos printing seems to print like emulator printing(window console or c program or other emulators). 

If possible can you please create a simple HTML sample and check with ESC printer and share the sample and details with us that will helpful for us to analyze further and helps to integrate with our grid. 

Regards, 
Thavasianand S. 



AL Albert October 11, 2019 02:04 PM UTC

Thanks for your answer.

As you mentioned printing on Esc-pos printers is not possible through html pages and the printer company has provided a library that gets an image file and prints it.

For that reason we are looking for a way to have an image of what is going to be printed to pass to their library.

It would be the best for us to get the image of what is going to be printed from you otherwise we need a pdf or html of that in order to convert it to image programatically.

Thanks again


TS Thavasianand Sankaranarayanan Syncfusion Team October 15, 2019 09:28 AM UTC

Hi Albert, 

Thanks for your update. 

In  EJ2 Pdf Viewer sever library (ASP.NET Core and Asp.NET MVC) allows the PDF document pages to be exported as raster images. We have created a sample to export the PDF document pages as image using PDF Viewer server library and shared in the following location, 


Note: In above sample, we have created Windows, Linux and IOS project files (with their respective packages). So kindly build the windows project when working in windows environment.   

Please find the below UG links for reference,  

   

Regards, 
Thavasianand S. 



AL Albert October 18, 2019 06:37 PM UTC

Hi Thavasianand,

Thanks a lot for your advice.

Is it possible for your team to prepare the same for React.js as we are not using asp.net.

Thanks 


TS Thavasianand Sankaranarayanan Syncfusion Team October 21, 2019 12:25 PM UTC

Hi Afshin, 

We do not have support to export the PDF document pages into images from React front end. As mentioned earlier we can export the PDF document pages into images only using our EJ2 Pdf Viewer sever library. 

Regards, 
Thavasianand S. 


Loader.
Live Chat Icon For mobile
Up arrow icon