carloscds / htmltopdfcore Goto Github PK
View Code? Open in Web Editor NEWConvert HTML to PDF
License: MIT License
Convert HTML to PDF
License: MIT License
How to resolve this error ?
Exception has occurred: CLR/System.ComponentModel.Win32Exception
An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in Wkhtmltopdf.NetCore.dll: 'Permission denied'
at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html)
at Wkhtmltopdf.NetCore.HtmlAsPdf.GetPDF(String html)
at HtmlToPDFCore.HtmlToPDF.ReturnPDF(String html)
at create_file_pdf.Program.GeneratePdfReport(IEnumerable`1 eventList) in /Users/niciuse/Desktop/work/create-file-pdf/Program.cs:line 27
at create_file_pdf.Program.Main(String[] args) in /Users/niciuse/Desktop/work/create-file-pdf/Program.cs:line 17
I am able to run this successfully in my local environment(Windows as well as Linux) but when I deploy it to AWS Lambda, I am getting "Pipe is broken" error. Is there any workaround for Lambda?
First of all thanks for your Package!
I hosted your package on a debian Server + REST API, when i call my PDF Function the request is always "error":"Permission denied".
I forget some settings?
[HttpGet]
[Route("identificationPdf/{shippingId}")]
public IActionResult IdentificationPdf(int shippingId)
{
var shipping = _shippingService.GetById(shippingId);
HtmlToPdf pdf = new HtmlToPdf();
string markSheet = string.Empty;
markSheet = System.IO.File.ReadAllText("Helper/IdentificationPdf.html");
markSheet = markSheet.Replace("ShippingGoods", shipping.ShippingGoods)
.Replace("IdentificationNumber", shipping.IdentificationNumber)
.ToString();
var htmlToPdf = new HtmlToPDFCore.HtmlToPDF();
var bytes = htmlToPdf.ReturnPDF(markSheet);
return File(bytes, "application/pdf", "Versandgut/Versand#"+ shipping.Id + ".pdf");
}
private byte[] ReturnPDF(string html)
{
var dir = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
dir = Path.Combine(dir, "rotativa");
Wkhtmltopdf.NetCore.RotativaConfiguration.RotativaPath = dir;
Wkhtmltopdf.NetCore.RotativaConfiguration.IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
var pdf = new Wkhtmltopdf.NetCore.HtmlAsPdf();
var buffer = pdf.GetPDF(html);
return buffer;
}
thats everything what I implemented.
Probably you have a idea. BR Max :)
Thanks for the simple and nice library.
Is there any option to disable smart shrinking? Pdf looks ok but the problem is that there is some useless empty space and not fill
A4 page.
Hi, Thank you for working on a tool like this. I am writing to see if you could help me out solve this problem.
I am running the solution as shown in the example in a .NET Core 2.2 in Mac OS.
I am getting this Broken Pipe Error.
Is there something special that I should do?
{System.IO.IOException: Broken pipe
at System.IO.FileStream.WriteNative(ReadOnlySpan1 source) at System.IO.FileStream.FlushWriteBuffer() at System.IO.FileStream.Dispose(Boolean disposing) at System.IO.Stream.Close() at System.IO.StreamWriter.Dispose(Boolean disposing) at System.IO.TextWriter.Dispose() at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html) at HTML2PDF.Program.Main(String[] args) in /Users/jmarti/projects/HTML2PDF/HTML2PDF/Program.cs:line 17} Data: {System.Collections.ListDictionaryInternal} HResult: 32 HelpLink: (null) InnerException: (null) Message: "Broken pipe" Source: "System.Private.CoreLib" StackTrace: " at System.IO.FileStream.WriteNative(ReadOnlySpan
1 source)\n at System.IO.FileStream.FlushWriteBuffer()\n at System.IO.FileStream.Dispose(Boolean disposing)\n at System.IO.Stream.Close()\n at System.IO.StreamWriter.Dispose(Boolean disposing)\n at System.IO.TextWriter.Dispose()\n at Wkhtmltopdf.NetCore.WkhtmlDriver.Convert(String wkhtmlPath, String switches, String html)\n at HTML2PDF.Program.Main(String[] args) in /Users/jmarti/projects/HTML2PDF/HTML2PDF/Program.cs:line 17"
TargetSite: {Void WriteNative(System.ReadOnlySpan`1[System.Byte])}
Static members:
Non-Public members:
Olá, boa noite.
Estou trabalhando na geração de um PDF que é alimentado por duas models. É um PDF que deve conter informações do paciente, médico e resultados dos exames.
Gostaria de saber como poderia usar esse código disponibilizado por você na minha aplicação. Teria que importar tudo para junto do meu projeto?
Como faço pra utilizar css??
Hi,
Had a quick play around, seems conversion of relative reference URLs to absolute references isn't supported by the converter.
I.e.: "../img/jjw_logo_transparent.png" or for sake of Mvc "~/img/jjw_logo_transparent.png"
If this is doable and could be added it would be a massive, massive help.
Thanks!
lambda need : your unzipped package size has to be less than 250MB (262144000 bytes).
Exception: /app/rotativa/Linux/wkhtmltopdf: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory
Pessoal, estou fazendo um projeto para implantação de boleto e estou utilizando esse projeto aqui.
Sabem me dizer se roda tranquilo para o .NET 7?
First of all, I'm very thank you to you share like that a library with us. I want to know how can we set margin of the pdf page. If you provide a solution to me I will be very happy. Thanks for your interest. If there's any donation link I would glad to be send an amount which I can afford.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.