Save and close a PDF session
save_pdfFinalize a PDF creation session by saving accumulated pages to a file. Optionally encrypt with user and owner passwords.
Instructions
Render an open create_pdf session to a PDF file (step 3 of 3, terminal).
Builds a Document from the session's accumulated pages, writes it to output_path (overwriting any existing file), then deletes the session — so the session_id is no longer usable afterwards. Returns JSON {status, path, page_count}, or {error, code} if the session is missing.
Only finalizes sessions created via create_pdf/add_pdf_content. To encrypt an already-saved PDF use secure_pdf; to add annotations use annotate_pdf.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| session_id | Yes | Session id returned by create_pdf to finalize. | |
| output_path | Yes | Destination .pdf path inside the workspace. An existing file at this path is overwritten. | |
| user_password | No | If set together with owner_password, the saved PDF is encrypted; this is the password required to open it. | |
| owner_password | No | Owner/permissions password. Encryption is applied only when both user_password and owner_password are provided. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |