Change the Document Title

By default, PSPDFKit parses documents and extracts the PDF title from the PDF metadata. If there is no metadata or the PDF name equals Untitled, then it’ll fall back to the file name and remove the .pdf file type.

PSPDFKit exposes various metadata keys:

Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public abstract class DocumentMetadata {
    @Nullable
    public abstract String getTitle();

    @Nullable
    public abstract String getAuthor();

    @Nullable
    public abstract String getSubject();

    @Nullable
    public abstract String getKeywords();

    @Nullable
    public abstract String getCreator();

    @Nullable
    public abstract String getProducer();

    @Nullable
    public abstract String getCreationDate();

    @Nullable
    public abstract String getModDate();
}

You can learn more about PDF metadata in the PDF Reference 1.7, Table 317.

Action Bar Changes

By default, PSPDFKit sets the title of the navigation bar to the document title. To avoid this behavior and customize the document title, you’ll have to extend PdfActivity and override the onSetActivityTitle() method.