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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:37:21+00:00 2026-06-01T15:37:21+00:00

I receive a Base64 string which is actually the string representation of a PDF

  • 0

I receive a Base64 string which is actually the string representation of a PDF file. I want to write this string with Response.Write, but without converting it back to its binary representation.

I tried this:

var base64string = "...";
Response.Write(base64String);
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Transfer-Encoding", "base64");

The browser does not recognize the content as a base64 encoded PDF file. How can I fix this?

EDIT: this is the response

HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/pdf; charset=utf-8
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Content-Transfer-Encoding: base64
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 11 Apr 2012 11:00:04 GMT
Content-Length: 107304

JVBERi0xLjQKJeLjz9MKMSA... more content here
  • 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-01T15:37:23+00:00Added an answer on June 1, 2026 at 3:37 pm

    Content-Transfer-Encoding is not a valid HTTP header; this is an old header from MIME. It’s HTTP equivalent is Transfer-Encoding which supports the following values:

    • chunked
    • identity
    • gzip
    • compress
    • deflate

    If you have a Base64 encoded PDF document, there isn’t a “from base64” transform in HTTP which will decode this document for you, so you must decode it on your server, prior to putting it in the response body.

    If you want a stream that converts from Base64, you can use a FromBase64Transform into a CryptoStream:

    new CryptoStream(fileStream, new FromBase64Transform(), CryptoStreamMode.Read)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While converting a zip file to base64 encoded string,Which is needed to sent mail
My app receives a PDF as a base64, zLib deflated string in an xml
I am working in Delphi XE2 I am converting base64 byte array to string
I have this app in which I have to receive an image in the
I receive base64 string of an image and use it as source for in
I am trying to receive the url image and post the image into base64
I receive this Run-Time Check Failure upon the return in the following code. I
I receive this message (see image below) when I try to edit in debugging.
I receive a string from a database query, then I remove all HTML tags,
I have a normal pdf file A.pdf , a third party encodes the file

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.