Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Build JavaScript UI
Javascript
Agent and App Development Solutions
Build. Accelerate. Govern.
AI-Ready Application Experiences
AI-Assisted SDLC
Agent Governance and Control
Telerik
Build modern .NET business apps
.Net Web
Desktop
Reporting and Documents
Cross-Platform
Additional Tools
Enhance the developer and designer experience
Testing & Mocking
CMS
Debugging
UI Tools
Free Tools
Hi,
I want to be able extract embedded images and text from a pdf. Is this even possible?
If so, can you point me in the right direction?
Thanks... Ed
Hi Ed,
I wanted to ask you what is your application type? If you are using Net Framework this can be achieved with the following approach:
static void Main(string[] args) { var pdfProvider = new PdfFormatProvider(); var docuemnt = pdfProvider.Import(File.ReadAllBytes(@"..\..\sampledoc.pdf")); int count = 0; foreach (var page in docuemnt.Pages) { foreach (var item in page.Content) { if (item is TextFragment) { var text = ((TextFragment)item).Text; Console.WriteLine(text); } if (item is Image) { var image = (Image)item; BitmapSource source = image.ImageSource.GetBitmapSource(); SaveClipboardImageToFile(@"C:\my_temp\image" + count++ + ".png", source); } } } } public static void SaveClipboardImageToFile(string filePath, BitmapSource image) { using (var fileStream = new FileStream(filePath, FileMode.Create)) { BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(image)); encoder.Save(fileStream); } }
Regards, Dimitar Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Looks almost exactly what the doctor ordered! Many thanks. I will play with it and get back to you.
Thanks again ... Ed