Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Input/LocalInputSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use setasign\Fpdi\Fpdi;
use setasign\Fpdi\PdfParser\PdfParserException;
use setasign\Fpdi\PdfReader\PdfReaderException;
use Throwable;

use function count;
use function in_array;
Expand Down Expand Up @@ -117,6 +118,8 @@ public function __construct()
}
} catch (MindeeUnhandledException) {
error_log("PDF-handling features not available, page count set to null.");
} catch (Throwable $e) {
error_log("Could not open PDF due to exception" . $e->getMessage() . ", setting page count to null.");
}
Comment thread
sebastianMindee marked this conversation as resolved.
}

Expand Down Expand Up @@ -285,7 +288,7 @@ public function fixPdf(): void
* original or not. Needs force_source_text to work.
*/
public function compress(
int $quality = 85,
int $quality = 85,
Comment thread
sebastianMindee marked this conversation as resolved.
?int $maxWidth = null,
?int $maxHeight = null,
bool $forceSourceTextCompression = false,
Expand Down
6 changes: 6 additions & 0 deletions tests/Input/LocalInputSourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ public function testPdfCountPages(): void
self::assertSame(12, $inputObj->pageCount);
}

public function testPdfPageCountNullOnUnsupportedCompression(): void
{
$inputObj = new PathInput(TestingUtilities::getFileTypesDir() . "/pdf/XfaForm.pdf");
self::assertNull($inputObj->pageCount);
}

public function testPdfReconstructOK(): void
{
$inputObj = new PathInput(TestingUtilities::getFileTypesDir() . "/pdf/multipage.pdf");
Expand Down
4 changes: 2 additions & 2 deletions tests/V2/FileOperations/CropFunctional.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ public function testExtractCropsFromImageCorrectly(): void

$file1Info = filesize($this->outputDir . '/crop_001.jpg');
self::assertGreaterThanOrEqual(97000, $file1Info);
self::assertLessThanOrEqual(103000, $file1Info);
self::assertLessThanOrEqual(120000, $file1Info);

$file2Info = filesize($this->outputDir . '/crop_002.jpg');
self::assertGreaterThanOrEqual(97000, $file2Info);
self::assertLessThanOrEqual(103000, $file2Info);
self::assertLessThanOrEqual(120000, $file2Info);
}

public function testExtractCropsFromEachPdfPageCorrectly(): void
Expand Down
Loading