Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong number of pages for native PDF #145

Closed
Dylan-Duault opened this issue Mar 6, 2020 · 11 comments
Closed

Wrong number of pages for native PDF #145

Dylan-Duault opened this issue Mar 6, 2020 · 11 comments

Comments

@Dylan-Duault
Copy link

Hello !

I'm having issues in a production environment with pdf-to-image, the package doesn't detect the good amount of pages in some files.

The issue is very rare, and happens in less than 1% of the time and only with native PDFs

See this issue #71

Thank you,

@Blum
Copy link

Blum commented Apr 9, 2020

Hello,
for me

$pdf->getNumberOfPages()

always returns 1, in 100% of the PDFs I'm trying with.
And also when I try $pdf->setPage(2), I'm getting:

Spatie\PdfToImage\Exceptions\PageDoesNotExist: Page 2 does not exist

The PDF document I'm passing has 15 pages actually.

I could use some clue here..

Thanks

@ShezanZahid
Copy link

Same issue. When using
$pdf->getNumberOfPages()
Always getting number of page 1. No matter what pdf it is 1 page or 30 page it always showing one.
Even i cant use
$pdf->setPage(2)
show page 2 do not exist.

@mohaedismaiel
Copy link

I also have the same problem. How can I do this?

@GuillaumeLeon
Copy link

I have the same problem, anyone figured this out?

@amarruda
Copy link

Hi. The same for me.

@Blum
Copy link

Blum commented May 17, 2020

I ended up using just Imagick();

<?php
$im = new \Imagick();
$im->pingImage('file.pdf');
$pagesCount = $im->getNumberImages();

@vhcraig
Copy link

vhcraig commented May 21, 2020

Hi all,

When installing using composer require spatie/pdf-to-image it appears to default to version v2.x-dev, which is obviously wrong.

To fix this simply specify the version (which you should be doing for production builds anyways) by running the following: composer remove spatie/pdf-to-image && composer require spatie/pdf-to-image:2.0.1

Everything should then function as expected. Hope this helps!

This was referenced May 21, 2020
@amarruda
Copy link

Works for me. Thanks

Hi all,

When installing using composer require spatie/pdf-to-image it appears to default to version v2.x-dev, which is obviously wrong.

To fix this simply specify the version (which you should be doing for production builds anyways) by running the following: composer remove spatie/pdf-to-image && composer require spatie/pdf-to-image:2.0.1

Everything should then function as expected. Hope this helps!

Works for me. Thanks. Just one note: did the changes post on spatie/laravel-medialibrary#1268 (comment)

@ananthakumar841
Copy link

Works for me. Thanks

Hi all,
When installing using composer require spatie/pdf-to-image it appears to default to version v2.x-dev, which is obviously wrong.
To fix this simply specify the version (which you should be doing for production builds anyways) by running the following: composer remove spatie/pdf-to-image && composer require spatie/pdf-to-image:2.0.1
Everything should then function as expected. Hope this helps!

Works for me. Thanks. Just one note: did the changes post on spatie/laravel-medialibrary#1268 (comment)

hi amarruda i try to install composer require spatie/pdf-to-image:2.0.1 i get error spatie/pdf-to-image 2.0.1 requires ext-imagick * -> the requested PHP extension imagick is missing from your system. $pdf->getNumberOfPages()
Always getting number of page

@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

@arunm-zersys
Copy link

@vhcraig it needs Imagick installed, or else it won't work. Installing those in mac is hell of a work .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants