ByteScout PDF Extractor SDK - ASP.NET - Extract Attachments - ByteScout

ByteScout PDF Extractor SDK – ASP.NET – Extract Attachments

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Extractor SDK – ASP.NET – Extract Attachments

ByteScout PDF Extractor SDK – ASP.NET – Extract Attachments

Default.aspx.cs

[csharp]
using System;
using Bytescout.PDFExtractor;

namespace ExtractAttachments
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String inputFile = Server.MapPath(@”.\bin\attachments.pdf”);

// Create Bytescout.PDFExtractor.AttachmentExtractor instance
AttachmentExtractor extractor = new AttachmentExtractor();
extractor.RegistrationName = “demo”;
extractor.RegistrationKey = “demo”;

// Load sample PDF document
extractor.LoadDocumentFromFile(inputFile);

Response.Clear();
Response.ContentType = “text/html”;

for (int i = 0; i < extractor.Count; i++) { string attachmentFileName = extractor.GetFileName(i); int attachmentFileSize = extractor.GetSize(i); Response.Write("Found attachment: " + attachmentFileName + "
“);

// You can save the attachment to a file
//extractor.Save(i, attachmentFileName);

// … or write to output stream
//extractor.Save(i, Response.OutputStream);

Response.Write(“- file size: ” + attachmentFileSize + “

“);
}

Response.End();

extractor.Dispose();
}
}
}

[/csharp]

Web.config

[text]











[/text]


  Click here to get your Free Trial version of the SDK

Tutorials:

prev
next