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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:20:23+00:00 2026-06-14T17:20:23+00:00

I created a dynamic form site like Google Form, one of the requirements is

  • 0

I created a dynamic form site like Google Form, one of the requirements is that on each survey I could attach a Word file that should be printed after I print the survey form.

So, after I download the file from the database what do I have to do to print it?

Example code:

private void downloadFile()
{
    string item = Request.Form["__EVENTARGUMENT"].ToString();
    SQL sql_files = new SQL(ConnectionStringName.FilesSqlServer);

    sql_files.ExecuteStoreProcedure(SqlStoreProcedureNames.spFileStorage, SqlOutputType.DataReader, new SQLParameter[]{
        new SQLParameter(ParameterDirection.Input, SqlDbType.VarChar, "@IdRespuesta", Session["id_respuesta"].ToString()),
        new SQLParameter(ParameterDirection.Input, SqlDbType.VarChar, "@ItemID", item),
        new SQLParameter(ParameterDirection.Output, SqlDbType.VarChar, "@SpError")
    });

    if (sql_files.Reader.HasRows)
    {
        sql_files.Reader.Read();

        Response.ClearContent();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + sql_files.Reader["name"].ToString());

        Response.ContentType = sql_files.Reader["contenttype"].ToString();
        byte[] fileBytes = (byte[])sql_files.Reader["bytes"];

        Response.AddHeader("Content-Length", fileBytes.Length.ToString());
        Response.BinaryWrite(fileBytes);
        Response.Flush();
        Response.End();
    }
    sql_files.Reader.Close();
}

I use this code to download the file, so I need to change it so I can print a Word document.

Greetings,
Clark

  • 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-14T17:20:24+00:00Added an answer on June 14, 2026 at 5:20 pm

    Your current code downloads a file to a client machine. You cannot control the printing. It all depends on client. Do you actually want to print it on a printer or you mean something different?
    Edit:
    There’s no way to show printing dialog to a user, since it is browser specific.
    One thing you can try is to use --kioskand--kiosk-printing prefixes for Chrome 18+.

    Note that you cannot run any code after Response.End() without causing a request from a user. if you want to run any code after Response.End() you will have to use IFrame or WebHandler.

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

Sidebar

Related Questions

I've created a dynamic HTML form that uses jQuery and customizes the form fields
I would like to add dynamic content to front page of Magento site that
I've got an image upload that is created on a dynamic form. I am
I have created a dynamic form using jQuery that has two sections, once the
I work on a site that generates dynamic images for each specific user. Sometimes
So I have a script that makes dynamic form content and each input has
So I have a script that makes dynamic form content and each input has
I created dynamic web project , and add 2 items : index.jsp page like
I have basic hello word example of Prime Faces. I have created dynamic web
I have created a dynamic list picker script using Jquery 1.3 and PHP that

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.