html headers for a pdf file

Posted on 2006-03-27
Last Modified: 2008-02-26
I have some python cgi that emits a pdf file.  I think I need a few lines of html to start it out.  The idea if for the pdf file to appear on the browser.  Please advise.
Question by:astar666
    LVL 30

    Expert Comment

    <title>My PDF</title>
    <a href="myfile.pdf">My PDF File</a>
    LVL 30

    Expert Comment

    where myfile.pdf is YOUR pdf filename
    LVL 14

    Accepted Solution

    I think what you are looking for is called "HTTP header" and not "HTML header". I'm not familiar with python, but in general the HTTP header required for making the browser understand that the dynamic content it is receiving is a PDF file is :

    Content-type: application/pdf

    You may need to add a semicolon or a \n at the end, perhaps.
    There are times when you need to use Content-Type instead of Content-type. I don't know if this applies to python or not.
    Wish I can help
    LVL 70

    Expert Comment

    by:Jason C. Levine
    Huji has it right.  Depending on how python handles line printing (I assume it handles it the same way as Perl), you will need the newline (\n) in there.  No semi-colon IIRC.
    LVL 14

    Expert Comment

    Glad to be of assistance!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: CSS Specialist

    We don’t have to sell you on the idea of becoming a developer. If you’re you here, you already know it’s one of the most lucrative (and fastest growing) career tracks out there. It’s CSS that allows you to set yourself apart from other web and mobile developers.

    Suggested Solutions

    Title # Comments Views Activity
    HTTP Header Question 10 76
    Problem with table displays 3 35
    Please explain this CSS 5 50
    AngularJS directive issue 6 38
    Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now