templateFieldService->extractFields($fileId); return new DataResponse($fields, Http::STATUS_OK); } catch (\Exception) { return new DataResponse(['Unable to extract fields from given file'], Http::STATUS_INTERNAL_SERVER_ERROR); } } /** * @param int $fileId * @param array $fields * @return DataResponse */ #[NoAdminRequired] public function fillFields(int $fileId, array $fields = [], ?string $destination = null, ?string $convert = null): DataResponse { try { $content = $this->templateFieldService->fillFields($fileId, $fields, $destination, $convert); if ($destination === null) { echo $content; die(); } return new DataResponse([], Http::STATUS_OK); } catch (\Exception) { return new DataResponse(['Unable to fill fields into the given file'], Http::STATUS_INTERNAL_SERVER_ERROR); } } }