public function startPdfGenerationAction()
{
$document = Document\Printpage::getById(intval($this->getParam("id")));
if (empty($document)) {
throw new \Exception("Document with id " . $this->getParam("id") . " not found.");
}
$document->generatePdf($this->getAllParams());
$this->saveProcessingOptions($document->getId(), $this->getAllParams());
$this->_helper->json(["success" => true]);
}