Select to view content in your preferred language

How to convert a query result into a table in PDF file

1462
2
Jump to solution
07-20-2017 02:37 PM
LeiZhou1
Regular Contributor

I created a query and queryTask; run the queryTask and get a result (say featureSet) .

Now I need to convert this object (featureSet) to create a PDF report, make it display as a table, like field A, field B, ... as columns.  I know how to loop the feature to get a value, but have no clue how to put them into a table in PDF.  Is there any hint or sample code how to do this? Thanks a lot! 

0 Kudos
1 Solution

Accepted Solutions
ThomasSolow
Frequent Contributor

You can generate a PDF in the browser using javascript.  There are many third party libraries that can help with this like: GitHub - MrRio/jsPDF: Client-side JavaScript PDF generation for everyone. 

I imagine you could build a table based on arbitrary data in a PDF using that library (or another similar one).  I'm unsure if there's an easier way to do this than basically building the PDF from scratch.

View solution in original post

2 Replies
ThomasSolow
Frequent Contributor

You can generate a PDF in the browser using javascript.  There are many third party libraries that can help with this like: GitHub - MrRio/jsPDF: Client-side JavaScript PDF generation for everyone. 

I imagine you could build a table based on arbitrary data in a PDF using that library (or another similar one).  I'm unsure if there's an easier way to do this than basically building the PDF from scratch.

mattprice
Occasional Contributor

You could also create a geoprocessing tool that takes the data and formats a report in pdf format.