how to get number of pages in a PDF file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to get number of pages in a PDF file
# 8  
Old 04-20-2009
Quote:
Originally Posted by prvnrk
Can anyone please help me providing script to get the number of pages in a PDF file?
man pdfinfo

Code:
PAGES=$( pdfinfo $FOLDER/$FILE | grep 'Pages' - | awk '{print $2}' )

# 9  
Old 04-21-2009
I´ve found the fpdi php class

Code:
 
<?php
require_once('fpdf16\fpdf.php');
require_once('fpdi13/fpdi.php');

$pdf =& new FPDI();
$pagecount = $pdf->setSourceFile('MyPDFDocument.pdf');
echo "Pagecount = ".$pagecount;

?>

This solves my Problem
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: Page number with total number of pages, EG Page 1 of 5

So I've worked how to add page numbers based on regex. It's using the footer text. How do we get the total amount added so we have page number with the total number of pages? Desired output: Page No:1 of 5 Thanks in advance. (15 Replies)
Discussion started by: tugar
15 Replies

2. Shell Programming and Scripting

Converting secured pdf files to pdf using acroread

Does anybody have idea of Converting secured pdf files to pdf using acroread ? ---------- Post updated at 04:49 PM ---------- Previous update was at 04:44 PM ---------- This file is not password protected. (4 Replies)
Discussion started by: Soham
4 Replies

3. Shell Programming and Scripting

PDF Script to extract PDF Links MOD in Need

In here we have a script to extract all pdf links from a single page.. any idea's in how make this read instead of a page a list of pages.. and extract all pdf links ? #!/bin/bash # NAME: pdflinkextractor # AUTHOR: Glutanimate (http://askubuntu.com/users/81372/), 2013 #... (1 Reply)
Discussion started by: danielldf
1 Replies

4. UNIX for Dummies Questions & Answers

Gs to split a pdf into multiple pages

Hello, Some googling and checking the man pages told me it should be possible to split a pdf (or ps) file into individual pages : man gs You might want to print each page separately. To do this, send the output to a series of files "foo1.xyz, foo2.xyz, ..." using the "-sOut-... (3 Replies)
Discussion started by: jossojjos
3 Replies

5. Shell Programming and Scripting

Need a REGEX to increment the file number of a pdf file

Hello, I have a few thousand .pdf files in various folders each have a naming scheme like this: 006_-_Titled_Document_#34_-_September-25-2011-side-1.pdf In each folder, the number system starts at 001 (as you see on the far left of the file name), and then ends at 999 (maximum .pdf files).... (4 Replies)
Discussion started by: Marcus Aurelius
4 Replies

6. Shell Programming and Scripting

Store and isolate bad pages from a file to new file

I have a file like below . The good pages must have 3 conditions : The pages that containing page total only must have 50 lines. The pages that containing customer total only must have 53 lines. The last page of Customer Total should be the last page. How can I accomplish separating good... (1 Reply)
Discussion started by: ehabaziz2001
1 Replies

7. UNIX for Advanced & Expert Users

creating pdf file with four pages

I have some code in fortran90, example stored in scode.f90 and I want to create a pdf containing the code. I would like to have four pages of code put into each page in the pdf. I was thinking of creating a ps file using mpage and then using ps2pdf after. However, I noticed that ps2pdf shift the... (4 Replies)
Discussion started by: kristinu
4 Replies

8. Shell Programming and Scripting

Perl - Convert html to pdf - PDF::FromHTML

Hi, I am trying to convert html to pdf using perl module PDF::FromHTML, am getting the error as given below. not well-formed (invalid token) at line 2, column 17, byte 56 at C:/Perl/lib/XML/Parser.pm line 187 at C:/Perl/site/lib/PDF/FromHTML.pm line 140 The perl code is as given... (2 Replies)
Discussion started by: DILEEP410
2 Replies

9. Shell Programming and Scripting

[Example] View man pages as pdf

This is a simple example of a shell script. I made it because it's sometimes convenient to search through a manpage and to have access to the terminal while you're reading (maybe to test code). It also serves as a basic example for anyone learning shell scripting. #!/bin/sh nm="/tmp/$1.pdf"... (0 Replies)
Discussion started by: CRGreathouse
0 Replies
Login or Register to Ask a Question