Telerik Forums
UI for ASP.NET Core Forum
4 answers
849 views

Not sure if this is were I should post this question.  I have created a dotnet standard assembly to use with my controller with the PDFViewer that will translate a Word document (docx) to a pdf.  I have tried several different methods and get the same error.  The error I receive is:  "Can not export other than Jpeg and Jpeg2000 and ImageQuality different than High".  The document is pretty straight forward with text a barcpde and a table if that helps (a small image of the doc attached).  Does anyone have an idea how to fix this?  I also created a "this is a test" document and when it is displayed it shows: "PDF file fails to process."  I have attached the document.

 

System.NotSupportedException
  HResult=0x80131515
  Message=Can not export other than Jpeg and Jpeg2000 and ImageQuality different than High
  Source=Telerik.Documents.Fixed
  StackTrace:
   at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.DoOnUnknownData(Byte[] unknownData, ImageQuality imageQuality, Action`1 doOnEncodedData)
   at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.InitializeImageInfoFromUnknownData(Byte[] unknownData, ImageQuality imageQuality)
   at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.EnsureImageInfo()
   at Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource.get_Width()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Objects.ImageXObject.CopyPropertiesFrom(IPdfExportContext context, ImageSource imageSource)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExportContext.GetResource(ImageSource resource)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfContentExportContext.GetResource(ImageSource imageSource)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ImageWriter.WriteOverride(PdfWriter writer, IPdfContentExportContext context, Image element)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.MarkableContentElementWriter`1.Write(PdfWriter writer, IPdfContentExportContext context, Object element)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentElementWriterBase.WriteElement(PdfWriter writer, IPdfContentExportContext context, Object element)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentRootWriter.WriteOverride(PdfWriter writer, IPdfContentExportContext context, IContentRootElement element)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentElementWriter`1.Write(PdfWriter writer, IPdfContentExportContext context, Object element)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.ContentElementWriters.ContentElementWriterBase.WriteElement(PdfWriter writer, IPdfContentExportContext context, Object element)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.ContentStream.BuildContentData(IPdfExportContext context, IResourceHolder resourceHolder, IContentRootElement contentRootElement)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.Page.CopyPropertiesFrom(IPdfExportContext context, RadFixedPage fixedPage)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyRadFixedPageProperties(RadFixedPage source, Page destination, IRadFixedDocumentExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPagePropertiesFrom(IRadFixedDocumentExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesFrom(IRadFixedDocumentExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.Export(IRadFixedDocumentExportContext context, Stream output)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFixedDocument document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
   at Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFlowDocument document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
   at TexasProtax.Document.Pdf.ConvertToPdf.FromWord(String filename) in D:\#bitbucket\TexasProtax\texasprotax.appraisalportal\TexasProtax.Document\Pdf\ConvertToPdf.cs:line 36
   at TexasProTax.AppraisalPortal.Web.Areas.Document.Controller.ViewerController.GetDocument(String location) in D:\#bitbucket\TexasProtax\texasprotax.appraisalportal\TexasProtax.AppraisalPortal.Web\Areas\Document\Controller\ViewerController.cs:line 43
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()

Here is the method:

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Telerik.Windows.Documents.Common.FormatProviders;
using Telerik.Windows.Documents.Flow.FormatProviders.Docx;
using Telerik.Windows.Documents.Flow.FormatProviders.Pdf;
using Telerik.Windows.Documents.Flow.Model;
 
...
 
        public static Stream FromWord(string filename)
        {
            using (Stream inStream = File.OpenRead(filename))
            using (Stream outStream = new MemoryStream())
            {
                IFormatProvider<RadFlowDocument> fileFormatProvider = new DocxFormatProvider();
 
                RadFlowDocument document = null;
                using (Stream input = File.OpenRead(filename))
                {
                    document = fileFormatProvider.Import(input);
                }
 
                //byte[] renderedBytes = null;
                IFormatProvider<RadFlowDocument> formatProvider = new PdfFormatProvider();
                using (MemoryStream ms = new MemoryStream())
                {
                    formatProvider.Export(document, ms);
                    //renderedBytes = ms.ToArray();
                    return ms;
                }
 
            }
        }
Martin
Telerik team
 answered on 12 Aug 2020
1 answer
366 views

Hello.

 

I'm doing this example: https://demos.telerik.com/aspnet-core/grid/custom-command

I would like to add a button to the view, the button should redirect to a controller action with a parameter.
attached image

How could I do it?

 

Petar
Telerik team
 answered on 11 Aug 2020
3 answers
664 views

I still have a developer edition available to me in my downloads and was wondering. In the grid can one tell the edit button to go to another controller / action ?

 

Regards

Neli
Telerik team
 answered on 10 Aug 2020
5 answers
129 views

I have several treeviews on a page and the ondatabound is firing before the data is loaded, actually, before the tree is ready. Anything that I need to do differently?

 

Matt

Petar
Telerik team
 answered on 10 Aug 2020
4 answers
171 views

Hi,

I'm loading dynamically a view from MVC inside my angular application, all the kendo controls renders ok but if the view contains a window the window content apears 2 times , one inside the window and other at the end of the body (Image attached).

The same problem happens with a grid with editor popup (image 2 atached)

 

I followed the net core mvc getting started tutorial but for include all the js files I added this lines inside angular.json

"scripts": [
  {
    "input":  "../Scripts/AppScripts/jquery.js",
    "inject": false,
    "bundleName": "jquery"
  },
  {
    "input": "../Scripts/AppScripts/kendo.all.min.js",
    "inject": false,
    "bundleName": "kendo.all.min"
  },
  {
    "input": "../Scripts/AppScripts/kendo.aspnetmvc.min.js",
    "inject": false,
    "bundleName": "kendo.aspnetmvc.min"
  },
  {
    "input":  "../Scripts/AppScripts/kendo.culture.de-DE.min.js",
    "inject": false,
    "bundleName": "kendo.culture.de-DE.min"
  }
]

 

and in my index file inside head tag:

<script src="jquery.js"></script>
<script src="kendo.all.min.js"></script>
<script src="kendo.aspnetmvc.min.js"></script>
<script src="kendo.culture.de-DE.min.js"></script>

 

I created a sample project to reproduce the problem:
https://drive.google.com/file/d/1rydILf7WvVDiLUGZGRBfl4wjZihw2kbw/view?usp=sharing

 

inside home component.ts comment or un comment the lines :

this.loadUrl('/home/windowDemo');
// this.loadUrl('/home/index');

to see the problem in a view with a single window or in a sample table 

Jochen
Top achievements
Rank 1
 answered on 10 Aug 2020
1 answer
292 views

Hi there,

Recently started using breadcrumb in a ASP.net core application, so far i have no issues with the rendering side of things nor adding items to the breadcrumb.

 

The main issue i am having is with the breadcrumb persisting during the session, meaning that i cant seem to be able to add to the list of items on entering a new page without the previous ones (except for the root item) being forgotten about.

in _layout.cshtml:

@(Html.Kendo().Breadcrumb()
                .Name("breadcrumb")
                .Navigational(true
                 
                )
                .Items(items =>
                {
                    items.Add()
                        .Type(BreadcrumbItemType.RootItem)
                        .Href("/")
                        .Text("Home")
                        .Icon("home")
                        .ShowIcon(true)
                        .ItemClass("root")
                        .IconClass("root")
                        .LinkClass("root");
                })
            )

 

script present in other pages (specifics in this code change based on the page of course):

$(function () {
            var breadcrumb = $("#breadcrumb").data("kendoBreadcrumb");
            breadcrumb.items().push({ href: "/Product/Groups", itemClass: "item", type: "item", text: "Product Groups", showText: true, showIcon: false });
            breadcrumb.refresh();
        });
Neli
Telerik team
 answered on 10 Aug 2020
1 answer
444 views

I have a grid that I want to bind to local data.  When I try to add a record, the widget tries to make an Ajax post back, instead of adding to the IEnumerable<T>.

I'm running ASP Dot Net Core 3.1 with Razor Pages and Telerik 2020.2.617

My Razor Page is as follows:

@(Html.Kendo().Grid<CreateModel.ModelItem>().Name("grid")
    .AutoBind(true)
    .BindTo((IEnumerable<CreateModel.ModelItem>)Model.Data.LineItems)
    .Columns(cols =>
    {
        cols.Bound(c => c.Id);
        cols.Bound(c => c.Line);
        cols.Bound(c => c.Description);
        cols.Bound(c => c.Qty);
        cols.Bound(c => c.Value);
        cols.Command(c =>
        {
            c.Edit();
            c.Destroy();
        });
    })
    .Editable(GridEditMode.InLine)
    .Pageable()
    .DataSource(ds=>
        ds.Ajax()
        .Batch(false)
        .ServerOperation(false)
        .Model(m=>
        {
            m.Id(id => id.Id);
            m.Field(f => f.Id).DefaultValue(Guid.Empty);
            m.Field(f => f.Line).DefaultValue(1);
            m.Field(f => f.Description);
            m.Field(f => f.Qty).DefaultValue(1);
            m.Field(f => f.Value).DefaultValue(0.00m);
        })
    )
    .ToolBar(t=>
    {
        t.Create().Text("Add Line Item");
        t.Save();
    })
)
Anton Mironov
Telerik team
 answered on 07 Aug 2020
6 answers
1.4K+ views

hi ..

i have a dto class called GroupListDto with just three fields

public class GroupListDto
{
    public int Id { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
}

 

i use this class as kendo grid model ..

when i write my actionresult in below manner . my model field is empty

public ActionResult Create([DataSourceRequest] DataSourceRequest request, GroupListDto group)

 

but when is use GroupListDto class fields instead , the fields are filled with correct datas

public ActionResult Create([DataSourceRequest] DataSourceRequest request, string Title , string Description)

 

does anyone know what is the problem ?

why i cant get data in my dto model , but i get data in its fields !?


Petar
Telerik team
 answered on 06 Aug 2020
1 answer
265 views

I am using .net core 3.5 and razor pages.   I have a file upload control that is calling OnPost even when the control explicitly says to call a different method name.

  @(Html.Kendo().Upload()
            .Name("files")
            .Multiple(false)
            .Async(a => a
                .Save("Async_Save", "New", new { Question = DebtorDropBox.Web.UI.Code.Question.DriversLicense })
                .AutoUpload(true)
            )
            .Events(e => e
                .Success("onSuccess")
                .Upload("onUpload")
                .Error("onError")
            )
            .Validation(validation => validation.AllowedExtensions(new string[] { ".jpg" }))
            .Validation(validation => validation.MaxFileSize(4000000))
        )

      for testing purposes I have added the following three methods to my page and no matter what It keeps calling OnPost.    Is there something I should be doing? 

        public async Task<ActionResult> Async_Save(IEnumerable<IFormFile> files, Question question)
        {
            return Page();
        }

        public async Task<ActionResult> OnPostAsync_Save(IEnumerable<IFormFile> files, Question question)
        {
            return Page();
        }

        public async Task<ActionResult> OnPost(IEnumerable<IFormFile> files, Question question)
        {
            return Page();
        }

Martin
Telerik team
 answered on 05 Aug 2020
9 answers
1.7K+ views

How do I handle an exception that occurs when generating the data to be sent to the grid?  I've seen an example of a call to a Javascript "error_handler" method.  Is that my only option?

<kendo-grid name="grid">
    <datasource type="DataSourceTagHelperType.Ajax" on-error="Error">
        <transport>
            <read url="Home/GetOrgs" />
        </transport>
    </datasource>
    ...
</kendo-grid>

 

public IActionResult GetOrgs([DataSourceRequest] DataSourceRequest request)
{
    int x = 0; int r = 10 / x;
}

 

 

Anton Mironov
Telerik team
 answered on 04 Aug 2020
Narrow your results
Selected tags
Tags
+? more
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Marco
Top achievements
Rank 4
Iron
Iron
Iron
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?