PDFKit.GetPDFAttribute
----------------------

Queries a PDF attribute.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [PDFKit](component_PDFKit.md) | [2.3](newinversion23.md) | ✅ Yes | ❌ No | ❌ No | ✅ Yes, on macOS | ✅ Yes |

MBS( "PDFKit.GetPDFAttribute"; PDF; Key ) 

**MBS**( **"PDFKit.GetPDFAttribute";** /\* Queries a PDF attribute. \*/  
**$PDF**; /\* A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from [PDFKit.Open](PDFKitOpen.md). \*/   
**$Key**) /\* Which information to query. This can be one of the following: Title, Subject, Author, Creator, Producer, Keywords, CreationDate or ModificationDate.e.g. "Title" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | A container value with the PDF content from a media field. Or a text with an URL. Or a PDF reference from [PDFKit.Open](PDFKitOpen.md). |  |
| Key | Which information to query. This can be one of the following: Title, Subject, Author, Creator, Producer, Keywords, CreationDate or ModificationDate. | "Title" |

### Result

Returns the text or date value requested.

### Description

Queries a PDF attribute.   
New keys in v5.4: OwnerPassword, UserPassword, EncryptionKeyLength, AllowsPrinting and AllowsCopying.  
  
| Key | Description |
|---|---|
| Title | The document's title. Optional; if present, the value of this key must be a text. |
| Author | The name of the person who created this document. Optional; if present, the value of this key must be a text. |
| Subject | The subject of a document. Optional; if present, the value of this key must be a text. |
| Keywords | The keywords for this document. This key is optional. Must be the keywords with comma separated. |
| Creator | The name of the application that created the original data used to create this document. Optional; if present, the value of this key must be a text. |
| OwnerPassword | The "owner password" of the PDF document. If this key is specified, the document will be encrypted using the value as the owner password; otherwise, the document will not be encrypted. The value of this key must be a text which can be represented in ASCII encoding; only the first 32 bytes will be used for the password. There is no default value for this key. If the value of this key cannot be represented in ASCII, the document will not be created and the creation function will fail. |
| UserPassword | The "user password" of the PDF document. If the document is encrypted, then the value of this key will be the user password for the document; if unspecified, the user password will be the empty string. The value of this key must be a text which can be represented in ASCII encoding; only the first 32 bytes will be used for the password. If the value of this key cannot be represented in ASCII, the document will not be created and the creation function will fail. |
| EncryptionKeyLength | Specifies the encryption key length in bits; see Table 3.18 "Entries common to all encryption dictionaries", PDF Reference: Adobe PDF version 1.5 (4th ed.) for more info. Optional; if present, the value of this key must be a number with value which is a multiple of 8 between 40 and 128, inclusive. If this key is absent or invalid, the encryption key length defaults to 40 bits. |
| AllowsPrinting | Used to specify whether the document allows printing when unlocked with the user password. The value of this key must be a boolean. The default value of this key is 1 (true). |
| AllowsCopying | Used to specify whether the document allows copying when unlocked with the user password. The value of this key must be a boolean. The default value of this key is 1 (true). |
| CreationDate | The creation date of PDF. |
| ModificationDate | The modification date of PDF. |

  
If you need more control about encryption, restrictions or metadata, you may want to checkout our [DynaPDF](component_DynaPDF.md) functions in the plugin.  
  
Added "json" as key to get all values in the document attributes as JSON.  
### Examples

Get all the information values for a PDF in a container:

 "Title: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "Title") &amp; "¶" &amp;  
"Subject: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "Subject") &amp; "¶" &amp;  
"Author: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "Author") &amp; "¶" &amp;  
"Creator: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "Creator") &amp; "¶" &amp;  
"Producer: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "Producer") &amp; "¶" &amp;  
"Keywords: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "Keywords") &amp; "¶" &amp;  
"CreationDate: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "CreationDate") &amp; "¶" &amp;  
"ModificationDate: " &amp; MBS ("PDFKit.GetPDFAttribute"; combine pdf::test1 ; "ModificationDate")  
Query all values as JSON:

 MBS ( "PDFKit.GetPDFAttribute"; combine pdf::test1 ; "json" )  
<small>  
Example result:   
{ "Author" : "Christian Schmitz" , "Creator" : "Pages" , "CreationDate" : "2011-04-18 13:18:54 +0000" , "Producer" : "Mac OS X 10.6.7 Quartz PDFContext" , "ModDate" : "2011-04-18 13:18:54 +0000" , "Title" : "Ohne Titel" } </small>### See also

- [PDFKit.Open](PDFKitOpen.md)
- [PDFKit.SetPDFAttribute](PDFKitSetPDFAttribute.md)

### Release notes

- **Version 12.4**
    - Added json key for [PDFKit.GetPDFAttribute](https://www.mbsplugins.eu/PDFKitGetPDFAttribute.shtml) function.
- **Version 11.4**
    - Fixed problem in [PDFKit.GetPDFAttribute](https://www.mbsplugins.eu/PDFKitGetPDFAttribute.shtml) returning an error when no keywords are available.

### Example Databases

- [Mac and iOS/PDFKit/Combine PDFs](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/PDFKit/Combine%20PDFs.shtml#1GroupButton252.000000078.0000000277.0000000187.0000000LayoutObjectAnchor_)

### Blog Entries

- [Neues MBS Plugin 12.4 für Claris FileMaker](https://www.mbsplugins.de/archive/2022-09-06/Neues_MBS_Plugin_124_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 12.4 for Claris FileMaker](https://www.mbsplugins.de/archive/2022-09-06/MBS_Plugin_124_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.4pr2](https://www.mbsplugins.de/archive/2022-08-15/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.4pr3](https://www.mbsplugins.de/archive/2021-08-25/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.4pr2](https://www.mbsplugins.de/archive/2015-10-15/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 3.2pr8](https://www.mbsplugins.de/archive/2013-04-20/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 11st August 2022

  
[PDFKit.GetIgnoreCombineErrors](PDFKitGetIgnoreCombineErrors.md) - [PDFKit.GetPDFDocument](PDFKitGetPDFDocument.md)

[HTML Version](PDFKitGetPDFAttribute.shtml)