SSL certificate verify failed

I have a gift voucher plugin for wordpress that creates a PDF after a user has finished filling in a form and sends it to the users email. This plugin uses the fpdf library to create the pdf. It worked fine before my web hotel installed OpenSSL/1.0.2g. Now I think that the SSL certificate blocks the pdf creation. I'm getting the following error message: PHP Warning: fopen(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed …
Category: Web

Empty Pdf file generated with FPDF library in WordPress plugin

I am currently implementing a pdf export functionality within a wordpress plugin i'm developing but the pdf file generated when i click on export button is empty. To implement the export i use FPDF library Ive put the code which uses FPDF in a function which is executed by the wp_ajax_ action hook. Here is the code: <?php require_once plugin_dir_path( __FILE__ ) . 'fpdf/fpdf.php'; function pdf_pull_wpse_212972() { $pdf = new FPDF('p','mm','a4'); $pdf->SetFont('arial','b',14); $pdf->AddPage(); $pdf->Cell(40,10,'Referrer URL',1,0,'C'); $pdf->Cell(40,10,'User IP Address',1,0,'C'); $pdf->Cell(40,10,'User Agent',1,0,'C'); …
Category: Web

Contact form 7 send product PDF after submit

We are trying to display a cf7 form on woocommerce product pages, where users can submit the form and receive a pdf file related to the product (either as an email file attachment, as a link in the email body or even as a link that opens in a new browser tab). So far we have tried adding the pdf link as a product attribute and returning it with a shortcode, but... shortcodes don't work on CF7 e-mails. Does any …
Category: Web

How to do string attachment with wp_mail

I'm using a gift card plugin for my woocommerce shop and I would like to add a generated pdf file to allow customers to download the gift card as a pdf. The idea is to use TCpdf or Fpdf to generate the pdf and output it as a string. // Close and output PDF document // This method has several options, check the source code documentation for more information. echo $pdf->Output('S'); The problem is to get this file as an …
Category: Web

How to upload PDF from Front-End and post automatically?

I have a medical client and they want to upload and post pdf automatically. So I stumbled upon frontend uploader, which allows users to upload and post an image to a blog post. It does however post with a pdf, but it goes straight to the media library. So a alternative solution I came up with is getting the pdf to jpeg, and then just upload the jpeg along with the blog post.
Category: Web

How do i create a search option for pdf's only

I need help with a search page. We are a circuit court and use the latest version of WordPress for our website (flcourts18.org). We want the public to be able to search our administrative orders, which are all pdf's only from a specific folder where only the admin orders are stored. How do I setup a search page that will only search the pdf's from within a single folder? There are hundred of pdf's. We would like to search by …
Category: Web

Merge PDF files from post custom fields(ACF) into one PDF file and respond back the created PDF file, Wordpress(AJAX Request)

I am using Advanced Custom Fields plugin(free version) for attaching 3 different pdf files to a single post. After displaying a list of posts on a template, with a button click I am making an AJAX Request to get the files of all displayed posts. Since every post has 3 PDF files, I want to merge all these files of all posts to a single PDF file and download that single file. What I did so far : AJAX Request …
Category: Web

Thumbnails not being generated for PDF files

I have installed all the required extensions like ImageMagick, Imagick, and Ghostscript. I used a plugin to test the requirements and everything passed. ImageMagick: Installed Imagick: Installed Ghostscript: Installed WordPress >= 4.7: Installed GPL Ghostscript 9.27 (2019-04-04) But for some reason, WordPress does not generate thumbnails for PDF files while uploading them directly from the media manager or from the post editor. I also tried using the Regenerate Thumbnails plugin but it did not scan for the PDF file. I …
Category: Web

How can I make an attachment page for pdf uploads?

I have an attachment page for post images, so that when I click on the thumbnail (on the front end) it takes the user to the attachment page for that image, how would I do the same for pdf files, so that when I click on the direct link to the pdf on the front end to redirects to the pdf attachment page? <?php if ( wp_attachment_is_image( $post->id ) ) : $att_image = wp_get_attachment_image_src( $post->id, "full"); ?> <center> <p class="full-attachment"> …
Category: Web

Create a pdf from the entries in DB

I have a website containing details of certificates and I want to create pdf files for each certificate using the id. The process I want is: The user enters the id of the certificate and a page should load a pdf file (from the given template). Is there any plugin or other way to accomplish this?
Category: Web

PDF Upload from Input Error

