I defined 2 filters in my theme’s functions.php
//PDF - GENERATION FILTERS
function wp_post_to_pdf_content_prepend($content, $post_id){
$post = get_post($post_id);
$new_content = ....;
// -- FOR TYPES & VIEWS
// $new_content = types_render_field('price', array()); //get price custom field for $post
return $new_content . $content;
}
function wp_post_to_pdf_content_append($content, $post_id){
$post = get_post($post_id);
$new_content = ...
return $content . $new_content;
}
add_filter( 'wp_post_to_pdf_content_prepend', 'wp_post_to_pdf_content_prepend', 10, 2);
add_filter( 'wp_post_to_pdf_content_append', 'wp_post_to_pdf_content_append', 10, 2);
I added following code in generate_pdf_file($id, $forceDownload = false)
function of wp-post-to-pdf.php
file before calling of $pdf->SetCreator
$post->post_content = apply_filters('wp_post_to_pdf_content_prepend', $post->post_content, $post->ID);
$post->post_content = apply_filters('wp_post_to_pdf_content_append', $post->post_content, $post->ID);
Let me know if it works for you or any better way you know.
Thanks