DynaPDF.GetPageCount
--------------------

Queries number of pages in the current PDF.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [3.0](newinversion30.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.GetPageCount"; PDF ) 

**MBS**( **"DynaPDF.GetPageCount";** /\* Queries number of pages in the current PDF. \*/  
**$PDF**) /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |

### Result

Returns page number or error message.

### Description

Queries number of pages in the current PDF.  
Please note that we have DynaPDF.GetPageCount for the current working PDF and the [DynaPDF.GetImportPageCount](DynaPDFGetImportPageCount.md) for the current open import PDF.  
See also [GetPageCount](https://www.monkeybreadsoftware.com/DynaPDF-Manual/GetPageCount.shtml) function in DynaPDF manual.

### Examples

Queries number of pages in current working PDF:

 $PageCount = MBS ( "DynaPDF.GetPageCount"; $PDF )  
Import PDF pages from 2 documents:

 # load PDF from first container   
Set Variable \[$r ; Value: MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; $pdf ; Test::pdf1 ) \]  
  
\# import all pages from first container   
Set Variable \[$destPage ; Value: MBS ( "DynaPDF.GetPageCount"; PDF ) + 1 \]  
Set Variable \[$r ; Value: MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; $pdf ; $destPage ) \]  
  
\# load PDF from second container   
Set Variable \[$r ; Value: MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; $pdf ; Test::pdf2 ) \]  
  
\# import all pages from second container   
Set Variable \[$destPage ; Value: MBS ( "DynaPDF.GetPageCount"; PDF ) + 1 \]  
Set Variable \[$r ; Value: MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; $pdf ; $destPage ) \]  
### See also

- [DynaPDF.GetImageCount](DynaPDFGetImageCount.md)
- [DynaPDF.GetPageMode](DynaPDFGetPageMode.md)
- [DynaPDF.GetPageWidth](DynaPDFGetPageWidth.md)
- [DynaPDF.GetTemplCount](DynaPDFGetTemplCount.md)
- [DynaPDF.PageStatistics](DynaPDFPageStatistics.md)
- [DynaPDF.SetPageCoords](DynaPDFSetPageCoords.md)
- [DynaPDF.SetPageFormat](DynaPDFSetPageFormat.md)
- [DynaPDF.SetPageLayout](DynaPDFSetPageLayout.md)
- [DynaPDF.SetPageMode](DynaPDFSetPageMode.md)
- [DynaPDF.WriteFTextEx](DynaPDFWriteFTextEx.md)

### Example Databases

- [Barcode/Barcodes from Invoices](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcodes%20from%20Invoices.shtml#1ScriptAnchor_)
- [DynaPDF/Batch Preview](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Batch%20Preview.shtml#3ScriptAnchor_)
- [DynaPDF/Book Creation](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Book%20Creation.shtml#3ScriptAnchor_)
- [DynaPDF/Invoice/Invoice](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Invoice/Invoice.shtml#3ScriptAnchor_)
- [DynaPDF/List Annotations](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/List%20Annotations.shtml#2ScriptAnchor_)
- [DynaPDF/List Pages](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/List%20Pages.shtml#4ScriptAnchor_)
- [DynaPDF/Merge PDFs](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Merge%20PDFs.shtml#8ScriptAnchor_)
- [DynaPDF/PDF Crop](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PDF%20Crop.shtml#2ScriptAnchor_)
- [DynaPDF/PDF Library](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/PDF%20Library.shtml#1ScriptAnchor_)
- [DynaPDF/Watermark pages](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Watermark%20pages.shtml#2ScriptAnchor_)

### Blog Entries

- [Make PDF certificates in calculation with DynaPDF](https://www.mbsplugins.de/archive/2026-05-18/Make_PDF_certificates_in_calcu/monkeybreadsoftware_blog_filemaker)
- [DynaPDF Parser for FileMaker](https://www.mbsplugins.de/archive/2024-01-19/DynaPDF_Parser_for_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin Advent calendar: 15 - DynaPDF](https://www.mbsplugins.de/archive/2023-12-15/MBS_Plugin_Advent_calendar_15_/monkeybreadsoftware_blog_filemaker)
- [Merge documents with DynaPDF](https://www.mbsplugins.de/archive/2023-07-06/Merge_documents_with_DynaPDF/monkeybreadsoftware_blog_filemaker)
- [Things you can do with DynaPDF](https://www.mbsplugins.de/archive/2021-07-02/Things_you_can_do_with_DynaPDF/monkeybreadsoftware_blog_filemaker)
- [Example Script for DynaPDF.FindText and DynaPDF.WebLink](https://www.mbsplugins.de/archive/2020-05-04/Example_Script_for_DynaPDFFind/monkeybreadsoftware_blog_filemaker)
- [Introducing DynaPDF to MBS Filemaker Plugin](https://www.mbsplugins.de/archive/2012-11-27/Introducing_DynaPDF_to_MBS_Fil/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2021, Seite 27](https://filemaker-magazin.de/neuigkeit/4158-Appetithappen-FMM_202105)
- [Ausgabe 6/2020, Seite 33](https://filemaker-magazin.de/neuigkeit/4118-Appetithappen-FMM_202006)
- [Ausgabe 2/2019, Seite 27](https://filemaker-magazin.de/neuigkeit/4043-Appetithappen-FMM_201902)

This function checks for a license.

Created 18th August 2014 , last changed 30th April 2025

  
[DynaPDF.GetPageCoords](DynaPDFGetPageCoords.md) - [DynaPDF.GetPageField](DynaPDFGetPageField.md)

[HTML Version](DynaPDFGetPageCount.shtml)