SDK Class Library Overview
Click or drag to resize
RasterEdge.Imaging SDK API Reference Overview
RasterEdge DocImage SDK for .NET is a suit of .NET assemblies which provides flexible document and image handling capabilities, like document and image acquisition, creating, loading, displaying, annotating and processing. These .NET imaging assemblies can be used in C#, VB.NET, ASP.NET and other .NET compliant projects. Supportive documents and images including MS Word, Excel, PowerPoint, PDF, TIFF, DICOM, BMP, JPEG, JBIG2, GIF, PNG, etc.
Online demo
Download
C#
            WorkRegistry.Reset();

            //quick to load the first page of the word and render it to specific size;
            Bitmap firstPage = DOCXDocument.GetPreviewImage(@"D:\sample.docx",new Size(800,900));

            //construct a document from a locad file;
            DOCXDocument doc = new DOCXDocument(@"D:\sample.docx");

            //convert word to tiff with a given zoom value and save tiff file on local disk;
            doc.ConvertToDocument(DocumentType.TIFF,0.75f, @"D:\convertTo.tiff");

            //convert word to pdf and save pdf file into stram;
            using (FileStream fs = new FileStream(@"D:\convertTo.pdf",FileMode.Create))
            {
                doc.ConvertToDocument(DocumentType.PDF, fs);
            }

            //convert document to images of sepcified type and resolution, one image per page; and store the image under a local file directory;
            doc.ConvertToImages(ImageType.PNG, 128, @"D:\wordTopng\","page");

            //convert whole document to  vectory Images as svg, and save it, one image per page;
            doc.ConvertToVectorImages(ContextType.SVG,@"","pageIdx",RelativeType.SVG);

            //convert whole document to  vectory Images as xps, one image per page;
            doc.ConvertToVectorImages(ContextType.XPS, @"D:\wordToxps\","index",RelativeType.MAX);

            //save th document to byte array;
            byte[] bytes = doc.SaveToBytes();

            //construct a document from a byte array;
            byte[] sourceBytes = File.ReadAllBytes(@"D:\sample.docx");
            DOCXDocument doc1 = new DOCXDocument(bytes);

            //save th document to stream;
            using(Stream s0 =new MemoryStream())
            {
                doc1.SaveToStream(s0);
            }

            //construct a document from a stream;
            using (Stream s = new MemoryStream(sourceBytes))
            {
                doc1 = new DOCXDocument(s);
            }

            //get a page from he document ;
            DOCXPage page = (DOCXPage)doc1.GetPage(0);

            //convert to image in specified type using default resolution 96 dpi,and save it to file;
            page.ConvertToImage(ImageType.BMP,@"C:\pageTo1.bmp");

            //convert to image in specified type using specified resolution,and save it to file;
            page.ConvertToImage(ImageType.JPEG,128,@"C:\pageTo2.jpeg");

            //draw the page on bitmap with specified zoom factor;
            Bitmap bitmap = page.GetBitmap(1.25f);

            //convert page to REImage, fit its width or height to the specified value with a fixed width/height ratio;
            REImage image = page.ConvertToImageFitWidth(500);
            //save the image;
            image.Save(ImageType.PNG, @"C:\pageFitWidth.png");
            REImage image1 = page.ConvertToImageFitHeight(700);

            //crop the page with source region and render to the REImage with target size 
            REImage image2 = page.CropImage(new Rectangle(0,0,300,400),new Size(600,800));

            //convert page to vectory image such as svg and xps;
            page.ConvertToVectorImage(ContextType.SVG,"","onePage",RelativeType.SVG);
            page.ConvertToVectorImage(ContextType.XPS, @"D:\wordToxps\","onePage",RelativeType.MAX);

            //add annotation on page ;
            TextAnnotation anno = AnnotationGenerator.CreateTextAnnotation(0,0,200,100,"this is the annotation",new Font("Arial", 20));
            page.AddAnnotation(anno);

            //convert page to image in specified type using zoom value ,and save it to byte;
            byte[] buffer = page.ConvertToImageBytes(ImageType.BMP,1.5f);

            //convert page to image in specified type using specified resolution ,and save it to stream;
            using(Stream stream = new MemoryStream())
            {
                page.ConvertToImageStream(ImageType.PNG, 128, stream);
            }

            //save the document to file on local disk;
            doc.Save(@"c:\saveword.docx");