|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using TallComponents.PDF.Rasterizer;
using System.IO;
namespace PDFParser
{
public class Parse
{
public List<Image> Split(byte[] document)
{
Document pdfDoc = new Document(new BinaryReader(new MemoryStream(document)));
Page page = null;
List<Image> returnVal = new List<Image>();
for (int i = 0; i < pdfDoc.Pages.Count; i++)
{
page = pdfDoc.Pages[i];
using (Bitmap bitmap = new Bitmap((int)page.Width, (int)page.Height))
{
Graphics graphics = Graphics.FromImage(bitmap);
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
page.Draw(graphics);
returnVal.Add((Image)bitmap.Clone());
}
}
return returnVal;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.