ASP.NET Core Editable PDF Saving - asp.net

I am trying to understand the best way to embed a editable PDF inside of a webpage, allow the user to fill out the form then have it post back to the server to save that file on the server.
I have heard about IText, but have not found any great examples of this being done. I understand I could have the user download the file then upload but thought it would be cool to embed it into the page.
Is there an ideal way, or easier way to do this then what I was thinking? I have tried/thought about calling a controller (but really I think I can reference all of this inside of the from on 'OnPost()'.
Could I just an iframe and request the iframes value from the form?

Related

Lightbox2 from photo directory

Is it possible to use the Lightbox2 script to display all photos from a given directory instead of listing each photo in the html?
This is really just a yes or no question, but please feel free to explain. I want to know if this is possible and if I should spend my time trying to figure it out. Thanks for the help.
No, Lightbox2 is written in JavaScript.
When used on a webpage, JavaScript is a client-side scripting language.
This means that the code executes on your web browser, and only has access to data the web browser makes available to it.
For more info: Client-side scripting
You need to use a server-side language (PHP, ASP.NET, etc.) to work with the server-side directories.
Here is an answer to a similar question, with a suggestion to create an index file w/ all the image file names that you could then parse with JavaScript. I don't think it would be much more efficient than manually adding img elements though.
Is there a way to return a list of all the image file names from a folder using only Javascript?

Can I control the handling of word files by the user in asp.net?

Today we have a classic asp application to manipulate the word files in the company. By using ActiveX, we can download, edit, print and finally upload the modifications without much interation.
Explaining: If I need to update anything in the "Processes.doc" file, I click on it, the ActiveX download the file to my desktop, I use it whenever I want but, when I close the file, the ActiveX uploads the new version, if this need applies with the rules.
This feature only works under IE and the users have this desire to do the same in other browsers. And the boss wants this system updated in asp.net.
My question is only "how is this possible?" How can I make it cross-plataform with the same usability that I have now? I spent the day reading about custom controls in asp.net (using object tag, but it don't work in FF), third-party components (expensive and I don't know if it will work), ActiveX written in .NET.
Any other suggestions? There is another way to this?
ActiveX is being phased out as is Flash and being replaced by JS/HTML5. These two client side technologies are more than capable of editing word documents but in the end I think you'll find that getting away from a proprietary format like MS word is the way to go. HTML is powerful enough to provide most of the same features of MS word so once the files have been converted it's simply a matter of finding a javascript HTML document editor. From there you simply need to rework the mechanism which downloads and uploads the HTML to the server to use AJAX and you'll be good to go.
Here are some examples of HTML editors:
http://www.tinymce.com/
http://speckedit.com/demo
http://nicedit.com/demos.php
http://ckeditor.com/demo

ASP.NET - best method for website where user can create articles (like a blog)

I'm an ASP.NET newbie, but not so new at programming in general.
I'm creating a commercial website, and I want to allow an admin to add new articles (an article consists of text, images and various properties such as category).
I am trying to decide the optimal Modus Operandi. This site is commercial, so SEO is a major consideration. This means that I want each url to be "unique". That is, if someone navigates to an article about raccoons, he should be redirected to www.mysite.com/articles/raccoons. This means - I can't have one page that loads the appropriate article dynamically a-la AJAX (gotta use deep-linking)
So how exactly do I do this? suppose the admin entered his text, uploaded the images and set the article properties. I create a new subfolder, save the images to the server (I understand that saving images to a DB is a big no-no), their addresses in a DB, and the content itself to the DB. But now what?
How do I go about creating the actual page?
Is there a function for creating a new aspx file? then what about its corresponding cs file? Or is it unwise to use aspx? Maybe plain html? but then how does it work with my site's master page? Or maybe just create another copy of a general aspx file which is populated with an article according to a parameter?
I would like to know what is the "smartest" approach before I dive in too deep.
You can Consider ASP.Net MVC for this. What you need is more like a Content Management System rather than a Blog, as you mentioned an administrator will add articles.
By Using ASP.Net MVC, you have a very clean implementation there, your urls will stay as you need it for SEO, You dont have to create aspx pages on the fly but the framework will let you deal with new urls from your class files.

uploading multiple files from client to server with asp.net

uploading multiple files from client to server with asp.net
I have been looking at the asp.net upload control but that is for one file (unless someone knows a better way to do it).
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.aspx
For what I want to do I don't even really need a browse. I know the files off of the client are at a certain location. Is it possible to create a collection of HttpPostedFiles and upload those?
http://msdn.microsoft.com/en-us/library/system.web.httppostedfile.aspx
I don't think it is possible but would be glad to be proven wrong. Is there a different asp.net method or control that will easily allow uploading multiple files from client to server?
Here's a few ideas to look over:
http://www.c-sharpcorner.com/UploadFile/rahul4_saxena/UploadingMultipleFilesInASPDotNET203062009015325AM/UploadingMultipleFilesInASPDotNET2.aspx
http://aspalliance.com/1221_CodeSnip_Uploading_Multiple_Files_At_Once.all
http://www.dotnetcurry.com/ShowArticle.aspx?ID=68&AspxAutoDetectCookieSupport=1
The only multiple file upload component I know from the top of my head is the one Telerik provides:
http://www.telerik.com/products/aspnet-ajax/upload.aspx
That's bundled in RadControls, which is a pretty nice kit to have, though it costs a bit.
Have a look at the System.Net.WebClient.UploadFile and System.Net.WebClient.UploadFileAsync methods.
If you use the synchronous method, you would upload one file at a time sequentially. If you opt for the asynchronous method instead, you could fire off multiple uploads at once.
I Prefer Purifying the stuff with HTML & JavaScript on the Client Side and on the Server Side Using Generic Handler if you are a JavaScript Developer it will be more easier and customizable in your hand and maybe you invent your way of uploading the files
i will tell you about my way of doing this technically
(1st) of course you need to make the upload process without posting the page back and forth to the server so in this case the main item here is an HTML Item which will help us uploading files without posting the whole page which is IFRAME.
(2nd) for most of us in the very beginning we knew the FORM tag is responsible of posting the data from client to server but we didn't know that if we had a INPUT FILE in our FORM we can't post its files to the server without adding a specific attribute in the form tag which is enctype= multipart/form-data
(3rd) there is many techniques invented to make the multiple upload the first one is by adding a attribute to the INPUT FILE which is multiple="multiple" that will make the input file acts to hold a multiple files inside it but in this case it will be a one by one multiple upload when posting the files all together in 1 request to the server.
the other technique is creating in the run time an input file for each file we need to upload with that we can pass the input files control to a form related to each that form of course is inside an IFRAME related to it with that we have a request to each uploading process
to whom ever need more details about that technique free to ask for more description

Showing a form from a webpage

I have a problem I am trying to solve in an elegant manner. I have a .net application that I have created. I am trying to get one of the forms to be shown from a webpage. This sounds strange I'll admit, so here is the backstory
We have some large monitors at work, that show information on them. I have no control over how the information is displayed. Currently they are just using a browser and tabbing in the browser to show each different piece of information on the screen. Most of the info they show is just standard html stuff, text and images.
Now along comes my winforms application. The part of the application I need to show is a graphical display. Everything on this display is drawn using GDI+, if that matters. I need to get this form into a format that I can show. Below is my own solution, but I am pretty sure this is not the best method, but it may be the only method I can use
Create a console application. The application would do the following
1. Run as a service on a server
2. Create the display in memory, and save it to a bitmap every so ofter
3. Save the bitmap to a location on the network.
4. have an HTML file that links the image that can be shown in the browser
I though about doing something with the clients, however the clients are not always up, so I could have periods where the image wouldnt be updated.
I also was thinking about an ASP.net solution, but that would require me to learn ASP.net, and I am not quite ready to take that challenge
In IE you can host a winforms app/control as an ActiveX control, like so:
<object id="DateTimePicker" height="31" width="177"
classid="bin/Web.Controls.DateTime.dll#Web.Controls.DateTime.DateTimePicker" VIEWASTEXT>
</object>
See this article for more information: http://www.codeproject.com/KB/miscctrl/htmlwincontrol.aspx
Now, I'm not claiming that this is any more elegant than your solution, but it is an alternative.
I think using Asp.Net to serve a dynamic image using a HttpHandler would be the best approach, but depending on your skills and time this may not be an option. Here is a nice tutorial: http://www.codeguru.com/columns/dotnet/article.php/c11013
IMHO The best way to build this would be as a browser plug-in, like how Flash works. Microsoft has created a plug-in framework called SpicIE, that allows you develop managed plug-ins for IE. This is probably your best bet.
The old unmanaged way is to build out your WinForms dll app and then package it in a signed cab file, and then reference that cab file with an HTML object tag (codebase arg is the one you need).
i.e.,
document.write("<object CLASSID='clsid:DC187740-46A9-11D5-A815-00B0D0428C0C' CODEBASE='/MyFormsApp/MyFormsApp.cab#Version=1,00,0000' />");
The first time the user hits the page they will be asked to allow for the installer to load its payload (dll's). Once they do, they will have a fully fledged WinForms desktop APP running through a browser window.
I took the easy route on this one. I created a small winform app, that coverts the GDI objects to a bitmap, and then I save the bitmap to a network share. This file is refenced in a simple HTML file that is displayed on the monitor.
I chose the winform app, because it makes it really easy for me to set this up in task manager, and run it every 10 minutes to update.

Resources