this is insane .... you have no idea how much you helped me thank you
@RoundTheCode3 жыл бұрын
Thanks Code Dreamers.
@manimaranvasan9669 Жыл бұрын
Nice! when you run the code, you didn't seem to have any limitation on number of pages. did you use the free version of pdf library? Could you add the link for the NuGet?
@RoundTheCode Жыл бұрын
Hi Manimaran, I believe you are limited to 4 pages on the free version. Info about the NuGet package is on this page. You can also download the free code sample. www.roundthecode.com/dotnet/how-to-create-a-pdf-document-html-css-in-asp-net-core
@DanielHarrisCodes11 ай бұрын
Not sure how this works with the terms of the license - But you could always generate the PDFs 4 pages at a time and then combine 2 or more PDFs into one - Depends how tight your budget is etc. whether this would be worth looking at - I believe there may be some PDF stuff available in the community license of Syncfusion .NET controls if that applies to your project The Syncfusion libraries would be an alternative and their community license is very favourable - Once you’re making enough not to qualify for community you would be making enough money to just pay
@vsa48132 жыл бұрын
Genius man❣️ . Is it Possible to bind the Dataset and convert the dataset's column and row values in a table format using this?without using itexsharp or itext7 . Im pretty new to this core
@RoundTheCode2 жыл бұрын
Hi VSA, You can use any HTML to convert it to a PDF with this package. So yes, you can use table and rows if that's what you're asking?
@metintekin7069 Жыл бұрын
the best code that i found today
@RoundTheCode Жыл бұрын
Thanks Metin. Glad you found the video useful.
@rajanpandey17072 жыл бұрын
Could you please also share the steps on how we can publish it and run it on the IIS server? currently, it is working on localhost but when I published the website on IIS and run the create pdf method it is showing a blank page.
@RoundTheCode2 жыл бұрын
Hi Rajan, There might be an underlying error that isn't getting rendered to the browser as it's returning a PDF mime type. You may be able to turn on error logs on the IIS website and see if there is an issue. Skip to 5:39 from this video to turn on IIS error logs if you're not too sure how to do it. kzbin.info/www/bejne/rp_LdoJ4hZJ7nJY
@rajanpandey17072 жыл бұрын
@@RoundTheCode Thank you very much for your response. I have found the issue and resolved it. Thanks for such a nice and explained video.
@veeragundugula81122 жыл бұрын
will be work ? when we deploy on cross platforms like Unix / Linux. If yes "What are all things to align"
@RoundTheCode2 жыл бұрын
Yes it should work on Linux. Not sure what you mean by 'things to align'?
@azharqureshi48852 жыл бұрын
Hello Mate. Awesome Video out there and it helped me a lot. I have tried this method in my currently developed website. It works fine on the local server and IIS but when I move it to the production, it doesn't work. Can u suggest something please? that would mean a lot.
@RoundTheCode2 жыл бұрын
Hi Azhar, what exactly isn't working? Are you getting any errors?
@azharqureshi4885 Жыл бұрын
@@RoundTheCode Actually, it is working totally fine on my local machine. But while running on production, it simply gives this error : An error occurred while processing your request. Request ID: 00-7c7be685ccce58438dd2ba4cbeb41f9c-b76ddcaf78f1624c-00 Development Mode Swapping to Development environment will display more detailed information about the error that occurred. The Development environment shouldn't be enabled for deployed applications. It can result in displaying sensitive information from exceptions to end users. For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development and restarting the app. I have made sure that ASPNETCORE_ENVIRONMENT is set to Production while publishing.. and on the local machine, it simply works totally fine. So I'm not able to find out what actually goes wrong on the production.
@RoundTheCode Жыл бұрын
@@azharqureshi4885 Change ASPNETCORE_ENVIRONMENT to Development on the production server and it should give you a more detailed error. Unfortunately that error you've detailed is just a generic error, so can't really debug it.
@azharqureshi4885 Жыл бұрын
@@RoundTheCode Hi.. Sorry for the late update on this. So I have changed the environment to developmen and I am getting the conversion failure error : An unhandled exception occurred while processing the request. Exception: Conversion failure error 1260. SelectPdf.HtmlToImage.ᜀ(string A_0, string A_1, string A_2, out ឭ[] A_3, out ជ A_4, out string A_5) Stack Query Cookies Headers Routing Exception: Conversion failure error 1260. SelectPdf.HtmlToImage.ᜀ(string A_0, string A_1, string A_2, out ឭ[] A_3, out ជ A_4, out string A_5) SelectPdf.HtmlToPdf.ᜂ(string A_0, string A_1, string A_2, string A_3, bool A_4) SelectPdf.HtmlToPdf.ConvertHtmlString(string htmlString) Derawala.Controllers.AdminController.GenSampleReceipt() in AdminController.cs Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments) System.Threading.Tasks.ValueTask.get_Result() System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult() Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask actionResultValueTask) Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted) Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) Show raw exception details System.Exception: Conversion failure error 1260. at SelectPdf.HtmlToImage.ᜀ(String A_0, String A_1, String A_2, ឭ[]& A_3, ជ& A_4, String& A_5) at SelectPdf.HtmlToPdf.ᜂ(String A_0, String A_1, String A_2, String A_3, Boolean A_4) at SelectPdf.HtmlToPdf.ConvertHtmlString(String htmlString) at Derawala.Controllers.AdminController.GenSampleReceipt() in D:\ASP.Net Core Projects\Derawala\Controllers\AdminController.cs:line 1806 at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Routing.EndpointMiddleware.g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context) at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context) Please look at the error description above.
@betoyazilim2 жыл бұрын
Hi I can't download the sample app. I keep getting the following message. We apologise, but we seem to be having some issues submitting your request. Please retry to submit your request.
@RoundTheCode2 жыл бұрын
Hi Beto, You can download it from this GitHub repo: github.com/RoundTheCode/CreatePdf
@alm4343 жыл бұрын
It has limit of 5 pages in Community version. Full license is still affordable, but not free.
@RoundTheCode3 жыл бұрын
Thanks for the info Arek. That's good to know.
@mightypirate100 Жыл бұрын
Thank you. How to provide a header, footer and page number.
@RoundTheCode Жыл бұрын
I suspect you can do that with CSS using position: fixed and taking advantage of the top, left, bottom and right options in CSS.
@jayateerthakulkrani9310 Жыл бұрын
Is there any way to download dynamic html to pdf by sending html content as string to download the pdf?
@RoundTheCode Жыл бұрын
Yes it's covered in the article that corresponds to this video. It's covered in the section "Create a PDF Document from HTML and CSS" www.roundthecode.com/dotnet/how-to-create-a-pdf-document-html-css-in-asp-net-core
@Alan_Dler2 жыл бұрын
thanks mate. subscribed!
@RoundTheCode2 жыл бұрын
Thanks for the comment Alan
@NakibAkash Жыл бұрын
In community edition it can generate pdf upto 5 pages. What if we need more?
@RoundTheCode Жыл бұрын
You would need to pay a subscription to SelectPdf.
@NakibAkash Жыл бұрын
@@RoundTheCode I recently came to know we can't dockerize it. Is it true?
@RoundTheCode Жыл бұрын
@@NakibAkash I don't see why you couldn't? It's just an ASP.NET Core app and they can be Dockerized.
@cissemy Жыл бұрын
Great. How can I do the same with Blazor Server ?
@RoundTheCode Жыл бұрын
As Blazor Server is an ASP.NET Core framework, you should be able to use this guide. If you follow this guide, you would have to enable controllers in your app.
@cissemy Жыл бұрын
@@RoundTheCode thanks
@vsa48132 жыл бұрын
I hardly see any videos using .net core and acrobat dc tool to export pdf with table format using dataset.It would be helpful for us in future
@RoundTheCode2 жыл бұрын
Hi VSA, Unfortunately, that's not an area I specialise in. What is the Acrobat DC Tool?
@redg56093 жыл бұрын
could you explain how this works with authentication? I tried adding the password in username to authentication options but it doesnt work
@RoundTheCode3 жыл бұрын
So you want people to authenticate before accessing a PDF document? If you are creating a PDF within a controller's action, you can apply the [Authorize] attribute to the action. Or, are you talking specifically about something within the CreatePDF package?
@sivaanand47712 жыл бұрын
pass Model to the View
@RoundTheCode2 жыл бұрын
Make sure that you are referencing the full URL of the stylesheet. Also, make sure that the server you are deploying to can see the stylesheet. If you haven't set your host to be able to see itself, it won't be able to find the stylesheet, and cause an error. For example, I deploy to roundthecode.com. I log on to the server that hosts roundthecode.com and try to request a webpage from roundthecode.com on that server. However, if I haven't added an entry in my hosts file to point that domain to itself, it would throw a "Not found" error.