When visiting the PDF download link which the original PDF generation
link redirects to, the file path is constructed from a combination of
fixed strings and the strings provided via the query string of the
download URL. The download URL has the form
https://www.example.com/wp-content/plugins/article2pdf/article2pdf_getfile.php?p=xxx&r=yyy&d=zzz
where xxx is a base64 encoded absolute string, xxx is a short hex hash
and zzz is the base64 encoded URL title slug of the post the PDF was
generated from. While the plugin attempts to sanitise these input
parameters to not allow path traversal, this sanitisation is
insufficient and can be fully or partially circumvented depending on
the PHP version the WordPress instance is running on.
In the case of PHP version <5.3 it is possible to read any file the
user the plugin is executed under has read access to by just encoding
the full file path in the parameter “d” and terminating that string
with a null-byte. The parameter “p” must not be empty but can contain
any value. The parameter “r” may be empty but its value is of no
significance. If the user that the script is executed as has write
access to the file or the directory it is stored in, the file will be
deleted after it has been downloaded. If the user has no write access,
an error message may be shown at the end of the file contents
offered which discloses the WordPress instance’s install directory on
the server.
In the case of PHP version >=5.3, null-termination will no longer cut
off the string. As the generated file name ends with a fixed string
“.pdf”, only files with that file ending can be read. The parameter “d”
may be any directory on the server. The parameter “p” needs to contain
8 backspace characters to delete a prepended fixed string from the file
name while the parameter “r” must contain exactly one backspace. The
actual file name (without the “.pdf”) can then be appended to the
backspaces in either parameter “p” or parameter “r”. It is also
possible to have “p” contain one random character and then have 10
backspace characters followed by the actual file name (again,
without the “.pdf”) stored in parameter “r”.
I’ve been using this plugin on a site of mine for a while, but I’ve recently found out that I’m running short on server space. Upon inspection, I found out that the folder where the a2p.tmp.* files are stored (to be served up to the visitor for download) has tens of thousands of files & is taking up multiple GBs of space.
Since a2p.cache.* files are utilized for people downloading the same file, I’m guessing all of these tmp files have been accumulating over time & haven’t been getting purged after they’ve been served up for download (since there would be no reason to keep them, right?).
Any word on whether or not article2pdf can be set up so that the temporary files are deleted after they’re downloaded (or purged on a regular basis)? Or is this just a bug that I’ve encountered?
Any help would be greatly appreciated.
Thank you.
This is a great plugin, but images shown on a network site aren’t included in the PDF. The testsuite shows “FPDF error: Missing or incorrect image file: *absolute path to file*”
My guess is that this is due to the way images are inserted on a multisite installation since it uses a redirect have a friendlier file path. This makes it so the URL to the image doesn’t match with the absolute path. Is there a way that this plugin could pull images via the URL rather than using the absolute path?
]]>I’ve used this excellent plugin and another plugin has been added to the site which is casuing a problem, this plugin uses a shortcode in the RTE of [profile].
When I create my PDF the shortcode renders in the PDF and produces a load of unwanted stuff I can’t seem to remove it.
I tried making a minor adjustment to the code:
I replaced this:
add_filter( ‘the_content’, ‘wrapper_a2p_CreatePdf’, 9999 );
with this:
function remove_shortcode_from_pdf($content) {
$stripped_content = strip_shortcodes($content);
return $stripped_content;
}
$pdf_content = add_filter(‘the_content’, ‘remove_shortcode_from_pdf’);
add_filter( $pdf_content, ‘wrapper_a2p_CreatePdf’, 9999 );
I can’t get rid of this shortcode, any ideas would be greatly appreciate!!
]]>Hi there – thanks for the useful plugin, works just fine with the newest version of WP ?? What I could no figure out, though, is how to create my own PDF template with my logo and my formats – any hints (maybe even in German) ???
Greetings from Cologne – Gabi
]]>Hey, great plugin you did by the way!
I use the w4 post list plugin to show a couple of things in my blog and figured, the a2p wont do a good job if it finds the shortcode in the page.
it should make a pdf out of the post and not out of the last articel in the post.
and the “Print PDF” Link wont show up…
scharc
]]>Hi
I get this error message when setting up the article2pdf options. I”ve changed the permissions on fireftp to 777, but I get this error message.
PDF template file
Enter the absolute path to the directory where the pdf template files were stored. Important: The directory MUST be writeable by the webserver. The last character MUST be a slash.
Hint: After changing this you have to upload a new pdf template file to that directory.
Sorry, the template directory is not writeable. Please chmod the directory to a permission that allows the webserver to write into that directory or upload your templates with FTP.
Try to create this directory on change? (e.g. if your enter something like ‘[…]/wp-content/uploads/pdftemplates’ what is always a good choice!) Yes, do that!
To use a pdf file as template for your generated pdf files, just place the template file in https://dolphinpointsa.co.za/wp-content/plugins/article2pdf/contributed/pdftemplates/ and choose the file from the select box.
Warning: opendir(https://dolphinpointsa.co.za/wp-content/plugins/article2pdf/contributed/pdftemplates/) [function.opendir]: failed to open dir: not implemented in /home/www/dolphinpointsa.co.za/wp-content/plugins/article2pdf/article2pdf.php on line 852
Select different template file to use for converting pages into the pdf format. If you select nothing, the standard template file will be used.
Warning: opendir(https://dolphinpointsa.co.za/wp-content/plugins/article2pdf/contributed/pdftemplates/) [function.opendir]: failed to open dir: not implemented in /home/www/dolphinpointsa.co.za/wp-content/plugins/article2pdf/article2pdf.php on line 871
Hi, sorry to be a noob but I need some help with this:
If you use non standard permalinks (e.g. “/%postname%”), add the link html code PDF Version to your theme. I put the html code into the “single.php” and the “page.php” of my theme and it works fine for me.
Example link: https://my-blog.org/my-category/my-post/?article2pdf=1
Where in the files do we add the link?
]]>The pdf part of the plugin works like a charm. But, I am having a problem with the administrative part. Each time I update the settings, the backslashes in the paths to the templates, cache, and tempcache folders are doubled. And, then doubled again, and so on until it crashes after about five doublings. I have traced the operation and the doubling seems to be happening in the set options or update_options section. Help.
]]>Hi Raufaser,
I’m trying to get this plugin working for me and I think it shows a lot of promise. The main problem is that it used FPDF which doesn’t support unicode. I’m hopeful that your next version of this plugin will support unicode by using UFPDF. See https://acko.net/node/56
I’m, of course, interested if anyone has already hacked article2pdf to use UFPDF for their posts.
Aharon
]]>All looks great, most of it works (I haven’t been able to adjust the location of the pages and I also don’t understand why the PDF makes the pix waaaaayyyy bigger than they are in the post) and the test pdf works perfectly fine.
But…
When I check my site I can’t find the link to actually allow visitors to create the pdf’s… Where is the link? How can I place it?
A mystery…
Anyone any advice?
]]>This plugin doesnt seem to work well with the latest version of WordPress, or maybe it is in convlict to other plugins….?
]]>Hello Marc,
thank you for this wonderful plugin – it does what it promises and seems to be very relyable.
However, I’m having a little trouble with the PDF templates. On my blog I usually have pretty long headlines. These headlines are cut off in my pdf file for no obvious reason instead of continuing in a second row. I have tried different PDF templates, I tried saving an empty pdf as template, I just don’t know what to look for anymore.
Any suggestions?
Thanks again for the great plugin,
MrMister
after last update to latest version of WP 3.01, article2PDF stopped working. All proper directories have permissions set properly.
The test page in the configuration works, but the link from each article with the tag included in the URL does not create a PDF for the article.
]]>