Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/machv/azf-img2pdf
Azure Function that converts image(s) to PDF document
https://github.com/machv/azf-img2pdf
Last synced: 12 days ago
JSON representation
Azure Function that converts image(s) to PDF document
- Host: GitHub
- URL: https://github.com/machv/azf-img2pdf
- Owner: machv
- Created: 2020-07-09T11:13:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T06:14:11.000Z (over 1 year ago)
- Last Synced: 2024-11-07T23:41:10.425Z (2 months ago)
- Language: C#
- Size: 4.32 MB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Azure Function for converting image(s) to PDF
## Deploy via PowerShell
```
$resourceGroupName = "dev"
$functionAppName = "img2pdf"
$deploymentFile = New-TemporaryFile# Create package
Remove-Item $deploymentFile.FullName
Compress-Archive -Path "./pic2pdf/bin/Release/net6.0/publish/*" -DestinationPath $deploymentFile.FullName# Publish
$functionApp = Get-AzWebApp -ResourceGroupName $resourceGroupName -Name $functionAppName
Publish-AzWebapp -WebApp $functionApp -ArchivePath $deploymentFile# Cleanup
Remove-Item $deploymentFile.FullName
```## Local debugging in Visual Studio
Create a file `local.settings.json` with this content:
```json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"FUNCTIONS_WORKER_RUNTIME": "dotnet",
}
}```
## Storing PDFs in Storage Account
Function `convertUrlsAsBlob` stores output document in Azure Blob storage. In order to authenticate against Storage Account it uses Managed Identity of Azure Function (needs to be enabled!). For local debugging from Visual Studio add these options to `loca.settings.json`:
```json
"AZURE_CLIENT_ID": "3d51c45e-***-32292148f792",
"AZURE_CLIENT_SECRET": "***",
"AZURE_TENANT_ID": "b9202536-***-fd3ea48fbc6a",
```To configure blob storage container to use set `OutputBlobContainerPath` configuration option.
## Sample flow
![Flow](doc/flow.png "Flow")