• Resolved Appaloosa

    (@benoitappaloosa)


    Hi,
    In my template, I’m using a field containing a base64 encoded image for a custom post type. This template works well with your help

    Now, I want the put a base64 image in the pdf and I’m trying a simplistic method in HTML like :

    
    $base64_logo = get_field('logo_annonce');
    if( $base64_logo ):
          $pdf_output .= '<div class="annonce--logo">';
          $pdf_output .= '<img src="data:image/png;base64,'. $base64_logo .' "/>';
          $pdf_output .= '</div>';
    endif;

    Unfortnaly, it doesnt work.
    Maybe, it isn’t possible with FPDF library.
    Any idea.

    • This topic was modified 2 years, 4 months ago by Appaloosa.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author fkrauthan

    (@fkrauthan)

    I believe the mpdf library supports embedded image. Did you make sure that the html was added as expected? You could turn on debugging to check the output HTML that is generated based on your PDF template.

    Thread Starter Appaloosa

    (@benoitappaloosa)

    Thank you for your reply.
    I completely forgot to enable debug.
    I’ll try.

    Thread Starter Appaloosa

    (@benoitappaloosa)

    I found the solution.
    I check the HTML output. As I saw the base64 img in HTML debug, it could only be a CSS issue.
    So, I fixed a width and min-height of the image in template CSS, as :

    .annonce--logo-annonceur {
      display: block;
      width: 300px;
      min-height: 70px;
    }

    @fkrauthan, thank you for your work and this well-developed plugin.

    • This reply was modified 2 years, 4 months ago by Appaloosa.
    Plugin Author fkrauthan

    (@fkrauthan)

    Nice that is great that you where able to fix it.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Base64 image in pdf content’ is closed to new replies.