SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    set window title with headers possible?

    Hi,

    To print an invoice or other document, I let the user click a link that opens a popup window where a php-script generates a pdf-document with the retrieved data from a database. This works fine...
    Now, the (popup-)window title displays the used URL. I can use mod_rewrite to change it so the used script isn't displayed, but I just want to display the same title as in the main website window instead of any URL...
    Could this be achieved with headers? I cannot use <head><title>some title</title></head> due to the pdf-output.

    Thank you for any suggestion!

    Sincerely,

    Ann.

  2. #2
    SitePoint Enthusiast Chunks's Avatar
    Join Date
    May 2002
    Location
    Australia
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you show us some code maybe??

    it might give us a better idea on what your trying to achieve...

    Setting the title tag is no great hardship... its just how you are trying to go about... thats the question

    Regards Chunks

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your reply, Chunks!

    The script in the popup window is based upon the Sitepoint article about generating PDFs with PHP.

    Example:

    PHP Code:
    <?php 
    // create handle for new PDF document 
    $pdf pdf_new(); 

    // open a file 
    pdf_open_file($pdf"philosophy.pdf"); 

    // start a new page (A4) 
    pdf_begin_page($pdf595842); 

    // get and use a font object 
    $arial pdf_findfont($pdf"Arial""host"1); pdf_setfont($pdf$arial10); 

    // print text 
    pdf_show_xy($pdf"There are more things in heaven and earth, Horatio,"50750); pdf_show_xy($pdf"than are dreamt of in your philosophy"50730); 

    // add an image under the text 
    $image pdf_open_image_file($pdf"jpeg""shakespeare.jpg"); pdf_place_image($pdf$image506500.25); 

    // end page 
    pdf_end_page($pdf); 

    // close and save file 
    pdf_close($pdf); 
    ?>
    That's it. The window title is the URL to this script.
    Normally you can set the title with the html title-tag, but in scripts like the one above not, because any other output (like html) than the pdf-output will cause an error in the pdf-output.
    Therefore I thought that such a window title could be set with headers or so?

    Ann.

  4. #4
    ********* Wizard silver trophy Cam's Avatar
    Join Date
    Aug 2002
    Location
    Burpengary, Australia
    Posts
    4,495
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    I get what you're talking about, the window title cannot be set with HTTP header, but an option you may have is to use frames.This way, you can use HTML in the top frame to set the document title and display the PDF in the bottom frame.

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2003
    Location
    l'Europe
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your reply, DJ P@CkMaN!

    I'll give it a try. It sounds very interesting!

    Thanks again,

    Ann.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •