Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
Cómo abrir pdf en una ventana emergente en php

Básicamente, estoy usando el complemento BSK PDF Manager en Wordpress y quiero abrir los archivos PDF en una ventana emergente cuando alguien hace clic en ellos.

 /* 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 answers
Answer question

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); ?>

puedes probar con este codigo

about 4 years ago · Juan Pablo Isaza Report

0

Iría con lo que sugirió @CBroe: actualice su código con target para abrir el enlace (su PDF) en una nueva ventana/pestaña:

 $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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!