В этом разделе
VintaSoft Imaging .NET SDK может рендерить HTML-страницу.
SDK поддерживает следующие HTML-теги:
a, abbr, acronym, area, article, b, base, basefont, big, blockquote, body, br, caption, center, circle, clipPath, code, col, colgroup, dd, defs, div, dl, dt, ellipse, em, embed, fieldset, figcaption, figure, font, footer, form, frame, g, h1, h2, h3, h4, h5, h6, head, header, hr, html, i, iframe, image, img, input, isindex, label, legend, li, line, linearGradient, link, map, marker, mask, meta, noscript, object, ol, optgroup, option, p, param, path, polygon, polyline, pre, q, rect, s, script, section, select, small, span, stop, strike, strong, style, sub, sup, svg, table, tbody, td, text, textarea, tfoot, th, thead, title, tr, tspan, tt, u, ul, use
.
SDK поддерживает следующие CSS-атрибуты:
align-items, background, background-attachment, background-color, background-image, background-position, background-position-x, background-position-y, background-repeat, border, border-bottom, border-bottom-color, border-bottom-left-radius, border-bottom-right-radius, border-bottom-style, border-bottom-width, border-collapse, border-color, border-left, border-left-color, border-left-style, border-left-width, border-radius, border-right, border-right-color, border-right-style, border-right-width, border-style, border-top, border-top-color, border-top-left-radius, border-top-right-radius, border-top-style, border-top-width, border-width, bottom, clip-path, clip-rule, color, column-gap, content, cx, cy, d, display, fill, fill-opacity, fill-rule, flex-direction, flex-wrap, float, font, font-family, font-size, font-style, font-variant, font-weight, gap, height, justify-content, left, letter-spacing, line-height, list-style-type, margin, margin-block, margin-block-end, margin-block-start, margin-bottom, margin-inline, margin-inline-end, margin-inline-start, margin-left, margin-right, margin-top, marker, marker-end, marker-mid, marker-start, mask, opacity, order, padding, padding-bottom, padding-inline, padding-inline-end, padding-inline-start, padding-left, padding-right, padding-top, page-break-before, position, r, right, row-gap, rx, ry, stop-color, stop-opacity, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, table-layout, text-align, text-anchor, text-decoration, text-decoration-color, text-decoration-line, text-decoration-style, text-decoration-thickness, text-indent, text-transform, text-wrap-mode, top, transform, vertical-align, white-space, white-space-collapse, width, x, y, z-index
.
HTML-страница может содержать ссылки на внешние ресурсы (CSS-файлы, файлы изображений, ...). По умолчанию VintaSoft Imaging .NET SDK позволяет загружать внешние ресурсы, то есть VintaSoft Imaging .NET SDK рендерит HTML-страницу с внешними CSS-стилями и изображениями.
Вот скриншот VintaSoft WPF просмотрщика изображений с HTML-страницей (https://www.vintasoft.ru/index.html), отображаемой с CSS-стилями и изображениями:
VintaSoft Imaging .NET SDK позволяет включать/отключать загрузку внешних ресурсов, то есть отображать HTML-страницу с внешними CSS-стилями и изображениями или без них.
Вот скриншот VintaSoft WPF просмотрщика изображений с HTML-страницей (https://www.vintasoft.ru/index.html), отображаемой без внешних CSS-стилей и изображений:
Если необходимо включить/отключить загрузку всех внешних ресурсов, следует выполнить следующие действия:
- Установить значение свойства [ExternalResourceManager.AllowAccessToExternalResources] в True/False.
Вот C# код, который демонстрирует как включить загрузку всех внешних ресурсов в VintaSoft WPF просмотрщике изображений:
// specify that VintaSoft image web service can access the external resources
Vintasoft.Imaging.Web.Services.VintasoftImageWebService.AllowAccessToExternalResources = true;
Если необходимо включить/отключить загрузку внешних ресурсов и управлять доступом к ним, следует выполнить следующие шаги:
- Установить значение свойства [ExternalResourceManager.AllowAccessToExternalResources] в True/False.
- Подписаться на событие [ExternalResourceManager.VerifyResourceAccess] и управлять доступом к внешним ресурсам.
Вот C# код, который демонстрирует как включить загрузку внешних ресурсов в VintaSoft WPF просмотрщике изображений и разрешить доступ к внешним ресурсам только по адресу "https://www.vintasoft.ru":
...
// specify that VintaSoft image web service can access the external resources
Vintasoft.Imaging.Web.Services.VintasoftImageWebService.AllowAccessToExternalResources = true;
// subscribe to the ExternalResourceManager.VerifyResourceAccess event to manage access to the external resources
ImagingEnvironment.ExternalResourceManager.VerifyResourceAccess += ExternalResourceManager_VerifyResourceAccess;
...
private void ExternalResourceManager_VerifyResourceAccess(object sender, ExternalResourceVerifyAccessEventArgs e)
{
e.IsAccessAllowed = false;
if (e.Uri.ToString().StartsWith("https://www.vintasoft.com"))
e.IsAccessAllowed = true;
}
...