Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9237029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:26:31+00:00 2026-06-18T07:26:31+00:00

Standing on the shoulders of giants, I have successfully cobbled a script using header()

  • 0

Standing on the shoulders of giants, I have successfully cobbled a script using header() to publish pdf documents on my intranet,

My display code:

<?php
require_once "includes/IniFile.php";
include_once "includes/process.php";
$MyData['ini'] = IniFile::getSettings();
foreach ( $_POST as $key => $value )
   { $fn = $key; }
$fn = str_replace("|sp|"," ",$fn);
$fn = str_replace("|dt|",".",$fn);
$ed = explode('!',$fn) ;
$MyData['ini']['pathMask'] = str_replace('|DEPT|', dptdir($ed[1], $MyData['ini'] ['departments']), $MyData['ini']['pathMask']);
$MyData['ini']['pathMask'] = str_replace('|FLDR|', subdir($ed[2], $MyData['ini'] ['folders']), $MyData['ini']['pathMask']);
$fn ='';
$file = $MyData['ini']['pathMask'].$ed[0];
header('Content-type: application/pdf');
header('Content-Disposition: inline; filename="'.$fn.'"');
header('Content-Transfer-Encoding: binary');
header('Content-Length: ' . filesize($file));
@readfile($file);
?>

All works well, but I would like the new page containing the .pdf to have a < title > that corresponds to the document name being published.

Is this possible?

Thanks – Chris.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T07:26:33+00:00Added an answer on June 18, 2026 at 7:26 am

    Instead of throwing out the headers you should render a normal page and embed the PDF in an iframe. In that way you can have your title and the PDF is still inline.

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>My great title for the PDF</title>
    <style type="text/css">
    html, body {
    margin: 0;
    padding: 0;
    border: 0;
    
    height: 100%;
    overflow: hidden;
    }
    iframe {
    width: 100%;
    height: 100%;
    border: 0
    }
    </style>
    </head>
    
    <body>
    
      <iframe src="yourpdfname.pdf"></iframe>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long standing problem: at work we're using mercurial as a DSCM,
We have a long standing bug in our production code. This is essentially a
I have had some long standing code which has worked fine for quite some
Using Xcode. In this code (func is declared in interface), tells subj error, standing
I have some free-standing C++ code (i.e. not a Windows program) that needs to
I have a long standing doubt. Could someone please tell me whether method overloading
I have a long-standing application that I'm normally able to compile equally well from
I have to work with a string standing for a keystroke (for instance A,
Here is my problem. I have a chipmunk's rigid body (a soda can standing
My company has developed a long standing product using MFC in Visual C++ as

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.