DynaPDF.PageStatistics
----------------------

Queries the page statistics.

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

MBS( "DynaPDF.PageStatistics"; PDF; PageIndex ) 

**MBS**( **"DynaPDF.PageStatistics";** /\* Queries the page statistics. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$PageIndex**) /\* The page to check. Range is from one to [DynaPDF.GetPageCount](DynaPDFGetPageCount.md).e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| PageIndex | The page to check. Range is from one to [DynaPDF.GetPageCount](DynaPDFGetPageCount.md). | 1 |

### Result

Returns statistics.

### Description

Queries the page statistics.  
The statistics are returned as one value per line in a multi line text. The order of the values is:   
- Number of patterns used.
- Number of templates
- Number of bezier curves
- Number of path clipping
- Number of path closing
- Number of shading drawings
- Number of images
- Number of lines
- Number of rectangles
- Number of texts
- Length of all texts together
- Number of layers
- Number of font loadings

This function uses the parser interface in DynaPDF and needs a Pro license.  
  
If you have an open page, we close it automatically for you before doing the import.  
### Examples

Query page statistics:

 # start new   
Set Variable \[ $PDF ; Value:MBS ("[DynaPDF.New](DynaPDFNew.md)") \]  
  
\# open PDF   
Set Variable \[ $r ; Value:MBS ("[DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)"; $PDF ; Test::data ) \]   
  
\# import pages   
Set Variable \[ $r ; Value:MBS ("[DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)"; $PDF ) \]  
  
\#if query page statistics   
Set Variable \[ $stat ; Value:MBS ("DynaPDF.PageStatistics"; $PDF ; Test::PageIndex ) \]  
  
\# split values:   
Set Variable \[ $Count ; Value:ValueCount ( $stat ) \]  
Set Variable \[ $PatternCount ; Value:MiddleValues ( $stat ; 1 ; 1 ) \]  
Set Variable \[ $TemplateCount ; Value:MiddleValues ( $stat ; 2 ; 1 ) \]  
Set Variable \[ $BezierCount ; Value:MiddleValues ( $stat ; 3 ; 1 ) \]  
Set Variable \[ $ClipPathCount ; Value:MiddleValues ( $stat ; 4 ; 1 ) \]  
Set Variable \[ $ClosePathCount ; Value:MiddleValues ( $stat ; 5 ; 1 ) \]  
Set Variable \[ $DrawShadingCount ; Value:MiddleValues ( $stat ; 6 ; 1 ) \]  
Set Variable \[ $ImageCount ; Value:MiddleValues ( $stat ; 7 ; 1 ) \]  
Set Variable \[ $LineCount ; Value:MiddleValues ( $stat ; 8 ; 1 ) \]  
Set Variable \[ $RectangleCount ; Value:MiddleValues ( $stat ; 9 ; 1 ) \]  
Set Variable \[ $TextCount ; Value:MiddleValues ( $stat ; 10 ; 1 ) \]  
Set Variable \[ $TextLength ; Value:MiddleValues ( $stat ; 11 ; 1 ) \]  
Set Variable \[ $LayerCount ; Value:MiddleValues ( $stat ; 12 ; 1 ) \]  
Set Variable \[ $FontCount ; Value:MiddleValues ( $stat ; 13 ; 1 ) \]  
  
\# show in text field   
Set Field \[ Test::PageStats ; "PatternCount: " &amp; $PatternCount &amp;   
"TemplateCount: " &amp; $TemplateCount &amp;  
"BezierCount: " &amp; $BezierCount &amp;  
"ClipPathCount: " &amp; $ClipPathCount &amp;  
"ClosePathCount: " &amp; $ClosePathCount &amp;   
"DrawShadingCount: " &amp; $DrawShadingCount &amp;   
"ImageCount: " &amp; $ImageCount &amp;  
"LineCount: " &amp; $LineCount &amp;  
"RectangleCount: " &amp; $RectangleCount &amp;   
"TextCount: " &amp; $TextCount &amp;   
"TextLength: " &amp; $TextLength &amp;   
"LayerCount: " &amp; $LayerCount &amp;   
"FontCount: " &amp; $FontCount \]  
### See also

- [DynaPDF.GetPageCount](DynaPDFGetPageCount.md)
- [DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)
- [DynaPDF.Initialize](DynaPDFInitialize.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)

### Release notes

- **Version 15.2**
    - Fixed a bug in [DynaPDF.PageStatistics](https://www.mbsplugins.eu/DynaPDFPageStatistics.shtml) function, so it works on the last page of the document.

### Example Databases

- [DynaPDF/DynaPDF Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/DynaPDF%20Test.shtml#11ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 15.2pr6](https://www.mbsplugins.de/archive/2025-04-25/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.0pr10](https://www.mbsplugins.de/archive/2012-12-01/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 25th September 2024

  
[DynaPDF.PageLinkEx](DynaPDFPageLinkEx.md) - [DynaPDF.ParseContent](DynaPDFParseContent.md)

[HTML Version](DynaPDFPageStatistics.shtml)