public object GetImageUrls(IUrlsCreator urlsCreator, string path, string dimension, int firstPage = 0, int pageCount = 0, int?quality = null, bool usePdf = true, string watermarkText = null, int?watermarkColor = null, WatermarkPosition watermarkPosition = WatermarkPosition.Diagonal, float watermarkWidth = 0, bool ignoreDocumentAbsence = false, bool useHtmlBasedEngine = false, bool supportPageRotation = false, string instanceId = null, string locale = null) { double width; bool isParsed = Double.TryParse(dimension.Substring(0, dimension.Length - 1), out width); if (!isParsed) { return(null); } string[] pageImageUrls; pageImageUrls = urlsCreator.GetImageUrlsInternal(path, firstPage, pageCount, (int)width, quality, usePdf, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, instanceId, locale); var data = new { image_urls = pageImageUrls }; return(data); }
public object ViewDocument(IUrlsCreator urlsCreator, IPrintableHtmlCreator printableHtmlCreator, string path, bool useHtmlBasedEngine = false, bool usePngImagesForHtmlBasedEngine = false, int?count = null, int?width = null, int?quality = null, bool usePdf = true, int?preloadPagesCount = null, bool convertWordDocumentsCompletely = false, string fileDisplayName = null, string watermarkText = null, int?watermarkColor = null, WatermarkPosition watermarkPosition = WatermarkPosition.Diagonal, float watermarkWidth = 0, bool ignoreDocumentAbsence = false, bool supportPageRotation = false, bool supportListOfContentControls = false, bool supportListOfBookmarks = false, bool embedImagesIntoHtmlForWordFiles = false, string instanceId = null, string locale = null) { string pdfDownloadUrl = null; string filename = Path.GetFileName(path); string[] imageUrls = null; string downloadUrl = urlsCreator.GetFileUrl(path, false, false, fileDisplayName); pdfDownloadUrl = urlsCreator.GetFileUrl(path, true, false, fileDisplayName, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, null); string pdfPrintUrl = urlsCreator.GetFileUrl(path, true, true, fileDisplayName, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, null); string[] pageHtml = null, pageCss = null; string sharedCss = null; int pageCount; if (useHtmlBasedEngine) { pageCount = _viewingService.GenerateHtml(path, null, null, null, null, null, true, false, true, false, false, false, false, false); } else { pageCount = _viewingService.GeneratePageImages(path, new ViewingOptions()); } if (useHtmlBasedEngine) { _viewingService.GetPagesHtml(path, 0, pageCount, out pageHtml, out pageCss); sharedCss = _viewingService.GetPagesSharedCss(path); } else { imageUrls = urlsCreator.GetImageUrlsInternal(path, 0, pageCount, width, quality, usePdf, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, null, locale); } string javaScriptDescFileContents = _viewingService.GenerateJavaScriptDescription(path, null, true, useHtmlBasedEngine, !useHtmlBasedEngine && !usePdf, false, true); string extension = Path.GetExtension(path); var data = new { path, id = "", doc_type = TypesMapper.GetDocumentTypes(extension).FirstOrDefault().ToString(), fileType = TypesMapper.GetFileType(extension).ToString(), pageCount = pageCount, url = downloadUrl, pdfDownloadUrl, name = filename, imageUrls, token = "", pdfPrintUrl, pageHtml, pageCss, documentDescription = javaScriptDescFileContents, sharedCss }; return(data); }
public object ViewDocument(IUrlsCreator urlsCreator, IPrintableHtmlCreator printableHtmlCreator, string path, bool useHtmlBasedEngine = false, bool usePngImagesForHtmlBasedEngine = false, int? count = null, int? width = null, int? quality = null, bool usePdf = true, int? preloadPagesCount = null, bool convertWordDocumentsCompletely = false, string fileDisplayName = null, string watermarkText = null, int? watermarkColor = null, WatermarkPosition watermarkPosition = WatermarkPosition.Diagonal, float watermarkWidth = 0, bool ignoreDocumentAbsence = false, bool supportPageRotation = false, bool supportListOfContentControls = false, bool supportListOfBookmarks = false, bool embedImagesIntoHtmlForWordFiles = false, string instanceId = null, string locale = null) { string pdfDownloadUrl = null; string filename = Path.GetFileName(path); string[] imageUrls = null; string downloadUrl = urlsCreator.GetFileUrl(path, false, false, fileDisplayName); pdfDownloadUrl = urlsCreator.GetFileUrl(path, true, false, fileDisplayName, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, null); string pdfPrintUrl = urlsCreator.GetFileUrl(path, true, true, fileDisplayName, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, null); string[] pageHtml = null, pageCss = null; string sharedCss = null; int pageCount; if (useHtmlBasedEngine) pageCount = _viewingService.GenerateHtml(path, null, null, null, null, null, true, false, true, false, false, false, false, false); else pageCount = _viewingService.GeneratePageImages(path, new ViewingOptions()); if (useHtmlBasedEngine) { _viewingService.GetPagesHtml(path, 0, pageCount, out pageHtml, out pageCss); sharedCss = _viewingService.GetPagesSharedCss(path); } else { imageUrls = urlsCreator.GetImageUrlsInternal(path, 0, pageCount, width, quality, usePdf, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, null, locale); } string javaScriptDescFileContents = _viewingService.GenerateJavaScriptDescription(path, null, true, useHtmlBasedEngine, !useHtmlBasedEngine && !usePdf, false, true); string extension = Path.GetExtension(path); var data = new { path, id = "", doc_type = TypesMapper.GetDocumentTypes(extension).FirstOrDefault().ToString(), fileType = TypesMapper.GetFileType(extension).ToString(), pageCount = pageCount, url = downloadUrl, pdfDownloadUrl, name = filename, imageUrls, token = "", pdfPrintUrl, pageHtml, pageCss, documentDescription = javaScriptDescFileContents, sharedCss }; return data; }
public object GetImageUrls(IUrlsCreator urlsCreator, string path, string dimension, int firstPage = 0, int pageCount = 0, int? quality = null, bool usePdf = true, string watermarkText = null, int? watermarkColor = null, WatermarkPosition watermarkPosition = WatermarkPosition.Diagonal, float watermarkWidth = 0, bool ignoreDocumentAbsence = false, bool useHtmlBasedEngine = false, bool supportPageRotation = false, string instanceId = null, string locale = null) { double width; bool isParsed = Double.TryParse(dimension.Substring(0, dimension.Length - 1), out width); if (!isParsed) return null; string[] pageImageUrls; pageImageUrls = urlsCreator.GetImageUrlsInternal(path, firstPage, pageCount, (int)width, quality, usePdf, watermarkText, watermarkColor, watermarkPosition, watermarkWidth, ignoreDocumentAbsence, useHtmlBasedEngine, supportPageRotation, instanceId, locale); var data = new { image_urls = pageImageUrls }; return data; }