Good afternoon.
I have a theme when trying to save a pdf document in a local folder.
With openFileDialog I'm not allowed and with itextsharp I do not understand how to do.
What I need is from my windows form, a dialog is opened, I can select a pdf document from the PC and save it in a local folder. And the path in the database, to later call it from a web application.
this way you can not:
OpenFileDialog open = new OpenFileDialog();
open.InitialDirectory = "C:\";
open.Filter = "Imagen Files (*.pdf)| *.pdf|ALL Files(*.*)|*.*";
open.FilterIndex = 1;
if (open.ShowDialog() == DialogResult.OK)
{
if (open.CheckFileExists)
{
string ruta = @"C:\Users\matias\Documents\Visual Studio 2015\Projects\ProyectoFinal\ProyectoFinal\Imagenes\PdfVentas\";
string nombre = System.IO.Path.GetFileName(open.FileName);
System.IO.File.Copy(nombre, ruta);
}
}
And with itext I do not realize how to do it, because I created a document, I can not select it:
Document doc = new Document(PageSize.LETTER);
PdfWriter writer =
PdfWriter.GetInstance(doc, new FileStream(@"C:\prueba.pdf",
FileMode.Create));
doc.open();
If someone could give me a hand I would appreciate it.
Thank you very much.
Greetings.