- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在利用 Syncfusion 的 PdfViewerControl 和 PdfLoadedDocument 类来生成 PDF 的缩略图。但是,当我将项目移至 Azure 应用服务后,PdfViewerControl 在初始化时会引发异常。我很好奇它是否正在尝试使用系统内存而 Azure 正在阻止此操作。下面是我创建的方法GenerateThumbnails,在创建新的PdfViewerControl 时抛出异常。如果有人解决了这个问题,或者在迁移到 Azure 时经历过类似的事情,我们将不胜感激。
除此之外,如果有人知道另一种工具可以通过这种方式从 PDF 创建缩略图,那也会非常有帮助。谢谢!
异常(exception):
System.AccessViolationException:“尝试读取或写入 protected 内存。这通常表明其他内存已损坏。'
方法:
public static List<Byte[]> GenerateThumbnails(Byte[] file)
{
Int32 resizedHeight;
Int32 resizedWidth;
List<Byte[]> thumbnails = new List<Byte[]>();
using (PdfViewerControl pdfViewerControl = new PdfViewerControl())
using (PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(file, true))
{
// The PDF Viewer Control must load the PDF from a PdfLoadedDocument, rather than directly from the filename because
// when loaded from the filename, it is not disposed correctly and causes a file lock.
pdfViewerControl.Load(pdfLoadedDocument);
for (Int32 i = 0; i < pdfViewerControl.PageCount; ++i)
{
using (Bitmap originalBitmap = pdfViewerControl.ExportAsImage(i))
{
if (pdfViewerControl.LoadedDocument.Pages[i].Size.Width > pdfViewerControl.LoadedDocument.Pages[i].Size.Height)
{
resizedHeight = (PdfUtility.TARGET_THUMBNAIL_WIDTH_LANDSCAPE * originalBitmap.Height) / originalBitmap.Width;
resizedWidth = PdfUtility.TARGET_THUMBNAIL_WIDTH_LANDSCAPE;
}
else
{
resizedHeight = PdfUtility.TARGET_THUMBNAIL_HEIGHT_PORTRAIT;
resizedWidth = (PdfUtility.TARGET_THUMBNAIL_HEIGHT_PORTRAIT * originalBitmap.Width) / originalBitmap.Height;
}
using (Bitmap resizedBitmap = new Bitmap(originalBitmap, new Size(resizedWidth, resizedHeight)))
using (MemoryStream memoryStream = new MemoryStream())
{
resizedBitmap.Save(memoryStream, ImageFormat.Jpeg);
thumbnails.Add(memoryStream.ToArray());
}
}
}
}
return thumbnails;
}
最佳答案
更新现在支持 Windows 上的容器 Web 应用程序。这允许您携带在沙箱外部运行的自己的 docker 容器,因此下面描述的限制不会影响您的应用程序。
应用程序运行的沙箱中存在一些限制,会阻止某些 API 调用。
Here is a list of frameworks and scenarios that have been found to be not be usable due to one or more of the restrictions above. It's conceivable that some will be supported in the future as the sandbox evolves.
PDF generators failing due to restriction mentioned above:
Syncfusion Siberix Spire.PDF The following PDF generators are supported:
SQL Reporting framework: requires the site to run in Basic or higher (note that this currently does not work in Functions apps in Consumptions mode) EVOPDF: See http://www.evopdf.com/azure-html-to-pdf-converter.aspx for vendor solution Telerik reporting: requires the site to run in Basic or higher. More info here Rotativa / wkhtmltopdf: requires the site to run in Basic or higher. NReco PdfGenerator (wkhtmltopdf): requires subscription plan Basic or higher Known issue for all PDF generators based on wkhtmltopdf or phantomjs: custom fonts are not rendered (system-installed font is used instead) because of sandbox GDI API limitations that present even in VM-based Azure Apps plans (Basic or higher).
Other scenarios that are not supported:
PhantomJS/Selenium: tries to connect to local address, and also uses GDI+.
https://github.com/projectkudu/kudu/wiki/Azure-Web-App-sandbox
关于image - Azure 上的 Syncfusion PdfViewerControl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51954226/
我添加了 SFchart,它没有错误并且可以编译。它显示一个空的图 TableView 。 我在 Xamarin.IOS 中使用 MVVMcross 我请求的数据在那里,它包含大约 200 行,数据是
您好,我正在使用 Syncfusion Essential JS2 for JavaScript(ES5),并尝试使用网格组件渲染此测试数据数组中的数据: var testdata = [{first
在我的 Syncfusion WPF 应用程序中,ChartTrackBallBehavior 显示我可以向 ChartTrackBallStyle 添加一些样式。 Style 没有任何文档。我不知道
我正在尝试在我的新 Win8 C#/XAML 商店应用程序中使用 SyncFusion WinRT Studio 中的饼图,但我不知道如何在图表上设置数据。我的页面上有图表,并尝试了我能找到的所有方法
我正在使用 Syncfusion JS 12.1.0.43,尝试使用自定义工具提示实现折线图; 这是我的 HTML; #point.totalValue# #point
我正在尝试在我的项目中使用此 Syncfusion 数据透视表包。 Here is the link of package . 我刚刚复制了代码并将其粘贴到我的 vue 组件中。 我复制的代码:
我在 ASP.NET MVC 中使用 syncfusion 让我的应用程序显示图表,我做得很好。 现在我必须为在每个轴上生成的每个图表设置隐藏字段,并希望在点击图表函数调用时获取该隐藏字段的值。 Co
我尝试使用此代码,将 Syncfusion 图表包含到项目中 xmlns:charting="clr-namespace:Syncfusion.UI.Xaml.Charts;assembly=Sync
在尝试构建它时,我在并非自己创建的 Visual Studio 解决方案上收到此错误: System.FormatException: Invalid length for a Base-64 cha
为了澄清,我只想知道,是否可以将SfCartesianChart与StackedColumnSeries一起使用Single yValueMapper的Variable,所以以后如果我放很多数据,我就
我正在利用 Syncfusion 的 PdfViewerControl 和 PdfLoadedDocument 类来生成 PDF 的缩略图。但是,当我将项目移至 Azure 应用服务后,PdfView
我如何安装syncfusion仪表板以对本地计算机使用react?我有测试本地项目,我想通过 API 将数据发送到syncfusion仪表板,以管理数据。 在官方文档中,仅介绍如何在 Windows
我正在利用 Syncfusion 的 PdfViewerControl 和 PdfLoadedDocument 类来生成 PDF 的缩略图。但是,当我将项目移至 Azure 应用服务后,PdfView
我的应用程序 ASP.NET MVC 5 我正在使用 Syncfusion 控件。 这是我的看法: @using Reporter.Models @model List @(Html.EJ().Gri
我们正在为我们的应用程序使用 Syncfusion UI,但过滤器、排序不起作用。 请在下面的 stackblitz 链接中找到问题的详细信息 https://stackblitz.com/edit/
我有一个从 node.js 服务器运行的 html 页面。我正在尝试使用syncfusions基本网格功能,并遵循提供的设置http://help.syncfusion.com/web . 我的代码如
如何使用 syncfusion 网格分组控件在特定单元格上设置样式属性。我尝试了以下代码,但它在网络表单中不起作用。 tdescriptor.Columns[0].Appearance.AnyReco
我正在使用 Syncfusion ASP.NET GridView 加载大数据。它需要过滤、分页、编辑等功能。现在,问题在于分页,因为它需要相当多的时间。所以,我切换到按需分页,但问题是,它只对当前页
我需要在 Syncfusion Windows 窗体网格中创建一个带有复选框的列。我可以创建一个只有一个复选框的列,但无法在其旁边添加文本。谁能帮我这个?我在 Syncfusion 论坛上找不到任何资
我正在使用 SyncFusion for Javascript 在我的应用程序中呈现图表。我有一个包含多个系列、连续 X 轴和数据点之间不等间隔的 StepChart。当用户悬停在某个点时,我想显示一
我是一名优秀的程序员,十分优秀!