From b0d7ab03ae7d556a4fb92ad4baf8e6322c4d2025 Mon Sep 17 00:00:00 2001 From: Ruben Van Assche Date: Wed, 29 Apr 2020 10:18:18 +0200 Subject: [PATCH] add usage of Imagick `pingImage` to speedup the page count --- .phpunit.result.cache | 1 + CHANGELOG.md | 4 ++++ src/Pdf.php | 4 +++- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .phpunit.result.cache diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 0000000..03ac44f --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +C:37:"PHPUnit\Runner\DefaultTestResultCache":1164:{a:2:{s:7:"defects";a:0:{}s:5:"times";a:11:{s:98:"Spatie\PdfToImage\Test\PdfTest::it_will_throw_an_exception_when_try_to_convert_a_non_existing_file";d:0.006;s:102:"Spatie\PdfToImage\Test\PdfTest::it_will_throw_an_exception_when_try_to_convert_to_an_invalid_file_type";d:0.144;s:103:"Spatie\PdfToImage\Test\PdfTest::it_will_throw_an_exception_when_passed_an_invalid_page with data set #0";d:0.116;s:103:"Spatie\PdfToImage\Test\PdfTest::it_will_throw_an_exception_when_passed_an_invalid_page with data set #1";d:0.116;s:103:"Spatie\PdfToImage\Test\PdfTest::it_will_throw_an_exception_when_passed_an_invalid_page with data set #2";d:0.117;s:88:"Spatie\PdfToImage\Test\PdfTest::it_will_correctly_return_the_number_of_pages_in_pdf_file";d:0.189;s:76:"Spatie\PdfToImage\Test\PdfTest::it_will_accept_a_custom_specified_resolution";d:0.449;s:64:"Spatie\PdfToImage\Test\PdfTest::it_will_convert_a_specified_page";d:0.503;s:86:"Spatie\PdfToImage\Test\PdfTest::it_will_accept_a_specified_file_type_and_convert_to_it";d:0.414;s:53:"Spatie\PdfToImage\Test\PdfTest::it_can_accept_a_layer";d:0.255;s:63:"Spatie\PdfToImage\Test\PdfTest::it_will_set_compression_quality";d:0.414;}}} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 04aa6f7..f07a5f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to `pdf-to-image` will be documented in this file +## 2.0.1 - 2020-01-08 + +- add usage of Imagick `pingImage` to speedup the page count + ## 2.0.0 - 2020-01-08 - added typehints diff --git a/src/Pdf.php b/src/Pdf.php index 8d42c16..ed4128d 100644 --- a/src/Pdf.php +++ b/src/Pdf.php @@ -35,7 +35,9 @@ public function __construct(string $pdfFile) throw new PdfDoesNotExist("File `{$pdfFile}` does not exist"); } - $this->imagick = new Imagick($pdfFile); + $this->imagick = new Imagick(); + + $this->imagick->pingImage($pdfFile); $this->numberOfPages = $this->imagick->getNumberImages();