• Hi

    The pdf preview works great, however when creating the pdf the stylesheet and images fail to load.

    To pull the stylesheet I’m using

    
    <img src='<?php bloginfo('template_url'); ?>/images/pdf-logo.png' />
    <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/pdf.css" media="screen, print">
    
    and some images created using ACF (ACF data loading fine, again it's the images that aren't)
    
    <?php $attachment_id = get_sub_field('image');
    $size = "pdf-main";
    $image = wp_get_attachment_image_src( $attachment_id, $size );
    ?>
    <img src='<?php echo $image[0]; ?>' />
    

    The text is working great including some complex loops pulling data from various sources and performing scripts on those, it’s just those pesky images and stylesheet letting me down.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter candell

    (@candell)

    Update: I have added

    define(‘DISABLE_PDF_CACHE’, true);
    define(“DOMPDF_ENABLE_REMOTE”, true);

    to wp-config.php with no luck. Tried relative and absolute paths and also using the absolute path on the server with no luck.

    Plugin Author Viljami Kuosmanen

    (@zuige)

    Are you perhaps running in a local environment? Can the server see itself via the domain name you’re using?

    Thread Starter candell

    (@candell)

    I ended up going through every url method, the only thing that worked was

    wp-content/…etc to the image. Abdolute didn’t work, relative didn’t work, server root didn’t work etc

    So now /pdf/ is working however pdf preview doesn’t work as for the preview as all image links are broken.

    It’s on a public access staging site if that helps.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Stylesheet and images not loading pdf view’ is closed to new replies.