Export the data from silverlight datagrid to PDF!

3605
16
12-16-2011 03:36 AM
AnhTruong
New 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
DeminHu
New Contributor
What I  did is : downloaded silverPDF.dll,  it worked for me.


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
AnhTruong
New Contributor
My problem is to export the datagrid data with paging to PDF file via Export button. I use the ArcGIS API for Silverlight sample at
http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap to implement an export function. You can click the attached link and is it looking similar that you did before? If so, can you send me the codes that you add in your export function when you use the silverPDF library that worked for you. Thanks in advance.


What I  did is : downloaded silverPDF.dll,  it worked for me.
0 Kudos
DeminHu
New Contributor
What I  did is  as the following, it mighe not a good way, but it really solved my problems.

#1. Create a grid or panel to hold the data:
       <ScrollViewer x:Name="ImageScrollviewer"  Visibility="Collapsed" Width="2" Height="2" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Left" VerticalAlignment="Bottom" VerticalScrollBarVisibility="Auto">
            <Image  x:Name="TestPdf"  /> or <Stackpanel /> or <Grid />  you have to customize here according to the print  page you like         </ScrollViewer>
       Since this  scrollviewer's size is small, they are under some other controls, just set visibility to visble  when you decide to convert to pdf or image. It will not affect your interfacce.

#2.  convert "TestPdf"  :  WriteableBitmap bitmap = new WriteableBitmap(TestPdf, new TranslateTransform()) ......

#3. Use SilverPDF :   PdfDocument pdfDoc = new PdfDocument();
                            ExportToPdf.AddPdfMapPage(bitmap, pdfDoc);
you can add as  many pages on the same pdf doc.

Hope it helps.
0 Kudos
AnhTruong
New Contributor
Hi,

Thanks for your more details. I can add the silverPDF.dll but it generated the error when compiling, so I could not continue any furthers.


What I  did is  as the following, it mighe not a good way, but it really solved my problems.

#1. Create a grid or panel to hold the data:
       <ScrollViewer x:Name="ImageScrollviewer"  Visibility="Collapsed" Width="2" Height="2" HorizontalScrollBarVisibility="Auto" HorizontalAlignment="Left" VerticalAlignment="Bottom" VerticalScrollBarVisibility="Auto">
            <Image  x:Name="TestPdf"  /> or <Stackpanel /> or <Grid />  you have to customize here according to the print  page you like         </ScrollViewer>
       Since this  scrollviewer's size is small, they are under some other controls, just set visibility to visble  when you decide to convert to pdf or image. It will not affect your interfacce.

#2.  convert "TestPdf"  :  WriteableBitmap bitmap = new WriteableBitmap(TestPdf, new TranslateTransform()) ......

#3. Use SilverPDF :   PdfDocument pdfDoc = new PdfDocument();
                            ExportToPdf.AddPdfMapPage(bitmap, pdfDoc);
you can add as  many pages on the same pdf doc.

Hope it helps.
0 Kudos
DeminHu
New Contributor
Actually I used SilverPDF.dll and ESRI print sample together for my work, I can export the map ( cross domain resources, graphics layers) and query result together as PDF, if you like,  I can extract  some code as a  complied sample for you , but probably the size will be too big to post here.
0 Kudos
AnhTruong
New Contributor
I posted my issues couple of week ago to looking for helps from ArcGIS API for Silverlight expertise, but still waiting for detailed solutions. I am newbie to work on ArcGIS API for Silverlight, so I am still learning on ArcGIS. What I need help to export the data in QueryNoMap example(http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap) to PDF and Excel. I could not find any similar codes to get them done. If possible please send the codes to my personal email at avt2K8@gmail.com. I really appreciate it. Thanks for experience sharing.

Actually I used SilverPDF.dll and ESRI print sample together for my work, I can export the map ( cross domain resources, graphics layers) and query result together as PDF, if you like,  I can extract  some code as a  complied sample for you , but probably the size will be too big to post here.
0 Kudos
DeminHu
New Contributor
I will try to extract my code and compile, then email to you, but probably  I can get time to do it tomorrow.

I posted my issues couple of week ago to looking for helps from ArcGIS API for Silverlight expertise, but still waiting for detailed solutions. I am newbie to work on ArcGIS API for Silverlight, so I am still learning on ArcGIS. What I need help to export the data in QueryNoMap example(http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#QueryWithoutMap) to PDF and Excel. I could not find any similar codes to get them done. If possible please send the codes to my personal email at avt2K8@gmail.com. I really appreciate it. Thanks for experience sharing.
0 Kudos
DeminHu
New Contributor
Sorry, I could not get any chance to  extract the code as a sample application for you today, but I put some  code in a zip file, please see if it can give you some clue to work out.

Aggain, I used ESRI print sample and SilverPDF.dll.
0 Kudos
AnhTruong
New Contributor
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.

Sorry, I could not get any chance to  extract the code as a sample application for you today, but I put some  code in a zip file, please see if it can give you some clue to work out.

Again, I used ESRI print sample and SilverPDF.dll.
0 Kudos