Esri / arcgis-python-api

Documentation and samples for ArcGIS API for Python
https://developers.arcgis.com/python/
Apache License 2.0
1.87k stars 1.1k forks source link

Add support for PDF in Survey123 generate_report #787

Closed DanCranford closed 2 years ago

DanCranford commented 4 years ago

Hey all -

The generate_report function currently supports Word Document (docx) outputs by default.

I was able to output a pdf by modifying the API code as follows

    params = {
        # changed outputFormat from "docx" to "pdf"
        "outputFormat" : "pdf",
        "queryParameters" : where,
        "portalUrl" : survey._si._gis._url,
        "templateItemId" : report_template.id,
        "outputFileName" : "%s_report_%s" % (survey._si.title.replace(" ", "_"), uuid.uuid4().hex[:6]),
        "surveyItemId" : survey._si.id,
        "featureLayerUrl" : survey._ssi.layers[0]._url.replace("_fieldworker", ""),
        "utcOffset" : utc_offset,
        "uploadInfo" : json.dumps(None),
        "f": "json",
        "username": survey._si._gis.users.me.username
    }

It would be awesome if the output format could be added as a parameter that enabled a choice between docx and pdf.

achapkowski commented 4 years ago

@DanCranford I'll add this to the list and try to get it in. Thank you for the suggestion.

BrettFrahm commented 3 years ago

Just wanting to add my voice. Recently needed this for my project and ended up using the REST API to accomplish what I wanted. Generating PDF reports with the Python API would be very helpful. Thanks!

kpmcgurk commented 3 years ago

+1, this would be super helpful.

nanaeaubry commented 2 years ago

This has been added