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

  • Home
  • SEARCH
  • 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 6140981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:11:13+00:00 2026-05-23T18:11:13+00:00

We are generating PDF documents for our customers and serving them with a Servlet.

  • 0

We are generating PDF documents for our customers and serving them with a Servlet.
The following code works with Firefox, Chrome and Opera, but not with any version of IE. The popup window only flashes with IE but nothing happens. However, we can get the file download dialog to show by making a direct request to the servlet from the address bar in IE.
We’ve tried with several ContentTypes (application/download, application/x-download, etc.)

Client side code:

String URL = "/files/pdf?pdfId=" + getPdfId();
Window.open(URL, "_blank", "");

Servlet serving the pdf as byte[]:

byte[] bytes = getFileAsByteArray();
BufferedInputStream in = new BufferedInputStream(new ByteArrayInputStream(bytes));
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
response.setHeader("Content-Disposition", "attachment; filename=document.pdf");
response.setContentType("application/octet-stream");
response.setContentLength(bytes.length);
byte[] buffer = new byte[8192];
for (int length = 0; (length = in.read(buffer)) > 0;) {
    out.write(buffer, 0, length);
}
out.flush();
out.close();

Any thoughts on this?

  • 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-23T18:11:13+00:00Added an answer on May 23, 2026 at 6:11 pm

    Try this:

    Content-Disposition: inline
    

    instead of:

    Content-Disposition: attachment;filename=document.pdf
    

    Try this out, then tell something
    Found that if I use inline then I should NOT use
    filename=document.pdf, this will NOT work in IE.
    (other browsers ignore it)

    You can read it here: http://indiwiz.com/2009/03/11/forcing-http-download/

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

Sidebar

Related Questions

i am writing some code in vb.net that will be generating a pdf file.
I'm trying to generate some LaTeX code which from thereon should generate PDF documents.
I am having an issue with generating pdf documents. My tabulator characters are not
I am generating PDF using iTextSharp.dll, but the problem is that I am not
I've searched a lot but could not solve this problem. I am generating PDF
We are using Itext for generating the PDF's in our web application. The PDF's
I'm generating PDF documents with PDFKit and I'd like to have it not embed
I'm generating a PDF from a Java application. (And works great) the problem is
I generated latex template using perl,and complied with MikTeX, its generating pdf. But I
My application is generating PDF documents using itext#. The files open fine and display

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.