AspPDF is an ActiveX server component for dynamically creating, reading and modifying Portable Document Format (PDF) files.
PDF is the de-facto world-wide standard for creating and exchanging platform-independent printable documents. Giving your ASP/ASP.NET-based Web applications the power to generate and modify PDF documents on the fly opens endless opportunities for you and your users.
Automate form fill-out process. Create financial reports and invoices. Produce encrypted and digitally signed documents. Send secure email with file attachments. Convert HTML pages to PDF, and PDF pages to images. Stitch documents together and extract pages. Draw all major types of barcodes. In this post, I’ll show you how to converting image from PDF File.
Converting Image From PDF File Using ASPPdf
CMYK to RGB Conversion and Image Extration
Page photos created through the ToImage approach are always within the RGB shade area, but the original PDF being transformed to an image may include pictures and graphics inside the CMYK color room, during which situation they’ve got to become transformed to RGB.
To attain reasonably good color copy, the ToImage technique performs a collection of complex non-linear color transformations depending on profiles, the normal colour room definitions established from the Worldwide Colour Consortium (ICC).
Profile-based CMYK-to-RGB conversion is a fairly gradual method. Should your PDF doc contains huge high-resolution CMYK photos and overall performance is of essence, use the parameter FastCMYK=True which invokes a straightforward linear method for CMYK-to-RGB conversion and provides some overall performance improvement in the price of color-reproduction high quality.
The following pictures exhibit the result in the FastCMYK parameter:
As an additional bonus, the PdfPreview object is capable of extracting images from a PDF page. The method PdfPreview.ExtractImage returns a new instance of the PdfPreview object representing an image specified by a 1-based index. This image can then be saved the regular way, via the methods Save, SaveToMemory or SaveHttp. If the specified index exceeds the number of images on the page, ExtractImage returns Nothing (or null in C#.)
The images are always saved as PNGs as this is PdfPreview’s format of choice.
The following code snippet opens a PDF documents and saves all of the images from page 1 to disk:
C#
1 2 3 4 5 6 7 8 9 10 | IPdfManager objPDF = new PdfManager(); IPdfDocument objDoc = objPDF.OpenDocument( @"c:\path\document.pdf", Missing.Value ); IPdfPreview objPreview = objDoc.Pages[1].ToImage(Missing.Value); int i = 1; IPdfPreview objImage; while( ( objImage = objPreview.ExtractImage(i++) ) != null ) { objImage.Save( @"c:\myprojects\aspdf\asp\files\image.png", false ); } |
VBScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | Set PDF = Server.CreateObject("Persits.PDF") Set Doc = PDF.OpenDocument("c:\path\document.pdf") Set Page = Doc.Pages(1) Set Preview = Page.ToImage i = 1 Do While True Set Image = Preview.ExtractImage(i) If Image Is Nothing Then Exit Do Else Image.Save "c:\path\image.png", False End If i = i + 1 Loop |
Best and Cheap Classic ASP Hosting With AspPdf Recommendation
ASPHostPortal.com was started in 2008. It’s got been topping the list of almost each of the web web hosting evaluation websites up to now. Nonetheless have web sites working on ASP 3.0 or Classic ASP? Really don’t be concerned; they nevertheless help legacy engineering like Classic ASP Hosting. You can also combine and match Classic ASP and ASP.Net code in one single web site. They’ll make sure that Classic ASP operates smoothly on their own servers and that your web site is safer, quicker and much better supported than anyplace else! Their very best and inexpensive Classic ASP web hosting plan is commencing at $5.00/mo. ASPHostPortal.com has become supplying free of charge domain and double SQL server room for brand new clientele to take pleasure in the company’s excellent web hosting services.
[stextbox id=”asp_net_hosting” caption=”ASPHostPortal.com is Microsoft No #1 Recommended Windows Hosting Partner”]ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for the ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, .NET 4.5.2/ASP.NET 4.5.1, ASP.NET MVC 6.0/5.2, Silverlight 5 and Visual Studio Lightswitch. Click here for more information[/stextbox]