Create template for just a print

You can add a custom CSS via the customizer (or via code). Chrome can also show you what your site will look like in print mode (see links at the bottom). Something like the following would generate a nice page for printing: @media print{ #custom-header{ background:#fff; } #custom-header > img, a.scrollup, a.scrollup:visited, .wp-travel-related-posts, #footer-widgets{ display:none … Read more

Why are thumbnails not being generated for PDF files?

I found a solution! I hope this helps save some time and frustration for others that might encounter this problem. It turns out that it isn’t WordPress or PHP. After a lot of digging, I came across this discussion by some members of the WordPress Core team: https://core.trac.wordpress.org/ticket/48853. It says that there is some kind … Read more

Create a permalink to a pdf?

You can accomplish the first part using the Quick Page/Post Redirect Plugin. Just set the Request URL to /resume and the Destination URL to /wp-content/uploads/2021/07/Resume-v4.pdf For the second part of your question, you can add a redirect rule to your .htaccess file: Redirect /wp-content/uploads/2021/07/Resume-old.pdf /resume The way you worded your question you actually would set … Read more

Error in pdf generating plugin using FPDF

The problem is that your output_pdf() function is being called too early. You have the function running in the root of the main plugin file, meaning that it runs as soon as the plugin is loaded, and before before WordPress has finished loading. You need to at least hook it to run later, such as … Read more

Empty Pdf file generated with FPDF library in WordPress plugin [closed]

This might not solve the problem, but what you’re currently doing looks unnecessarily convoluted (ajax request, fake link, serve PDF via link click etc.) Why not just a link styled as a button… <a class=”button” href=”<?= admin_url( ‘admin-post.php?action=wpse_212972_pdf’ ) ?>”>Download</a> …and then serve the PDF as a download directly from the server (using WP’s generic … Read more

How to build a PDF repository in WordPress

Right now, the support for tagging media is pretty disappointing. You can add tags or categories to the attachment post type, but you’ll find the UI is unacceptably bad (it’s a text box where you enter terms separated by commas). There’s a plugin Media Tags that is decent though, so you might look into that. … Read more

A link (not in the post) to download a specific PDF file

The pdf is itself an attachment post so in wordpress template hierarchy we can create a template named pdf.php Then you can write following code in it which force download the pdf file. <?php if (have_posts()) : the_post(); $pdf_title = $post->post_title; $pdf_src = get_attached_file($post->ID ); $bytes = filesize( $pdf_src ); header(“Pragma: public”); // required header(“Expires: … Read more