> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/core/create/document-creation-api/pdf-metadata.md).

# PDF Metadata

Document metadata - title, author, subject, keywords - belongs to the PDF that PaginateToPDF produces, so it is set through the regular PDFDoc API.

Document metadata - title, author, subject, keywords - is not part of the [content tree](/core/create/document-creation-api/traverse-the-content-tree.md). It belongs to the PDF that `PaginateToPDF` produces, so it is set through the regular `PDFDoc` API rather than through `FlowDocument`.

## Where metadata fits

The content tree describes what the document says; metadata describes what the document is. The order is therefore always the same:

1. Build the content tree on the `FlowDocument`.
2. Call `PaginateToPDF` to get a `PDFDoc`.
3. Set the metadata on that `PDFDoc` through `GetDocInfo`.
4. Save.

Because metadata is applied to the paginated result, none of it affects layout, and setting it costs nothing extra; `PaginateToPDF` has already done the expensive work by that point.

## Set the document info

`PDFDoc.GetDocInfo` returns a `PDFDocInfo` whose setters map onto the standard PDF document information entries.

{% tabs %}
{% tab title="C#" %}
{% code lineNumbers="true" %}

```csharp
using (PDFDoc pdf = doc.PaginateToPDF())
{
    PDFDocInfo info = pdf.GetDocInfo();
    info.SetTitle("Quarterly Revenue Report 2025");
    info.SetAuthor("SYH Supply Co.");
    info.SetSubject("Revenue by region, Q1-Q3");
    info.SetKeywords("revenue, quarterly, report");
    info.SetCreator("Reporting Service 4.2");

    Date created = new Date();
    created.SetCurrentTime();
    info.SetCreationDate(created);

    pdf.Save(output_path + "report.pdf", SDFDoc.SaveOptions.e_linearized);
}
```

{% endcode %}
{% endtab %}

{% tab title="C++" %}
{% code lineNumbers="true" %}

```cpp
PDFDoc pdf = doc.PaginateToPDF();

PDFDocInfo info = pdf.GetDocInfo();
info.SetTitle("Quarterly Revenue Report 2025");
info.SetAuthor("SYH Supply Co.");
info.SetSubject("Revenue by region, Q1-Q3");
info.SetKeywords("revenue, quarterly, report");
info.SetCreator("Reporting Service 4.2");

Date created;
created.SetCurrentTime();
info.SetCreationDate(created);

pdf.Save(output_path + "report.pdf", SDF::SDFDoc::e_linearized, 0);
```

{% endcode %}
{% endtab %}

{% tab title="Go" %}
{% code lineNumbers="true" %}

```go
pdf := doc.PaginateToPDF()

info := pdf.GetDocInfo()
info.SetTitle("Quarterly Revenue Report 2025")
info.SetAuthor("SYH Supply Co.")
info.SetSubject("Revenue by region, Q1-Q3")
info.SetKeywords("revenue, quarterly, report")
info.SetCreator("Reporting Service 4.2")

created := NewDate()
created.SetCurrentTime()
info.SetCreationDate(created)

pdf.Save(outputPath+"report.pdf", uint(SDFDocE_linearized))
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code lineNumbers="true" %}

```java
PDFDoc pdf = doc.paginateToPDF();

PDFDocInfo info = pdf.getDocInfo();
info.setTitle("Quarterly Revenue Report 2025");
info.setAuthor("SYH Supply Co.");
info.setSubject("Revenue by region, Q1-Q3");
info.setKeywords("revenue, quarterly, report");
info.setCreator("Reporting Service 4.2");

Date created = new Date();
created.setCurrentTime();
info.setCreationDate(created);

pdf.save(output_path + "report.pdf", SDFDoc.SaveMode.LINEARIZED, null);
```

{% endcode %}
{% endtab %}

{% tab title="JavaScript" %}
{% code lineNumbers="true" %}

```javascript
const pdf = await doc.paginateToPDF();

const info = await pdf.getDocInfo();
info.setTitle('Quarterly Revenue Report 2025');
info.setAuthor('SYH Supply Co.');
info.setSubject('Revenue by region, Q1-Q3');
info.setKeywords('revenue, quarterly, report');
info.setCreator('Reporting Service 4.2');

const created = await PDFNet.Date.init();
created.setCurrentTime();
info.setCreationDate(created);

