Stamp the existing pdf file and save it again - asp.net

I want to stamp first page of any existing pdf file with any text enter by the user and save it again or overwrite the file. I found some article about it on google but all are either create a new pdf file or save the stamped file in new pdf file. I want to save the stamping in existing file.
Have you any suggestions or source code.
Thanks in advance
Dinesh Kumar

Check out iTextSharp
You can manipulate PDFs with it.

Related

Biztalk File Moving

I have an xml file which consists of "File Id" attribute which denotes the file id of some pdf document.
<StoredDocumentRepresentation>
<DigitalFile FileId="3BSE077611_B001.pdf" xlink:href="files/3BSE077611_B001.pdf" xlink:type="SIMPLE"></DigitalFile>
</StoredDocumentRepresentation>
There will be many pdf with different FileId(pdf will be having FileId as their name)in the Receive Location. I need to pick the pdf with File id mentioned in the xml...
Thanks in Advance
I have used the File.Move() function in my orchestration for picking the PDF files automatically from source to destination location, once my xml file is dropped...

ItextSharp, Save Pdf Without Displaying Open / Save Dialog Box

Is it possible not to show Open/Save dialog? I would like to save the pdf file straight to specific disk location on client PC.
Yes, you can write the file directly to disk without the use of a save dialog. All you need is a directory path to write too.
string path = "C:\YourDirectoryPathHere";
System.IO.File.WriteAllBytes(Path.Combine(path, "NameYourFile.pdf"), myPDF);
This assumes myPDF is a byte[].

Code to upload an excel file and read it in a dataset

I have a requirement , where in I have to upload an .xlsx file on the server and then read the file into a data table using c# , asp.net.
I need to get your file onto the server.
I need to open the (uploaded?) file.
I need to read the contents of the file, applying any nessesary data parsing.
I need to display the results in a gridview.
Help would be appreciated.

xml file back up?

I have a asp.net application which reads and updates and xml file in my file system.I do have the options edit and save.As of now it serves my purpose but what if the user edits the values and saves but for some reason he wants to restore the old values to the xml file.I want to
have an option called reset which will get the old values of the xml file incase the user wants to get back to the default values.How do i create a back up to the original file and how do i call that xml file ??? Can any one suggest whether i am in right path or not?
I am using Linq-to xml here .
Keep a copy of the original XML file. Call it xml_file.bk and when the user clicks "reset" delete the current XML file and make a copy of XML_File.bk to the real name with the .xml extension.
You can use File.Move(sourcefile, destinationFile) to make a copy of the original.
File.Move documentation.

Get file upload data from post data in ASP.NET

I am looping through the posted values on a form with a view to doing something with them (so don't have access to the controls themselves). This is the process I have to take on this project so that is why I'm doing it this way.
On the form I will have a file upload box but I am not sure how I would upload the file that has been selected from it as I can't just do Control.SaveAs(). When I return the posted value using Request.Form.Item[i] I get the file name I chose but not the full path like I would expect.
Can someone point me in the right direction please?
Thanks.
If you want to manipulate the uploaded files directly, and not through a FileUploader control, you should use the Request.Files collection and not the Request.Form
File Upload controls only pass the file name and the contents. I'm not sure why you would need a folder name, especially since the folder name would be for the client - I can't expect that this would have any value to you since you want to save the file on the server.
As I am unsure of your goals, I would recommend using Server.MapPath("~/Folder") to find a suitable folder to save your uploaded files to

Resources