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 6130603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:52:39+00:00 2026-05-23T16:52:39+00:00

Hi people I’m doing an Extjs application and I want to open a pdf

  • 0

Hi people I’m doing an Extjs application and I want to open a pdf with ReportLab when the user click on a button.

My script is:

xtype: 'button',
text: 'Print',
listeners: {
    click: function(evt, comp) {
        Ext.Ajax.request({
            url : 'get_pdf',
            method: 'GET',
            success: function ( result, request ) {
                var pdf = Ext.util.JSON.decode(result.responseText);
                if (pdf.success) {
                    console.log('It's ok'); 
                }
            });
        }
    }

and server side I’ve a django view:

def get_pdf(request):

    # Create the HttpResponse object with the appropriate PDF headers.
    response = HttpResponse(mimetype='application/pdf')
    response['Content-Disposition'] = 'attachment; filename=somefilename.pdf'

    # Create the PDF object, using the response object as its "file."
    p = canvas.Canvas(response)

    # Draw things on the PDF. Here's where the PDF generation happens.
    # See the ReportLab documentation for the full list of functionality.
    p.drawString(100, 100, "Hello world.")

    # Close the PDF object cleanly, and we're done.
    p.showPage()
    p.save()
    return response

When i click on the print button, Extjs give me this error: syntax error (%PDF-1.3
What I’m doing wrong?

  • 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-05-23T16:52:39+00:00Added an answer on May 23, 2026 at 4:52 pm

    I don’t know about about Extjs to give you a full answer, but what I can tell you is that the response text is not JSON, it’s a PDF, hence the reason for the error. What you really want to do is just display result in the browser, i.e. display the content of the HTTP request you initiated. If you want to verify success, check the result’s HTTP head instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

People always advised me that if I am doing some application that should use
Hello people i have this script <a class=clickMe toggle=first>Text 1</a> </br> <div id=first class=text>
people. I have slight problem with GD2 text on image. I have everything working
some people having this problem which is when he push the button I invoke
People please help me i have excel 2010 addin there is one button. i
People I am trying to use the same script for approving a contact to
Edit : People are having a hard time understanding what i want. So here's
Most people say never throw an exception out of a destructor - doing so
People I want to know how to submit form without action attribute shown. Like
People claim the following VB script works for changing network adapter names. However I

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.