Выгода от использования Falcon Space
В 2-3 раза экономнее и быстрее, чем заказная разработка
Более гибкая, чем коробочные решения и облачные сервисы
Используйте готовые решения и изменяйте под свои потребности
Настройка конвертации в PDF генерируемых по шаблону документов docx, xlsx
Если указать в SELECT 1 doc_XXX_getData процедуры генерации документа по шаблону параметр OutputPDF=1, то платформа на основе сгенерированного документа docx, xlsx запустит конвертацию в PDF через установленный на сервере LibreOffice и выдаст ссылку на созданный PDF файл.
Чтобы это работало, необходимо сделать следующее:
- Поместить скрипт ConvertDocument.ps1 Powershell в /wwwroot/app_data/scripts/
- На сервере установить Libre Office
Примечание. Если что-то не работает, то сначала можно попробовать серверное действие на /asapi с такими данными:
Путь: C:/Program Files/PowerShell/7/pwsh.exe
Agruments:
C:\Scripts\ConvertDocument.ps1 -InputFile C:\sites\site1\wwwroot\uploads\doc\invoice.docx -OutputDirectory C:\sites\site1\wwwroot\uploads\doc -LibreOfficeExe "C:\Program Files\LibreOffice\program\soffice.exe"
Также через параметры в /appsettings.json можно менять пути к Powershell и Libre:
- PowershellPath - путь к Powershell (по умолчанию C:/Program Files/PowerShell/7/pwsh.exe).
- LibrePath - путь к Libre Office (по умолчанию C:\Program Files\LibreOffice\program\soffice.exe).
При настройке OutputPDF=1 исходный файл docx удаляется после конвертации в PDF.
Текст скрипта Powershell ConvertDocument.ps1:
[cmdletbinding()]
param(
[Parameter(Mandatory=$true)]$InputFile,
[Parameter(Mandatory=$true)]$OutputDirectory,
[Parameter(Mandatory=$true)]$LibreOfficeExe,
$ConvertTo = "pdf",
$ConvertFrom = "docx"
)
Write-Verbose "Checking if LibreOffice EXE Location exists"
If (!(Test-Path $LibreOfficeExe))
{
Write-Error "LibreOffice EXE location was not found, please specify another location"
}
Write-Verbose "Checking if InputFile exists"
if (!(Test-Path $InputFile))
{
Write-Error "Input file was not found, please speciy another location"
}
Write-Verbose "Checking if OutputDirectory exists"
if (!(Test-Path $OutputDirectory))
{
New-Item -ItemType Directory $Out
}
$File = $InputFile # = Get-ChildItem $InputDirectory -Filter "*.$ConvertFrom"
$Argument = '--headless --convert-to ' + $ConvertTo + ' --outdir "' + $OutputDirectory + '" "' + $File + '"'
Write "Starting convert using Arguments: $Argument"
Start-Process $LibreOfficeExe -ArgumentList $Argument -Wait
Write "$File has been converted"
Google поиск по нашей документации
- Шаг 1. Создать концепт проекта
- Шаг 2. Получить оценку бюджета (КП)
- Шаг 3. Заключить договор
- Шаг 4. Создать совместно техническое задание
- Шаг 5. Поэтапная реализация проекта