I have a custom plugin that creates an input field under each post, that allows users to upload PDF files. $html .= '<input accept="application/pdf" type="file" id="wp_custom_attachment" name="wp_custom_attachment" value="" size="25">'; I am using wp_upload_bits and wp_insert_attachment to upload the file: if(!empty($_FILES)) { if ( !empty($_FILES['wp_custom_attachment']['name'])) { $uploaded_anexa = wp_upload_bits($_FILES['wp_custom_attachment']['name'], null, file_get_contents($_FILES['wp_custom_attachment']['tmp_name'])); $uploaded_anexa_location = trailingslashit ( $wp_upload_dir['path'] ) . $_FILES['wp_custom_attachment']['name']; $attachment_anexa = array( guid' => trailingslashit ($wp_upload_dir['url']) . basename( $uploaded_anexa_location ), 'post_type' => 'attachment', 'post_mime_type' => $_FILES['wp_custom_attachment']['type'], 'post_title' => preg_replace('/\.[^.]+$/', '', basename( …
Category: Web

How to correctly detect accessing wp-content/uploads?

Not sure if this is a stupid question or not; however, I've been trying to detect when a user accesses a PDF. I want to be able to know how often a user is accessing specific PDF files. I have been playing around with the 'template_redirect' hook, but the below code doesn't seem to be functioning. function detect_access() { $server_request = $_SERVER['REQUEST_URI']; if ( strpos($server_request, '/wp-content/uploads') !== false ) { wp_redirect( home_url('/') ); exit; } } I would really appreciate …
Category: Web

Upload Image with a file URL and show dynamically on Frontend

Please help! I am a newbie on Wordpress. I am looking for a workaround or plugin which can help me upload an Image on the backend (like thorugh WP Frontend Admin plugin. and on the Frontend, it comes out dynamically as clickable thumbnails which directs to the File path upon clicking. something like this website https://www.sofi.life/faithnews/ it is fairly easy to do it through elementor, but I am looking for a dynamic work around so the client can do it …
Category: Web

Custom folder with PDF files (not in WP Library) - Create url for each file

I have a folder mywebsite.com/wp-content/customUploads which contains hundreds of pdf files. At this point the url to see a pdf file is for example: mywebsite.com/wp-content/customUploads/myfile.pdf My goal is to have a url for each PDF file like: mywebsite.com/pdf-files/myfile.pdf So if a user request the above url, the website will load the pdf file. Is there a way to request the url: mywebsite.com/pdf-files/myfile.pdf and this url is translated to the following, so the file could be loaded correctly? mywebsite.com/wp-content/customUploads/myfile.pdf
Category: Web

Permalink for PDF of article

I'm trying to learn if this is possible, and how I might go about implementing it. Our site is a scientific journal, and our published articles follow this permalink structure: http://ehponline.org/<article-slug> i.e. http://ehponline.org/1306796 Every article that we publish has a corresponding PDF that is available for viewing/download. Those PDFs are currently stored outside of the WP Media structure. What I am wondering is if there is a way to have a permalink URL for each article such as this: http://ehponline.org/<article-slug>/pdf …
Category: Web

Error in pdf generating plugin using FPDF

I'm trying to create a plugin using FPDF to create an options page to print custom post types. Here is my code: <?php /* * Plugin Name: RT FPDF Tutorial * Description: A plugin created to demonstrate how to build a PDF document from WordPress posts. * Version: 1.0 */ if ( ! defined( 'ABSPATH' ) ) { exit; } include( 'pdf-helper-functions.php'); $pdf = new PDF_HTML(); if( isset($_POST['generate_posts_pdf'])){ output_pdf(); } add_action( 'admin_menu', 'rt_fpdf_create_admin_menu' ); function rt_fpdf_create_admin_menu() { $hook = add_submenu_page( …
Category: Web

_wp_attachment_metadata is not being added to database when PDF files uploaded

When I upload a JPG or PNG image, a _wp_attachment_metadata value is created in the database, but this is not the case for PDF files. Is this the normal behavior or should the _wp_attachment_metadata be created for PDF files too? I'm asking because there's a plugin I have installed that processes PDF files, and it's saying it's not able to do so due to missing metadata for the PDF files. Here's an example of the difference in my database: There …
Category: Web

How to saving a file to Media Libary by code

I'm building a plugin that works only in admin. I've a page where the user choose some parameters and the script get data from posts and posts meta then it generate a pdf file and then I want to save it or in a specif folder or in the media library adding it to a specific Media Category. My questions is: How can I save by code the generated pdf file to Media Library with a specific Media Category? Regards. …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.