When I paste the URL of a PDF to my Facebook page it gives me the first part of the URL as the preview image which is terrible. How can I get it to show a picture of the first page of the PDF instead or at least something that is better to look at?
One idea is to make a script that serves the PDF documents. When Facebook comes to get the preview we check the user agent, and give the facebook preview crawler a JPG or PNG instead of the PDF, but when the user clicks we give them the actual PDF (possibly by redirecting to another site). We could do this using CGI or php, for example. Also we need to create preview pics using pdftoppm or something. If you really need it I could possibly do this for you. This technique could also be used to give custom preview images for any file or page.
I implemented a dodgy prototype for this, as a cgi script written in bash shell (!). It seems to work, but might need to try the link more than once or use the facebook debugger to reload it. Once the preview image for a post is working, it will keep working, I guess.
Example post and comment with PDF links and previews here: https://www.facebook.com/sswam/posts/10207525028737818