File download links in a textbox in ASP.Net C# - c#

I have a list of PDF files retrieved from an Azure storage location.
Currently, in my Web App, I filter and gather all of the PDF file names that the user may want and display them in a <asp:TextBox> by assigning a string (e.g. "PDF1.pdf\r\nPDF2.pdf\r\nPDF3.pdf") to the Text property of the TextBox. So they appear like this:
PDF1.pdf
PDF2.pdf
PDF3.pdf
I know the location of the files - e.g. "https://mypdfs.blob.core.windows.net/pdf-repository/" - so can prepend that info to each file for the link (but still would like to only show the filename itself to the user).
I would like the users to be able to click on any of the PDF filenames and have the file download and appear in their local PDF reader. However, I'm not seeing how to do this in a TextBox.
Can this be done within a TextBox? If not, what are the normal methods of doing something like this?

Related

Sending HTML file with Images through email IOS

This is more of a general question about whether or not its actually possible to achieve what I want.
The basis is that my app allows the user to fill out various tables of data for a preventative maintenance check sheet. They can also attach images to this sheet which saves to the temporary storage on the IOS app. Once its complete they then press a button which generates a HTML document through a StreamWriter. Through this StreamWriter I have created, the images are also appended through URL references to the images in the temporary folder.
The HTML file (Generated Form) is then presented to the user using a WebView. Once the user has checked all the information, they then press a button which presents a MailViewController.
The HTML file (Generated Form) is then automatically attached and once the email has been entered you press send and everything works as it should.
The problem I am now having is that im not sure if its possible to keep the images in the html document. Once you open the HTML file on the receiving device, the images no longer loads because they no longer exist according to the HTML file.
So basically is it possible to keep the images in the HTML file once opened on the receiving device.
Sorry for the long description but its needed so you get an understanding of what I am actually doing. All the code I have written works as it should but just wanted to know if this is possible or not.
Thanks
Jamie
Use base 64 encoded strings for the images and it should work. Since the images would be passed along with the html

How do I Open a file directly(from the binary data saved in db), when I will click a link?

I am working on a file uploading functionality using ASP.NET, C# and telerik. I am using telerik:RadAsyncUpload control. I already convert the file to byte array and save in the SQLServer Database.
On update page, I need to open file directly(from the binary data saved in db), when I will click a link. I need to Open that file in separate browser tab/window. I do not want to save file Physically on any local drive while retrieving it.
Please help me out.
What I have tried?
For time been, I am saving that binary data in a blank file located at some local drive and then attaching it to that link. but I do not want to save file Physically on any local drive while retrieving it. I want .....when user will click link binary data will directly flush on separate browser tab and he can view the file.
Create a handler (arbitrary one or an aspx page, whatever you find easier) that will read the database (e.g., based on a querystring argument) and return the appropriate response (via the Response object, e.g., Response.BinaryWrite()).
Note that you should set the appropriate headers and that depending on the type of file you return the browser may prompt the user to open/save it instead of opening it inline. You have some control over that via the content-disposition HTTP header, but it is ultimately up to the browser.
Also, you may want to use a RadWindow to open that handler to keep browser popups to a minimum to reduce the risk of them getting blocked by the browser.

Open a pdf file using "Date modified" column - Console Application

In my console application, I am generating some .pdf files and putting them in a specific folder. Each of these files have unique content with unique names. For example, a similar file names is "6cc32a23-321d-3v8ba181-aa4c38cd7e3a.pdf".
What I would like to do, is open these allow the user to open the pdf from within the console application. Of course they could navigate to the folder they are stored in each time, but I don't wan to do that.
Because the name of each file is unique, how can know which file to open? I had the thought of created a method that searches the folder based on the newest "Date modified". The method basically search the folder for the newest file and attempt to open it. Is that even possible? Any other suggestions would be helpful as well. Thanks!

Preselect Filename when printing to PDF

Can anyone recommend a tool that will allow me to set a registry key or a INI file, or something that will preselect the filename of a PDF when I print it?
I have written code to render some HTML in a web browser control, I simply want to export that HTML file to a PDF as easily as possible. Its been awhile since I have done this but I thought some of the free PDF printers had a registry key or an INI file I can insert a file name and that would make the SAVE dialog not appear and simply print the next file to that file name.
Win2PDF has a registry API to print to PDF while bypassing the save dialog. It also has an auto-name feature that will automatically name the PDF based on the document title, the current date, and the current time.

How do I open a PDF file List in a new Window in ASP.NET?

How do I open a PDF file List in dialog box in a new Window in an ASP.NET application ?
I want list of pdf file which is stored in folder in my application and then select any of pdf and save in logged user's particular folder.
Since you want to display a list of pdf files stored in a folder on the server side you will need to render the list to a page in some format that makes sense. You may open that up as a dialog (perhaps using something like jquery ui) but it wouldn't be necessary.
Next to each file you could have a button that indicates the action you are after, say 'Copy'.
This would then send the id/name of the relevant file to the server and the server code could copy the file to some other location on the server that you refer to as the users folder.
However, if you want to download the file to the user's machine that is something else and you will find many answer here on SO about that.

Categories