473,586 Members | 2,695 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to print the pdf file using binarywrite method in asp?

how can i print the pdf file using binarywrite method in asp.i can print the text file using Response.binary write method but i cnat print the pdf files
Nov 3 '10 #1
2 8907
jhardman
3,406 Recognized Expert Specialist
in the asp insights section there is an article on saving files from uploads, that has everything you will need.

Jared
Nov 3 '10 #2
AdobeGuru
1 New Member
You'll need to set Response.Conten tType to "applicatio n/pdf".

You may also need to supply a dummy filename and set the "content-disposition" header to "attachment ", or "inline", depending on the desired behavior...

Expand|Select|Wrap|Line Numbers
  1. <%@ Import Namespace="WebSupergoo.ABCpdf7" %>
  2. <%
  3. Doc theDoc = new Doc();
  4. theDoc.FontSize = 96;
  5. theDoc.AddText("Hello World");
  6. byte[] theData = theDoc.GetData();
  7. theDoc.Clear();
  8.  
  9. Response.ContentType = "application/pdf";
  10. Response.AddHeader("content-length", theData.Length.ToString());
  11. Response.AddHeader("content-disposition", "attachment; filename=ExampleSite.pdf");
  12. Response.BinaryWrite(theData);
  13. Response.End();
  14. %>
  15.  
The above ASP example is written in CSharp and makes use of the ABCpdf.NET component. I've done this to show how easy it can be to generate a PDF dynamically from within ASP (although any other PDF component should do). Otherwise, trying to manually construct a PDF from scratch is really hard work.

A few PDF components...
Nov 11 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5794
by: CD | last post by:
Hi, I am getting a problem using the following piece of code: Dim strfile As Object Set strfile = FSO.OpenTextFile(stFilePath, 1) Do While Not strfile.AtEndOfStream strtext = strfile.ReadLine Loop
6
4904
by: Alec MacLean | last post by:
Hi, I've created a small application for our company extranet (staff bulletins) that outputs a list of links to PDF's that are stored in a SQL table. The user clicks a link and the PDF is loaded into a new browser window. This works as expected on the test PC (using forms authentication, but no SSL) using IE. It also works as expected...
2
3399
by: asenthil | last post by:
Hai... i'm triying to open a file in read mode using the following method.. HFILE hFile; hFile=OpenFile("D:\ss.doc",lpReOpenBuff,OF_READ); i cant undestand what is the 2nd parameter is... the syntax for openfile is
2
3995
by: =?Utf-8?B?am9obmFicmFoYW0xMDE=?= | last post by:
hello, I'm trying to write a some text to a text file using WriteAllText method. This method works fine but I don't understand how can I use format specifiers to format the text as we use in C i.e "\n" for newline, "\t" for tab,...etc. bye
0
1319
by: 2pt2mill | last post by:
I have been using SharpZipLib for over a year with no problems, but it doesn't support files zipped using compression method 6 (Imploding). This seems to be an older method of compression utilized by PKZIP. Are there other available options anyone knows of to handle these types of decompressions programatically? Thanks in advance
0
1847
Fary4u
by: Fary4u | last post by:
Hi Guys i'm trying to upload a file, i've tried 3 different methods but still not work out i don't know how to over come this problem hidden file value, multiple form or popup uploading. 1- <SCRIPT TYPE="text/javascript"> function popupform(myform, windowname)
0
1244
by: newUser1234 | last post by:
I'm trying to read and write from an excel file using this method..My application can read the excel file without problems but doesn't write anything to the file i want it to write. I've also tried adding a '.Value' to the end, it doesn't seem to help. I have closed the file in the end as well.. Any Suggestions would be very helpful ...
0
1214
by: Christian Heimes | last post by:
dudeja.rajat@gmail.com wrote: Try %% :) Christian
1
1767
by: raghudr | last post by:
Hi all, I am parsing an .xml file.My main intention is to retrieve the field value:- "Name Value" which is "rag" and store it in a List. Fot that i wrote code like this: //i am using dataset method to read the .xml files
0
904
by: mraja1977 | last post by:
Hi All, I am writting/opening different types file data to the browser by using following code in c#. for all type of files there wont be any problem, but in case of html file, when i tries to open the content, its opening in the same internet explorer, i need to open it in the different window. Response.Clear()...
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6606
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.