Select to view content in your preferred language

Export the data from silverlight datagrid to PDF!

4283
16
12-16-2011 03:36 AM
AnhTruong
Emerging Contributor
Hello all,

I would like to hear any suggestions how to export the silverlight ArcGIS datagrid to Adobe PDF file. Thanks for your inputs.
0 Kudos
16 Replies
AnhTruong
Emerging Contributor
Hello ESRI expertise!

I looked the sample ExportPDF code from Denim Hu, but I am still trouble to make it work for exporting datagrid data with dataPager in Silverlight 4. Is it possible to make it work in ESRI print sample and silverPDF.dll for my problem??? Any other way to work around on this issue. Please help me out. Thanks in advance.




Thanks for your attached sample code. My problem is different from yours because I export the data without map. I will look and figure out how to apply. Any other contributors from ArcGIS expertise are welcome.
0 Kudos
AnhTruong
Emerging Contributor
I posted my issue couple of weeks ago, but still working on solution. I could not find any free library to implement for exporting to PDF. Now I have PDF tool for printer and would like to know how to using silverlight 4.0 printing to export data on dataGrid with dataPager. Any idea how to do it???

Hello ESRI expertise!

I looked the sample ExportPDF code from Denim Hu, but I am still trouble to make it work for exporting datagrid data with dataPager in Silverlight 4. Is it possible to make it work in ESRI print sample and silverPDF.dll for my problem??? Any other way to work around on this issue. Please help me out. Thanks in advance.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
This blog post : http://www.davidpoll.com/2010/04/16/making-printing-easier-in-silverlight-4/ should be helpful to understand how to print a datagrid using multi pages. Once you are able to print your data, you can use a PDF printer driver to get PDF documents.
0 Kudos
AnhTruong
Emerging Contributor
Hi Dominique,

Thank for your refer to http://www.davidpoll.com. I could not find the seperated codes for only Making Printing Easier in Silverlight 4 project, so I have to download all entire sample codes on Silverlight and Beyond on that website. This is excellent demo. In this example, the datasource is from collection list and is not from database. I also found another Silverlight Print from codePlex which seems simple, but the data source is binding from xml format. Did you have a chance to look in details or did something familiar before? Please give me more hints to modify the data source to apply in my issues. I need to printing the dataGrid data with dataPager via Query No Map example at http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap. Thanks for your time.

This blog post : http://www.davidpoll.com/2010/04/16/making-printing-easier-in-silverlight-4/ should be helpful to understand how to print a datagrid using multi pages. Once you are able to print your data, you can use a PDF printer driver to get PDF documents.
0 Kudos
AnhTruong
Emerging Contributor
Hello ESRI expertise,

Have you ever helped someone else to print out the ArcGIS API dataGrid data with dataPager for Silverlight? I am still searching for any good solution to do it on your forum, but I could not. Thanks.



Hi Dominique,

Thank for your refer to http://www.davidpoll.com. I could not find the seperated codes for only Making Printing Easier in Silverlight 4 project, so I have to download all entire sample codes on Silverlight and Beyond on that website. This is excellent demo. In this example, the datasource is from collection list and is not from database. I also found another Silverlight Print from codePlex which seems simple, but the data source is binding from xml format. Did you have a chance to look in details or did something familiar before? Please give me more hints to modify the data source to apply in my issues. I need to printing the dataGrid data with dataPager via Query No Map example at http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap. Thanks for your time.
0 Kudos
DarinaTchountcheva
Frequent Contributor
Hi Anh,

The easiest thing to do in your case is to convince your users that they don't need a PDF. Just kidding! 😉

About 2 years ago, when printing was a real problem with Silverlight, I did export to PDF to allow users to print the map and the data. My PDF is created on the server though, and the exported data comes directly from the database, and not from the FeatureDataGrid (but it is exactly the same data). 

To do this, I used iTextSharp library (on the sever, not the silverPDF).
When the user queries the data and displays it in the DataGrid, the user has the option to export the data to PDF. At this point, I send all the query parameters back to server, and query the data directly from the database using a stored procedure (I am using an XY table, and can directly use T-SQL, and the data is updated nightly, so it doesn't change), which is then bound to an ASP.Net GridView, which then is rendered to a PDF.

It is probably not the best solution, but the only one could find at the time.
If you can't find an easier way to this, and would like to try it, I will send you some code.

Try convincing your users first. 😄

Good Luck!

P.S. If you can use T-SQL to query your data directly, you could probably use some kind of reporting tool like Crystal Reports or SSRS to produce the PDF. Send the query parameters, produce the report and spit it out as a PDF. I have done this long ago with SSRS and ArcIMS. Just another idea.
0 Kudos
AnhTruong
Emerging Contributor
Hi,

Thank you for your idea inputs. Actually, I don't have any rights to touch on their Oracle database; just using ArcGIS URL services that they provided for display and manipulate information data via Silverlight datagrid. I knew how to export ASP.NET datagrid data to PDF and worked on Crystal Report to PDF before. This is first time I am working on ArcGIS API for Silverlight project. Therefore, I must research the best way to do it. I saw a couple of Silverlight printing but using different datasource. My little experience on both ArcGIS API and Silverlight, so I could not implement another function to make it working on my datagrid data like the one you can see in ArcGIS API for Silverlight sample. If anyone can do it, please help me the solution. Thanks.

Hi Anh,

The easiest thing to do in your case is to convince your users that they don't need a PDF. Just kidding! 😉

About 2 years ago, when printing was a real problem with Silverlight, I did export to PDF to allow users to print the map and the data. My PDF is created on the server though, and the exported data comes directly from the database, and not from the FeatureDataGrid (but it is exactly the same data). 

To do this, I used iTextSharp library (on the sever, not the silverPDF).
When the user queries the data and displays it in the DataGrid, the user has the option to export the data to PDF. At this point, I send all the query parameters back to server, and query the data directly from the database using a stored procedure (I am using an XY table, and can directly use T-SQL, and the data is updated nightly, so it doesn't change), which is then bound to an ASP.Net GridView, which then is rendered to a PDF.

It is probably not the best solution, but the only one could find at the time.
If you can't find an easier way to this, and would like to try it, I will send you some code.

Try convincing your users first. 😄

Good Luck!

P.S. If you can use T-SQL to query your data directly, you could probably use some kind of reporting tool like Crystal Reports or SSRS to produce the PDF. Send the query parameters, produce the report and spit it out as a PDF. I have done this long ago with SSRS and ArcIMS. Just another idea.
0 Kudos