Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
How to open pdf in a popup in php

Basically I am using BSK PDF Manager Plugin in Wordpress and want to open the the pdfs in a popup when someone click them.

 
 /* This is the href code of the plugin and what I tried to open 
 
$pdf_title_str = '<a href="'.esc_url($file_url).'"'.esc_attr($open_target_str.$nofollow_tag_str).'  title="'.esc_attr($pdf_item_obj_title).'" class="bsk-pdfm-pdf-link-for-title pdf-id-'.esc_attr($pdf_item_obj->id).'">'.$pdf_title_str.'</a>';

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

<?php

$filePath = 'file/example.pdf';

if (!file_exists($filePath)) {
    echo "The file $filePath does not exist";
    die();
}

$filename="example.pdf";
header('Content-type:application/pdf');
header('Content-disposition: inline; filename="'.$filename.'"');
header('content-Transfer-Encoding:binary');
header('Accept-Ranges:bytes');

readfile($filePath);
?>

you can try with this code

about 4 years ago · Juan Pablo Isaza Denunciar

0

I would go with what @CBroe suggested: update your code with target to open the link (your PDF) in a new window/tab:

$pdf_title_str = '<a target="_blank" href="' . esc_url($file_url) . '"' . esc_attr($open_target_str . $nofollow_tag_str) . '  title="' . esc_attr($pdf_item_obj_title) . '" class="bsk-pdfm-pdf-link-for-title pdf-id-' . esc_attr($pdf_item_obj->id) . '">' . $pdf_title_str . '</a>';
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda