C sharp - Extraer adjuntos de archivo .PDF

 
Vista:
sin imagen de perfil
Val: 14
Ha aumentado su posición en 7 puestos en C sharp (en relación al último mes)
Gráfica de C sharp

Extraer adjuntos de archivo .PDF

Publicado por CELSO OMAR (6 intervenciones) el 16/05/2023 16:31:41
Hola muy buenos dias a todos, mi consulta es la siguiente, necesito extraer el o los adjuntos q viene en un PDF, he probado varios metodos pero sin resultados favorables, si alguien conoce algun mettodo que les ete funcionando agradeceria infinitamente la colaboracion o sujerencia.
desde ya muchas gracias.-

Les dejo unas lineas que estoy utilizando aculamente pero no esta funcionando.


PdfLoadedDocument loadedDocumenta = new PdfLoadedDocument("c:\\Temp\\Archivo.PDF");

PdfLoadedPage page = loadedDocumenta.Pages[0] as PdfLoadedPage;
//Get the annotation collection from pages
PdfLoadedAnnotationCollection annotations = page.Annotations;

foreach (PdfLoadedAnnotation annot in annotations)
{

if (annot is PdfLoadedAttachmentAnnotation)
{
PdfLoadedAttachmentAnnotation file = annot as PdfLoadedAttachmentAnnotation;

FileStream stream = new FileStream(file.FileName, FileMode.Create);
stream.Write(file.Data, 0, file.Data.Length);
stream.Dispose();
}
}

if (loadedDocumenta.Attachments.Count != 0)
{
foreach (PdfAttachment attachment in loadedDocumenta.Attachments)
{

FileStream stream = new FileStream(attachment.FileName, FileMode.Create);
stream.Write(attachment.Data, 0, attachment.Data.Length);
stream.Dispose();
}
}

loadedDocumenta.Close(true);
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder