Read one page from pdf
Read one page from pdf
Hello!
I need to read a pdf document page by page because it is very large.
Can you please help me with it?
Sorry for such a simple question, I'm new to magick and can't find any good sources about it.
I need to read a pdf document page by page because it is very large.
Can you please help me with it?
Sorry for such a simple question, I'm new to magick and can't find any good sources about it.
Re: Read one page from pdf
Just add [0] to your filename, that reads only the first page of a PDF document (.e.g page.pdf[0]).
Re: Read one page from pdf
Thank you but it seems I don't understand something.
This code does not work. What wrong am I doing?
Code: Select all
std::string documentPath = "doc.pdf[0]";
MagickCore::ImageInfo *imageInfo = MagickCore::CloneImageInfo(0);
documentPath.copy(imageInfo->filename, MaxTextExtent - 1);
imageInfo->filename[documentPath.length()] = 0;
MagickCore::ExceptionInfo exceptionInfo;
MagickCore::GetExceptionInfo(&exceptionInfo);
MagickCore::Image *imagesP = MagickCore::ReadImage(imageInfo, &exceptionInfo);
Re: Read one page from pdf
It works! Thank you very much!
Re: Read one page from pdf
And one more question.
As it seems to me I can read a range of pages adding [0-10] to the filename. But how can I extract single pages from the Image?
As it seems to me I can read a range of pages adding [0-10] to the filename. But how can I extract single pages from the Image?
Re: Read one page from pdf
Append [0] to read the first page, or [1] to read the second, etc.
-
- Posts: 2
- Joined: 2016-10-30T06:16:58-07:00
- Authentication code: 1151
Re: Read one page from pdf
what if that doesn't work? i am getting "unable to read file" message when trying to access a specific page like that on my server:(
what imagemagick verrsion introduced this?
edit: it seems my php imagemagick wrapper doesn't want to read no pdf file, not just a specific page. it seems that gs is located in /usr/bin as it should, i don't know how to debug this
what imagemagick verrsion introduced this?
edit: it seems my php imagemagick wrapper doesn't want to read no pdf file, not just a specific page. it seems that gs is located in /usr/bin as it should, i don't know how to debug this
Re: Read one page from pdf
What command are you using?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Read one page from pdf
Please do not add onto an old post in the future. Please start a new topic. What is your IM version and platform? What is your exact command.
-
- Posts: 2
- Joined: 2016-10-30T06:16:58-07:00
- Authentication code: 1151
Re: Read one page from pdf
'i am sorry, i thought it would be better for google search results (i found this thread by googling my problem)
i am using php wrapper command
i am using php wrapper command
Code: Select all
$imagick = new Imagick();
$imagick->readImage('path_to_pdf/pdf.pdf');
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Read one page from pdf
You won't get much proper help if you do not answer the questions asked above.
Try
To get the first page, use [1] to get the second page, etc.
Try
Code: Select all
$imagick = new Imagick();
$imagick->readImage('path_to_pdf/pdf.pdf[0]');
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Read one page from pdf
The problem is probably that PHP can't find Ghostscript. See many threads on this. The fix is to edit delegates.xml to add the full path to Ghostscript.randomstuff wrote:it seems my php imagemagick wrapper doesn't want to read no pdf file
snibgo's IM pages: im.snibgo.com