Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/soderlind/wxr2pdf/archive/refs/heads/master.zipwxr2pdf, convert an WordPress Export File to PDF
wxr2pdf is an WP-CLI extension that converts the content of an WordPress Export File to PDF.
Syntax
wp wxr2pdf [parameters]
Parameters
Required, either
filepath to the WordPress Export File.
or
--stdin
Optional
--posttype=<posttype>select post type. If not set,postis used. Separate post types using colon.--language=<country_CODE>loads languages/country_CODE.mo--paper-format=<format>default isA4, alternative isLetter--paper-orientation=<oriantation>default isP(portarit), alternative isL(landscape)--watermark=<text>add watermark to the PDF, enclose in quotes if more than one word.--noimgdon't include images.--nocommentsdon't include comments
Add defaults options to your wp-cli.yml file, eksample:
wxr2pdf:
paper-format: Letter
watermark: "WXR2PDF 2019"
Examples
Export from WordPress using wp export
Convert to PDF, assuming the export is wxr-file.xml or reading from STDIN
wp wxr2pdf wxr-file.xml
wp export --stdout | wp wxr2pdf --stdin --posttype=page
wp wxr2pdf wxr-file.xml --language=nb_NO
wp wxr2pdf wxr-file.xml --noimg
wp wxr2pdf wxr-file.xml --posttype=post:page
wp wxr2pdf wxr-file.xml --nocomments
wp wxr2pdf wxr-file.xml --paper-format=Letter --watermark="WP 2019"
The example PDF is created using wp wxr2pdf --posttype=post --watermark=WXR2PDF wxr2pdf.WordPress.2019-02-26.xml
- Site content from wptest.io
Installation and activation
- In
wp-content/pluginsdogit clone https://github.com/soderlind/wxr2pdf - In
wp-content/plugins/wxr2pdfruncomposer install - Activate the plugin:
wp plugin activate wxr2pdf
FAQ
- What's WXR? The WordPress XML export file uses the WordPress Extended RSS format, also known as WXR.
- Why doesn't the PDF look like my site? wxr2pdf converts only the content, not the design. It tries to remove embedded shortcodes.
- Why aren't any images included in the PDF? The site and it's images must be online and accessible. Also, if images on your site are added using shortcodes, wxr2pdf might not be able to add them.
Roadmap
- Continue refactoring code.
Support piping, e.g., let the user dowp export --stdout | wp wxr2pdf- Convert to wp package
Copyright and License
wxr2pdf is copyright 2019 Per Soderlind
wxr2pdf is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
wxr2pdf is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with the Extension. If not, see http://www.gnu.org/licenses/.