await pdf.save(outputPath + 'report.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
```

{% endcode %}
{% endtab %}

{% tab title="Obj-C" %}
{% code lineNumbers="true" %}

```objectivec
PTPDFDoc* pdf = [doc PaginateToPDF];

PTPDFDocInfo* info = [pdf GetDocInfo];
[info SetTitle:@"Quarterly Revenue Report 2025"];
[info SetAuthor:@"SYH Supply Co."];
[info SetSubject:@"Revenue by region, Q1-Q3"];
[info SetKeywords:@"revenue, quarterly, report"];
[info SetCreator:@"Reporting Service 4.2"];

PTDate* created = [[PTDate alloc] init];
[created SetCurrentTime];
[info SetCreationDate:created];

[pdf SaveToFile:[output_path stringByAppendingString:@"report.pdf"]
          flags:e_ptlinearized];
```

{% endcode %}
{% endtab %}

{% tab title="PHP" %}
{% code lineNumbers="true" %}

```php
$pdf = $doc->PaginateToPDF();

$info = $pdf->GetDocInfo();
$info->SetTitle("Quarterly Revenue Report 2025");
$info->SetAuthor("SYH Supply Co.");
$info->SetSubject("Revenue by region, Q1-Q3");
$info->SetKeywords("revenue, quarterly, report");
$info->SetCreator("Reporting Service 4.2");

$created = new Date();
$created->SetCurrentTime();
$info->SetCreationDate($created);

$pdf->Save($output_path."report.pdf", SDFDoc::e_linearized);
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code lineNumbers="true" %}

```python
pdf = doc.PaginateToPDF()

info = pdf.GetDocInfo()
info.SetTitle("Quarterly Revenue Report 2025")
info.SetAuthor("SYH Supply Co.")
info.SetSubject("Revenue by region, Q1-Q3")
info.SetKeywords("revenue, quarterly, report")
info.SetCreator("Reporting Service 4.2")

created = Date()
created.SetCurrentTime()
info.SetCreationDate(created)

pdf.Save(output_path + "report.pdf", SDFDoc.e_linearized)
```

{% endcode %}
{% endtab %}

{% tab title="Ruby" %}
{% code lineNumbers="true" %}

```ruby
pdf = doc.PaginateToPDF()

info = pdf.GetDocInfo()
info.SetTitle("Quarterly Revenue Report 2025")
info.SetAuthor("SYH Supply Co.")
info.SetSubject("Revenue by region, Q1-Q3")
info.SetKeywords("revenue, quarterly, report")
info.SetCreator("Reporting Service 4.2")

created = Date.new()
created.SetCurrentTime()
info.SetCreationDate(created)

pdf.Save($output_path + "report.pdf", SDFDoc::E_linearized)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Available entries

<table data-search="false"><thead><tr><th>Entry</th><th>Meaning</th></tr></thead><tbody><tr><td><code>SetTitle</code></td><td>The document's title.</td></tr><tr><td><code>SetAuthor</code></td><td>The person or organization that created the content.</td></tr><tr><td><code>SetSubject</code></td><td>What the document is about.</td></tr><tr><td><code>SetKeywords</code></td><td>Comma separated keywords, used by search and indexing tools.</td></tr><tr><td><code>SetCreator</code></td><td>The application that produced the original content. This is typically your own application name.</td></tr><tr><td><code>SetProducer</code></td><td>The application that produced the PDF.</td></tr><tr><td><code>SetCreationDate</code></td><td>When the document was created.</td></tr><tr><td><code>SetModDate</code></td><td>When the document was last modified.</td></tr></tbody></table>

Each setter has a matching getter (`GetTitle`, `GetAuthor` and so on), so the metadata of a generated document can be read back or copied from another document.

{% hint style="info" %}
**Info**

`Producer` is filled in by the SDK, and `ModDate` is maintained automatically on save. Set them explicitly only if you need to override that behavior.
{% endhint %}

## Dates

`SetCreationDate` and `SetModDate` take a `Date`. `SetCurrentTime` fills it from the system clock, which covers most generation scenarios. To record a specific timestamp instead, like the reporting period rather than the moment of generation, construct the `Date` with explicit year, month, day, hour, minute and second components.

## Further Reading

[Sections, headers and footers](/core/create/document-creation-api/sections-headers-and-footers.md) for visible page-level information such as titles and page numbers.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/core/create/document-creation-api/pdf-metadata.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
