Results 1 to 30 of 30

Thread: [RESOLVED] count pages of a PDF [Code Ready]

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Resolved [RESOLVED] count pages of a PDF [Code Ready]

    How can I count the number of pages in a pdf document?
    (without using Acrobat SDK if possible)
    Last edited by jain_mj; Jan 9th, 2006 at 05:55 AM.
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: count pages of a PDF

    You might be able to using some other PDF program like CutePDF or PDF995. But other then using some third party program or SDK I dont think its possible? Maybe try printing it to file (.tiff) and reading it back in or womething like that?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: count pages of a PDF

    Give this a try,
    Open the file for binary mode input and count number of /Page tag in the file.

    Edit: I've posted this same reply just a few minutes ago. But my page didn't refreshed due to network problem. If my previous message was moderated, please delete this too.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    I googled for PDF to TIFF converter. couldnt find any free libraries. Can you help?

    If we use SDK, does the user need full Acrobat to run the application? or can he run it with the help of Acrobat reader only?
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  5. #5
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: count pages of a PDF

    Very good answer, iPrank. I was looking at the SDK instead, and also saw that there are COM components for this that don't show you source code.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    If I create the app using SDK 7.0, can the user run it using Acrobat Reader older than 7.0?
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: count pages of a PDF

    Or you can open the pdf in wordpad and see that the fourth line is the "/Pages 2 0 R" which tells you the number of pages for the document but it seems to be off by 2 as far as I can see. It was an 18 page document in acrobat but the tag shows 20? 1 for a header and 1 for a footer or something like that I guess?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: count pages of a PDF

    I think that's something else. I have '25' for a 2 page document here. Damn those Adobers and their proprietary formatting.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    That's nice.
    for a 518 page pdf file opened in wordpad, I saw "/N 518" in 10th line
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: count pages of a PDF

    Are we on different versions of Acrobat? I don't have a /pages 2 or a /n 2 in my PDF file when viewed in wordpad or notepad for that matter.

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: count pages of a PDF

    I tried on other pdfs and getting weird results. A pdf with 5 pages shows /Pages 509. Another doesnt show any at all. Another shows in a different line, etc.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: count pages of a PDF

    I think it would depend upon the version of Acrobat that the document was created with and not the viewer?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    There was no /N for another 29 page PDF. But there is a
    <<
    /Type /Pages
    /Kids [ 5 0 R etc...]
    /Count 29
    >>
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  14. #14
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: count pages of a PDF

    I think this has to do with the version in which the PDFs were created.

    %PDF-1.3

    ^^ might be something.

  15. #15
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: count pages of a PDF

    I guess that /Pages and /Page are completely different things. What does the PDF specification says ?

    I have tried with different page-numbered docs, and all the time, count of /Page tag matches the total pages.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  16. #16

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    Search for /N, /Count depending on version.

    Not a good logic so come back to SDK
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  17. #17
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: count pages of a PDF

    I have tested with PDF v1.2, v1.3, v1.4, v1.5.

    In all versions count of /Page tag is same as the total number of pages.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  18. #18
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: count pages of a PDF

    Quote Originally Posted by jain_mj
    Search for /N, /Count depending on version.

    Not a good logic so come back to SDK
    Yap ! That would be the best choice.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  19. #19

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    from PDF documentation:

    6.3 Pages tree
    The pages of a document are accessible through a tree of nodes known as the Pages
    tree. This tree defines the ordering of the pages in the document.
    To optimize the performance of viewer applications, the Acrobat Distiller program
    and Acrobat PDF Writer construct balanced trees. (For further information on
    balanced trees, see reference [15] in the Bibliography on page 506.) The tree
    structure allows applications to quickly open a document containing thousands of
    pages using only limited memory. Applications should accept any sort of tree
    6: Document Structure March 11, 1999
    72 Adobe Systems Inc.
    structure as long as the nodes of the tree contain the keys described in Table 6.4.
    The simplest structure consists of a single Pages node that references all the page
    objects directly.
    Note The structure of the Pages tree for a document is unrelated to the content of the
    document. In a PDF file for a book, for example, there is no guarantee that a
    chapter is represented by a single node in the Pages tree. Applications that
    consume or produce PDF files are not required to preserve the existing structure of
    the Pages tree.
    The root and all interior nodes of the Pages tree are dictionaries, whose minimum
    contents are shown in Table 6.4.
    Table 6.4 Pages attributes
    Key Type Semantics
    Type name (Required) Object type. Always Pages.
    Kids array (Required) List of indirect references to the immediate children of this Pages node.
    Count integer (Required) Specifies the number of leaf nodes (imageable pages) under this node.
    The leaf nodes do not have to be immediately below this node in the tree, but can
    be several levels deeper in the tree.
    Parent dictionary (Required; must be indirect reference) Pages object that is the immediate ancestor
    of this Pages object. The root Pages object has no Parent.
    The following illustrates the Pages object for a document with three pages.
    Appendix A contains an example showing the Pages tree for a document
    containing 62 pages.
    Example 6.3 Pages tree for a document containing three pages
    2 0 obj
    <<
    /Type /Pages
    /Kids [4 0 R 10 0 R 24 0 R]
    /Count 3
    >>
    endobj
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  20. #20
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: count pages of a PDF

    Seems for version 1.3 that this is the identifing format...

    %PDF-1.3

    /Count 18
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: count pages of a PDF

    That makes sense as it looks like the "/Page" is just an identifier for the start of a new page and the /Parent tag identifies the owner page as when presented in the treeview.

    %PDF-1.3
    1 0 obj
    << /Type /Catalog
    /Pages 2 0 R

    '...

    << /Type /Page
    /Parent 2 0 R
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  22. #22

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    I have tested with PDF v1.2, v1.3, v1.4, v1.5.
    In all versions count of /Page tag is same as the total number of pages.
    if SDK is not easy to use, I will use this method
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  23. #23
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: count pages of a PDF

    Since you do want to avoid the SDK, might as well do this. It'll also save you the hassle of having to include the SDK class libraries when you deploy your application.

  24. #24

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: count pages of a PDF

    I will test "/Page" counting soon. For the time being, [RESOLVED]
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  25. #25

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: [RESOLVED] count pages of a PDF

    Code ready. Please have suggestions for improving the code

    VB Code:
    1. Dim SR As New StreamReader(FileName)
    2. Dim PDFData As String = SR.ReadToEnd
    3. Dim PageCount As Int16 = 0
    4.            
    5.             ''----------------------------------------------------------------------
    6.             ''Slow but Simple method : Good for small files
    7.             ''
    8.             'Dim c As Int16
    9.             'While PDFData.IndexOf("/Type /Page") <> -1
    10.             '    'Should be "/Page" and not "/Pages". So check for "s"  
    11.             '    If PDFData.Substring(PDFData.IndexOf("/Type /Page") + 11, 1) <> "s" Then
    12.             '        c += 1
    13.             '    End If
    14.             '    PDFData = PDFData.Substring(PDFData.IndexOf("/Type /Page") + 11)
    15.             'End While
    16.             'PageCount = c
    17.             ''----------------------------------------------------------------------
    18.  
    19.             ''----------------------------------------------------------------------
    20.             ''Faster but a bit lengthy : Good for large files
    21.             ''
    22.             ''Temp Variables
    23.             Dim TypePagesIndex As Integer
    24.             Dim StartIndex As Integer   'Starting index of the Pages Object
    25.             Dim EndIndex As Integer     'Ending index of the Pages Object
    26.             Dim CountIndex As Int16     'Starting index of "/Count"
    27.             Dim chars() As Char = {"/", ">"}
    28.             Dim tmp As String
    29.             Dim CountEndIndex As Int16  'Index of next "/" after "/Count"
    30.  
    31.             While PDFData.IndexOf("/Type /Pages") <> -1
    32.                 'Get an Object of type 'Pages' from PDF file
    33.                 TypePagesIndex = PDFData.IndexOf("/Type /Pages")
    34.                 tmp = PDFData.Substring(0, TypePagesIndex)
    35.                 StartIndex = tmp.LastIndexOf("<<")
    36.                 tmp = PDFData.Substring(TypePagesIndex)
    37.                 EndIndex = TypePagesIndex + tmp.IndexOf(">>") + 1
    38.                 tmp = PDFData.Substring(StartIndex, EndIndex - StartIndex + 1)
    39.                 'Now tmp="<< /Kids, /Count etc >>"
    40.                 'the pagecount is just after "/Count " in tmp
    41.                 CountIndex = tmp.IndexOf("/Count")
    42.                 CountIndex += 7  'Move index to the end of "/Count "
    43.                 tmp = tmp.Substring(CountIndex)
    44.                 'now tmp="Pagecount ....>>"
    45.                 'Pagecount is followd by a newline like char and then "/" or ">>"
    46.                 CountEndIndex = tmp.IndexOfAny(chars) - 1
    47.                 tmp = tmp.Substring(0, CountEndIndex) 'Get the PageCount
    48.  
    49.                 If PageCount < Val(tmp) Then PageCount = Val(tmp)
    50.                 PDFData = PDFData.Substring(EndIndex + 1)
    51.             End While
    52.             ''----------------------------------------------------------------------
    53. MsgBox("# Pages = " & PageCount)
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  26. #26

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: [RESOLVED] count pages of a PDF

    For complete PDF specification
    http://www.wotsit.org/download.asp?f=pdfspec
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  27. #27

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Cochin, India
    Posts
    350

    Re: [RESOLVED] count pages of a PDF [Code Ready]

    Code edit

    VB Code:
    1. Dim SR As New StreamReader(FileName)
    2.             Dim PDFData As String = SR.ReadToEnd
    3.  
    4.             ''----------------------------------------------------------------------
    5.             ''Slow but Simple method : Good for small files
    6.             ''
    7.             'Dim c As Int16
    8.             'While PDFData.IndexOf("/Type /Page") <> -1
    9.             '    'Should be "/Page" and not "/Pages". So check for "s"  
    10.             '    If PDFData.Substring(PDFData.IndexOf("/Type /Page") + 11, 1) <> "s" Then
    11.             '        c += 1
    12.             '    End If
    13.             '    PDFData = PDFData.Substring(PDFData.IndexOf("/Type /Page") + 11)
    14.             'End While
    15.             'PageCount = c
    16.             ''----------------------------------------------------------------------
    17.  
    18.             ''----------------------------------------------------------------------
    19.             ''Faster but a bit lengthy : Good for large files
    20.             ''
    21.             ''Temp Variables
    22.             Dim TypePagesIndex As Integer
    23.             Dim StartIndex As Integer   'Starting index of the Pages Object
    24.             Dim EndIndex As Integer     'Ending index of the Pages Object
    25.             Dim CountIndex As Int16     'Starting index of "/Count"
    26.             Dim chars() As Char = {"/", ">"}
    27.             Dim tmp As String
    28.             Dim tmpIndex1, tmpIndex2 As Integer
    29.             Dim CountEndIndex As Int16  'Index of next "/" after "/Count"
    30.            
    31.             Do
    32.                 'Get an Object of type 'Pages' from PDF file
    33.                 'It can be "/Type /Pages" or "/Type/Pages"
    34.                 tmpIndex1 = PDFData.IndexOf("/Type /Pages")
    35.                 tmpIndex2 = PDFData.IndexOf("/Type/Pages")
    36.                 'Different possibilities of 2 indices
    37.                 If tmpIndex1 > -1 And tmpIndex1 < tmpIndex2 Then
    38.                     TypePagesIndex = tmpIndex1
    39.                 ElseIf tmpIndex2 > -1 And tmpIndex2 < tmpIndex1 Then
    40.                     TypePagesIndex = tmpIndex2
    41.                 ElseIf tmpIndex1 = -1 And tmpIndex2 > -1 Then
    42.                     TypePagesIndex = tmpIndex2
    43.                 ElseIf tmpIndex2 = -1 And tmpIndex1 > -1 Then
    44.                     TypePagesIndex = tmpIndex1
    45.                 Else  'tmpIndex1 = -1 And tmpIndex2 = -1
    46.                     Exit Do
    47.                 End If
    48.                 tmp = PDFData.Substring(0, TypePagesIndex)
    49.                 StartIndex = tmp.LastIndexOf("<<")
    50.                 tmp = PDFData.Substring(TypePagesIndex)
    51.                 EndIndex = TypePagesIndex + tmp.IndexOf(">>") + 1
    52.                 tmp = PDFData.Substring(StartIndex, EndIndex - StartIndex + 1)
    53.                 'Now tmp="<< /Kids, /Count etc >>"
    54.                 'the pagecount is just after "/Count " in tmp
    55.                 CountIndex = tmp.IndexOf("/Count")
    56.                 CountIndex += 7  'Move index to the end of "/Count "
    57.                 tmp = tmp.Substring(CountIndex)
    58.                 'now tmp="Pagecount ....>>"
    59.                 'Pagecount is followd by a newline like char and then "/" or ">>"
    60.                 CountEndIndex = tmp.IndexOfAny(chars)
    61.                 tmp = tmp.Substring(0, CountEndIndex) 'Get the PageCount
    62.  
    63.                 If PageCount < Val(tmp) Then PageCount = Val(tmp)
    64.                 PDFData = PDFData.Substring(EndIndex + 1)
    65.             Loop
    66.             ''----------------------------------------------------------------------
    67. MsgBox("# Pages = " & PageCount)
    DOK OCK : "The power of .net in the palm of my hand, nothing will stand in my way. Nothing."

  28. #28
    New Member
    Join Date
    Jan 2025
    Posts
    1

    Re: [RESOLVED] count pages of a PDF [Code Ready]

    This PDF page counter saved me so much time. I needed to know the page count for a project, and it worked perfectly. https://pdfwordcounter.io/pdf-page-counter/

  29. #29
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    5,353

    Re: [RESOLVED] count pages of a PDF [Code Ready]

    Your answer is about 19yrs late. lol

    If you have some code you would like to share there is a Code Bank Forum on this site. You should post it there.

  30. #30
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: [RESOLVED] count pages of a PDF [Code Ready]

    Quote Originally Posted by wes4dbt View Post
    Your answer is about 19yrs late. lol
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width