From: Vincent Vanwaelscappel Date: Thu, 7 Aug 2025 13:52:23 +0000 (+0200) Subject: wip #7684 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7cefbaa0b319cebbdc092dba04499b1497f13b58;p=fluidbook_processfarm.git wip #7684 --- diff --git a/app/bin/mount b/app/bin/mount index 5e4bee7..8cfd31d 100755 --- a/app/bin/mount +++ b/app/bin/mount @@ -27,6 +27,13 @@ else sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 -p 7554 -o uid=33 -o gid=33 -o allow_other fluidbook@pdfcache.toolbox.fluidbook.com:/data /application/protected/fluidbookpublication/cache/pdffiles fi +mkdir -p /application/protected/fluidbookpublication/cache/zoomarea +if mountpoint -q "/application/protected/fluidbookpublication/cache/zoomarea"; then + : +else + sshfs -o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 -p 7584 -o uid=33 -o gid=33 -o allow_other fluidbook@zoomareacache.toolbox.fluidbook.com:/data /application/protected/fluidbookpublication/cache/zoomarea +fi + mkdir -p /application/protected/fluidbookpublication/working if mountpoint -q "/application/protected/fluidbookpublication/working"; then : diff --git a/app/process.php b/app/process.php index fe98af1..424621d 100644 --- a/app/process.php +++ b/app/process.php @@ -36,6 +36,8 @@ try { $res = PDFOperations::extractHighlightsData($_POST['pdf'], $_POST['out'], $_POST['mode'], $_POST['ignoreseparators']); } else if ($_POST['operation'] === 'extractmarkdown') { $res = PDFOperations::extractMarkdown($_POST['pdf'], $_POST['out']); + } else if ($_POST['operation'] === 'extractpdfarea') { + $res = PDFOperations::extractArea($_POST['pdf'], $_POST['out'],$_POST['page'], $_POST['area'], $_POST['options']); } else { if (!isset($_POST['pdf'])) { if (isset($_POST['toolbox'])) { diff --git a/app/src/PDFOperations.php b/app/src/PDFOperations.php index 540fcfe..8a433dd 100644 --- a/app/src/PDFOperations.php +++ b/app/src/PDFOperations.php @@ -4,6 +4,7 @@ namespace Fluidbook\Farmer; use Cubist\PDF\CommandLine\FWSTK; use Cubist\PDF\PDFTools; +use Cubist\Util\Graphics\PDF; class PDFOperations { @@ -79,4 +80,11 @@ class PDFOperations return $out; } + public static function extractArea($pdf, $cache, $page, $rect, $options) + { + $out = PDF::extractArea(Buffer::getIn($pdf), $page, $rect, null, $options, $cache); + Buffer::syncOut(); + return $out; + } + } \ No newline at end of file