stream varbinary PDF file from SQL 2005 to browser using ASP - sql

I have a commercial program that stores PDF files to SQL 2005. I would like to be able to search for (I have that part) and then display the PDF file in a browser. It's the 'display the PDF file' that I'm having trouble with. I am using HTTP/ASP and would prefer to continue that way. I don't know anything about ASP.NET, so that would not be helpful to me. Any help would be appreciated. Thanks.

The best option here is to implement a HttpHandler that fetches the binary data from your database and outputs it to the response stream. This is the most efficient method available in ASP.Net.
There are many questions about HttpHandlers on SO, so implementing one should be easy: https://stackoverflow.com/questions/tagged/httphandler
One thing you should be aware of is that you should set the correct content type so that the browser recognices the pdf document.

Related

what format is most reliable for saving a history file from an application?

Good Afternoon,
I am in the process of developing in vb.net a simple “cheque printing” application which will allow users to fill in a few text boxes with the values that will be printed on a cheque.
When they hit the print button, the values will be sent to the printer, but I also want the values they input in the text boxes saved to a file, so like a history file of all the cheques that were created.
I am thinking to use either an access database or an excel spreadsheet as my history file, but I am not quite sure on which would be best.
Please note that in my environment storing this information in a SQL database is not an option and also this file will most likely be stored/accessed from the network.
The history file needs to be:
1.Stable (cannot corrupt easy)
2.Reliable
3.Easily exportable in case we need to export the information to one of our in-house systems.
4.editable from the application I am developing
Kindly advise,
A
XML. Save the data to DataTable object and then use the .WriteXML method to save it as an xml file. I'd advise creating a strongly-typed DataTable class for this, so that the XML can be exported with a reliable schema and imported easily.
If you are using different fonts, you could use a .rtf (rich text format) which will save the format of the text that you send to print... it is a universal file format, you can open it with open office, ms office, or any office suite you have...
Access will be best choice,
it's relational database and can make a form from this file to do what are you looking for without VB or any code.
Also you can access this file from network.
for more detail about setting for this file go to this link
http://goo.gl/bOfGp6
and you will find more options complete your work.
I would use a MySQL server. It's free.
XML is also good, but I hate sharing folders...

Get the duration of T-SQL VARBINARY audio in SQL or VB.Net

I've found solutions to determine the length of an audio file using WMPLib.WindowsMediaPlayer (which seems quite ugly), by using a physical file path, but nothing to determine the duration of an audio file stored in a VARBINARY field (SQL Server 2008 R2).
I'm using .Net WebForms. Maybe it'd be a better idea to do this client side with jQuery, but what if I only want to expose some controls to the web browser based off of the duration?
follow these links to implement your functionality:
you can implement these in your vb.net code not in tsql. May be possible using CLR UDF/stored procedures in sql server, but not confirm about this.
just read files from database and get the information about the media as here are the links to read the meta information of MP3 files etc.
hope you will get some idea from these ..
http://www.developerfusion.com/code/4684/read-mp3-tag-information-id3v1-and-id3v2/
http://www.codeproject.com/KB/audio-video/mpegaudioinfo.aspx
http://rongchaua.net/blog/c-how-to-read-mp3-header/
http://www.developerfusion.com/code/4684/read-mp3-tag-information-id3v1-and-id3v2/

How can we create a PDF based on SQL data?

i just wondered if any users could advise me what to google for, as im wanting to create a pdf after a user has submitted a vbscript form.
The form contains data which goes into a MYSQL database and once the user has submitted i would like to use the data to create a PDF.
I would probably be calling this from the vbscript, so i wondered how can i create the PDF from vbscript? Would i have to make an external call to some other program/website or something? Do we need Adobe Acrobat Professional and could it be installed on our server to allow us to systematically create PDFs on the fly?
You are looking for a PDF com component.
There are many of these around - anything that works with classic ASP will work.
This is one I used int the past - AspPDF.
we also use PDFCreator which is installed on the server and works like a printer. The output is a PDF.

Questions about Sql Server 2008 FullText Search

I'm using Sql Server 2008 FullText Search for a project. I need to be able to search PDf files, and I had some questions relating to that:
How do I enable PDF searching? I've heard of the adobe filter, but couldn't find a clear guide on how to get started.
Are the PDF files stored in the DB itself, or in the file system? I was mainly concerned about the space on shared hosting services like DiscountASP. Typically, we get only about 100MB of space for the DB, but a lot more (in GBs) for the File System.
So, if these PDF files are going to be stored directly in the DB, then it may get expensive, right?
I would like to provide snippets of the search results (like Google). How can I achieve this with Sql Server 2008 FTS?
Full text search can only search database content. It will not index content outside the database. Fulltext is extensible through a programming API and Adobe has providers for PDF content, as you already know. SQL Fulltext can use those providers.
However there is another feature you may be interested in, namely the new SQL 2008 FILESTREAM data type. Filestreams are stored in the file system as files but are maintained as part of the database from the point of view of transaction consitency, backup and restore etc. Luckly FILESTREAM and FULL TEXT work together.
Sounds like you want to use Microsoft Indexing Services
This will index files on the file system so you can search their contents.
Here is an example of querying indexing services using ASP.NET
You need a PDF IFilter. Here's the one from Foxit Software.
I believe you can only use 'Sql Server Full Text Search" if the PDF files are stored within the database.
I haven't found a way to do this other than opening the file and searching for the context myself for each result.

Method to generate pdf from access+vb6 or just sql 2005?

The setup:
Multiple computers using an adp file to access a sql 2005 database. Most don't have a pdf distiller. An access form (plain form, not crystal) is created that needs to be saved as a pdf.
The only way I can think of is send a request from access to the sql server for a web page. Something like:
"http://sqlserver/generatepdf.php?id=123"
I'm trying to avoid the web page 'middle man'. Is there a way to generate the pdf in T-SQL? Anyone have any other ideas. I'm not looking for code, just methdology ideas.
Thank you
Save the form as a report, then use Access MVP Stephen Lebans free A2000ReportToPDF utility to convert it to a pdf file.
http://www.lebans.com/reporttopdf.htm
If they have Access 2007 they can download and install the free Microsoft Office 2007 Add-in to save documents as PDF or XPS.
http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4AE6-B059-A2E79ED87041&displaylang=en
Microsoft's ReportViewer client can generate pdfs natively.
It works inside of web pages and windows forms/wpf apps. You can programmatically trigger the export as well. The only downside is that you'll need to basically redo your form as a report.
I must admit that I did not get it: you want to export an Access form and its data into a PDF file? Your form is basically graphics, not text, nor report. Do you mean that you want this form to be included as (for example) a .png file inside a PDF file or do you want it to be a full PDF file inheriting objects from the original form and allowing things such as text search and so on?