This is a free plugin for Publii, a static website builder, that adds a floating button to your blog posts, allowing users to convert the post content into a downloadable PDF file. The plugin also supports inline formatting (such as bold, italics, and underline) and allows customization of the button's appearance and the PDF formatting.
- Convert Blog Posts to PDF: Adds a floating button to your blog posts, allowing users to convert the content into a downloadable PDF.
- Inline Formatting Support: Supports
<strong>
,<em>
,<u>
, and heading tags (<h1>
,<h2>
, etc.) within the content. - Customizable PDF: Allows customization of the font size, button position, and text formatting.
- A4 Paper Size: The generated PDF is formatted in A4 size.
- Images in PDF: Optionally include images from the blog post with clickable links to the original image.
- Responsive: The button's position is customizable (left or right) and works on all screen sizes.
- Download the Plugin: You can download the plugin from the releases section of this repository.
- Install in Publii:
- Go to your Publii Plugins admin panel.
- Click on the "Install Plugin" button and upload the plugin's
.zip
file.
- Activate the Plugin: Once the plugin is uploaded, activate it in the Publii Tools & Plugins panel.
- Configure the Plugin: Customize the settings (button position, font size, etc.) via the plugin's configuration page in Publii.
The plugin offers the following configuration options:
- Button Text: Customize the text that appears on the button (e.g., "Convert to PDF").
- PDF Button Position: Choose whether the PDF button should appear on the left or right side of the screen.
- Title Font Size: Adjust the font size for the post title in the PDF.
- Content Font Size: Adjust the font size for the content in the PDF.
- Include Images: Toggle whether images in the blog post should be included in the PDF.
- Button Appearance: Customize the background and text color of the close button.
After installation and configuration, a floating button will appear on each blog post. When clicked, it will generate a PDF document with the following:
- Post Title: The title of the blog post will be displayed at the top of the PDF.
- Post Content: The content of the blog post will be included with any inline formatting (bold, italics, etc.) preserved.
- Images: If enabled, images will be included as clickable links to the original image source.
This plugin is licensed under the Boost Software License 1.0.
This project was inspired by the work of htejera, who developed a similar plugin using the jsPDF
library. Their approach helped me understand how to implement PDF generation, which I then applied in this plugin.
- Fork the repository: Click the "Fork" button in the top-right corner of this page to make a copy of the repository.
- Create a new branch: Create a new branch for your changes (e.g.,
feature/my-new-feature
). - Make your changes: Implement the new features or bug fixes.
- Submit a pull request: After testing your changes, submit a pull request to the main repository.
If you encounter any issues with the plugin or need help with configuration, feel free to create a new issue in the Issues section of this repository. We are happy to help!