0

I was wondering if it is possible to read a file .pdf file from server by providing some input to geoprocessing service (tool that I will publish) and add the PDF file to the WebApp so that WebApp users can access it without going to the server itself.

Edit1: Sorry i couldnt clarify my question better. My aim is to be able to show the pdf open the pdf, without downloading it. If there is a multiple pdf in the path that i am trying to access i would like to show all of them at once.

The input would be the path of the pdf folder for example "C:\Users\XUser\Desktop\pdf_files\road_related" "C:\Users\XUser\Desktop\pdf_files\building_related"

So there will be data on the webapp about this paths and i will be giving one of these two as an input and i want geoprocessing tool to read all those files and show them in webapp without giving a download link at first.

2 Answers 2

2

Geoprocessing services support a File (GPDataFile) input. You could then read the input, and use the AddAttachment geoprocessing call to add the file as an attachment to a feature. You would need some Python to complete the entire process, but it is very doable. The link for AddAttachment includes an example you can start with.

Once you have attachments on a feature, you can view those via the popup, or using an application template like the Attachment Viewer.

6
  • could you look at the edit and tell me if it's possible? I was thinking of reading pdf and converting it to TIFF and adding it to webapp as a output layer. Which way would be better?
    – Fatih Enes
    Aug 22, 2022 at 6:02
  • There are a number of factors you are going to need to consider before overlaying a raster in a webapp from a locally uploaded PDF. The PDF conversion is just one step you'll need to address. Georefencing, serving the raster, and file management are a few others. Going back to the original question if this process can be a Geoprocessing service, it could, but I would question if you're going about the process in the most efficient manner. You're also going to have a lot of challenges interacting the geoprocessing output with your application if you're not custom developing the entire app.
    – evv_gis
    Aug 22, 2022 at 17:19
  • I see, i feel like it is such a tiny door with python and i do not know where to start. I tried to convert all files in the input to .tif and add it as a layer, it works in ArcPro however if i publish it as a geoprocessing service it only provides links to those files and i do not want that. I need to find a easy way to show pdf files online without making user download it, but i am kinda stuck. @evv_gis
    – Fatih Enes
    Aug 22, 2022 at 19:14
  • 1
    I was able to comeup with something, i created a geoprocessing object in server and i connected it to my layer. By doing selection i send the parameter (the path basically) to geoprocessing and there i access the layer's attachments and by using layer.attachments.add i add the attachment. I have created an experience page on the left i have the attachment viewer and on the right i have the map layer, however right now what i need is both of them to work together. If i run the geoprocessing tool it must also make left panel which is the attachment viewer to make the same move or filter.
    – Fatih Enes
    Aug 24, 2022 at 5:47
  • 1
    It would be best if you asked a new question, but since your experience page and embed widget to the Attachment Viewer are separate, it may not be possible to link the two. But I would also look at the documentation and you can even review the source code of the Attachment Viewer to see if something like URL parameters can be used to filter the results: github.com/Esri/attachment-viewer
    – evv_gis
    Aug 24, 2022 at 13:36
1

Your question is a little vague, as it's not clear how you want to return the PDF file to the user. Nor do you explain what the input is.

As you have it written, it sounds like you just want to put the PDF file on a web server and have it accessible as a link to download. You don't require ArcGIS Server or any Esri software for this. It's simply putting the file in a directory that has a web server setup to access.

If for some reason you need ArcGIS Server to "serve" the file, your tool can be as simple as using the Copy (Data Management). Provide the input PDF location and set the output. Once published as a GP Service, the tool will send the file to the app. In the case of Web AppBuilder, make use of the Geoprocessing Service widget. When the service finishes running, the widget will present a link to download the file.

One more assumption: If your users need to provide some sort of input to help the GP Service select 1 of possibly many PDFs, then you'll need to construct a Python script tool. The user will supply some value that makes sense to the service (eg. "File 1"), and the logic in the Python code will translate "File 1" to "this PDF file on the server", and then, using the Copy tool, run and send it to the user.

1
  • i edited the question now, could you please read again and tell me what can be done? thanks.
    – Fatih Enes
    Aug 22, 2022 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.