ConvertToPdf() public method

public ConvertToPdf ( ConversionOptions options ) : void
options ConversionOptions
return void
Example #1
0
 public byte[] ConvertText(string text, ConversionOptions options)
 {
     using (ConversionEngine engine = m_engineFactory.ConstructTextEngine(text))
     {
         engine.ConvertToPdf(options);
         return(engine.OutputFile);
     }
 }
Example #2
0
        public byte[] CombinePdfs(List <byte[]> sourcePdfs, ConversionOptions options)
        {
            if (sourcePdfs == null || sourcePdfs.Count == 0)
            {
                throw new MissingSourceException("No pdfs were specified.");
            }

            using (ConversionEngine engine = m_engineFactory.ConstructPdfEngine(sourcePdfs))
            {
                engine.ConvertToPdf(options);
                return(engine.OutputFile);
            }
        }
Example #3
0
        public byte[] ConvertHtmlList(string[] html, HtmlConversionOptions options)
        {
            if (html == null || html.Length == 0)
            {
                throw new MissingSourceException("No html was specified.");
            }

            using (ConversionEngine engine = m_engineFactory.ConstructHtmlEngine(html))
            {
                engine.ConvertToPdf(options);
                return(engine.OutputFile);
            }
        }
Example #4
0
        public byte[] ConvertUrls(string[] urls, HtmlConversionOptions options)
        {
            if (urls == null || urls.Length == 0)
            {
                throw new MissingSourceException("No Urls were specified.");
            }

            foreach (string url in urls)
            {
                if (!IsAbsoluteUrl(url))
                {
                    throw new UnsupportedSourceException("The specified url is not an absolute path.", url.ToString());
                }
            }

            using (ConversionEngine engine = m_engineFactory.ConstructUrlEngine(urls))
            {
                engine.ConvertToPdf(options);
                return(engine.OutputFile);
            }
        }
Example #5
0
        public byte[] ConvertFiles(Dictionary <string, byte[]> files, ConversionOptions options)
        {
            if (files == null || files.Count == 0)
            {
                throw new MissingSourceException("No files were specified.");
            }

            List <byte[]> converted = new List <byte[]>();

            foreach (KeyValuePair <string, byte[]> file in files)
            {
                UnsupportedTypeHandlingEnum unsupportedHandling = GetUnsupportedHandlingFromOptions(options);
                using (ConversionEngine engine = m_engineFactory.ConstructFileEngine(file.Key, file.Value, unsupportedHandling))
                {
                    engine.ConvertToPdf(options);
                    byte[] result = engine.OutputFile;
                    converted.Add(result);
                }
            }

            return(CombinePdfs(converted, options));
        }