Submit cf7 form to cfdb as pdf/BLOB [closed]

What I have learned is that the screen shot method is not really possible. So what I have done is used a method prescribed here using FPDF:
https://wordpress.org/support/topic/convert-pdf-file

The last post is most instructive. The problem with this method is that it is not conditional regarding the form and so some if statements needed to be added for that. Also I am using the CF7 Signature add on and so needed a method for handling that image. I have also included a method for translating the PDF into a BLOB and importing it into the DFDB database:

function wpcf7_update_email_body($contact_form) {

        if ( $contact_form->id == 77 ) { //Number of the page for the form you are sending a PDF on.
        $submission = WPCF7_Submission::get_instance();
        if ( $submission ) {
            /* DEFINE CONSTANT AND GET FPDF CLASSES */
            define ('FPDF_PATH',get_template_directory().'/fpdf/'); // MAKE SURE THIS POINTS TO THE DIRECTORY IN YOUR THEME FOLDER THAT HAS FPDF.PHP
            require(FPDF_PATH.'fpdf.php');

            $posted_data = $submission->get_posted_data();
            // SAVE FORM FIELD DATA AS VARIABLES
            $name = $posted_data["your-name"];
            $email = $posted_data["your-email"];
            $subject = $posted_data["your-subject"];
            $message = $posted_data["your-message"];
            $signature = $posted_data["signature-113"];

            $pdf = new FPDF();
            $pdf->AddPage();
            $pdf->SetFont('Arial','B',16);
            $pdf->Write(5,$name . "\n\n" . $email . "\n\n" . $subject . "\n\n" . $message . "\n\n");
            $pdf->Image($signature,60,30,90,0,'PNG');  // The signiture file image
            $pdf->Output(FPDF_PATH.'test.pdf', 'F'); // OUTPUT THE NEW PDF INTO THE SAME DIRECTORY DEFINED ABOVE
        }
    }   
}
add_action('wpcf7_before_send_mail', 'wpcf7_update_email_body');


function mycustom_wpcf7_mail_components($components = null, $form = null){
    global $wpdb;
    $current_user = wp_get_current_user();
    $username = $current_user->user_login;
    $file_id = array_sum(explode(' ', microtime()));        

    if ($form->id == 77) {  //Number of the CF7 form (not the page id) you are sending a PDF on.

        $form_id = $form->id;
        $post = get_post($form_id);
        $formtitle = $post->post_title;
        $ip = getenv("REMOTE_ADDR");

        if (empty($components['attachments'])) {
        $filename="test.pdf";  // the full name and extention of the file as in the $pdf->Output variable above
        $filepath = FPDF_PATH .$filename;
        $components['attachments'] = $filepath; // ATTACH THE NEW PDF THAT WAS SAVED ABOVE  

        // Insert file into CFDB -- Get file contents.
        $tmpfile = fopen($filepath, "r");
        $contents = fread($tmpfile, filesize($filepath));

        // Insert the rows into CFDB.
        $wpdb->insert(wp_cf7dbplugin_submits, array(
            'submit_time'   => $file_id,
            'form_name'     => $formtitle,
            'field_name'    => '', // Optional description
            'field_value'   => $filename,
            'field_order'   => 0,
            'file'          => $contents, //the binary contents of the file
        ), array('%f', '%s', '%s', '%s',  '%d', '%s'));

        $wpdb->insert(wp_cf7dbplugin_submits, array(
            'submit_time'   => $file_id,
            'form_name'     => $formtitle,
            'field_name'    => 'Submitted Login', 
            'field_value'   => $username,
            'field_order'   => 9999,
            'file'          => NULL, 
        ), array('%f', '%s', '%s', '%s',  '%d', '%s'));

        $wpdb->insert(wp_cf7dbplugin_submits, array(
            'submit_time'   => $file_id,
            'form_name'     => $formtitle,
            'field_name'    => 'Submitted From', 
            'field_value'   => $ip,
            'field_order'   => 10000,
            'file'          => NULL,
        ), array('%f', '%s', '%s', '%s',  '%d', '%s'));     

        }
        return $components;
    } else {
        return $components;
    }
}
add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components',10,3 );

This all works great. Formatting and so forth is all explained in the FPDF website.