Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Nov 15, 2023
1 parent 85462b4 commit a9bb233
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Binary file added docs/tutorials/_images/pdf-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 37 additions & 1 deletion docs/tutorials/accessing-task-using-web-interface.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
🔖 [Table of Contents](../README.md) / [Tutorials](README.md)

# Accessing Task Using Web Interface
# Generating PDF Form

```bash
sudo apt-get install pdflatex
```

```tex
\documentclass{article}
Expand Down Expand Up @@ -74,4 +78,36 @@ create_form = CmdTask(
runner.register(create_form)
```

# Accessing Task Using Web Interface

```
uvicorn==0.24.0.post1
fastapi==0.104.1
```

```python
from fastapi import FastAPI
from fastapi.responses import FileResponse
from _automate.create_form import create_form

import os

CURRENT_DIR = os.path.dirname(__file__)
RESULT_DIR = os.path.join(CURRENT_DIR, 'src/result')

create_form_fn = create_form.to_function(is_async=True)

app = FastAPI()


# Endpoint to send a file as a response
@app.get("/get-file/")
async def get_file(name: str, premi: str):
await create_form_fn(applicant_name=name, applicant_premi=premi)
return FileResponse(f'{RESULT_DIR}/{premi}-{name}.pdf')

```

![](_images/pdf-form.png)

🔖 [Table of Contents](../README.md) / [Tutorials](README.md)

0 comments on commit a9bb233

Please sign in to comment.