Enhance Flexibility in Filename Generation for PDFs in wkhtmltopdf Module

Created on 12 December 2023, 7 months ago

Problem/Motivation

Currently, the wkhtmltopdf module generates PDF filenames based directly on the URL, which often results in less readable or user-friendly filenames. This can be problematic for users who need to manage multiple PDFs and prefer more descriptive or standardized names.

Steps to reproduce

Install and enable the wkhtmltopdf module.
Generate a PDF using the module.
Observe the generated filename, which is a URL-encoded string.

Proposed resolution

Implement a hook in the wkhtmltopdf module that allows for the alteration of the PDF filename before it's generated. This hook, hook_wkhtmltopdf_pdf_filename_alter(&$filename, $url), would enable other modules or site builders to programmatically set a more meaningful or consistent filename.

Remaining tasks

Implement the proposed hook in the wkhtmltopdf module.
Test the hook to ensure it allows for effective filename alteration.
Document the hook for other developers to use.

User interface changes

No direct user interface changes would occur from this update. The impact is primarily on the generated PDF filenames.

API changes

Introduction of a new hook hook_wkhtmltopdf_pdf_filename_alter(&$filename, $url) in the wkhtmltopdf module. This hook would not break existing functionality but would add an additional layer of customization for developers.

Data model changes

No changes to the data model are required for this enhancement.

✨ Feature request
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡·πŸ‡΄Romania badeadrian

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024