Comments (10)
I had a similar problem a while ago.
You're not using the the converter you added as singleton in Startup.cs. You're creating a new SynchronizedConverter and PdfTools every time your class instantiates. I think this causes issues because you're ending up creating multiple instances of PdfTools without disposing them. (PdfTools implements IDisposable).
I would change your constructor to retrieve the converter from the services by dependency injection instead.
Perhaps something like this:
public MyClassName(IConverter converter)
{
_converter = converter;
}
from dinktopdf.
We changed to a java API with jasper.
from dinktopdf.
Well, it seems to be problem with the DinkToPdf...
I guess that is something about making a singleton instance receive a IDisposable class (PdfTools)
I just made this code and worked like a charm:
using(var tools = new PdfTools())
{
var _pdfConverter = new SynchronizedConverter(tools);
if(!_pdfConverter.Tools.IsLoaded){
_pdfConverter.Error += (object sender, ErrorArgs e) => logger.LogError(e.Message);
_pdfConverter.Finished += (object sender, FinishedArgs e) => logger.LogInformation(e.Success.ToString());
_pdfConverter.Warning += (object sender, WarningArgs e) => logger.LogWarning(e.Message);
_pdfConverter.ProgressChanged += (object sender, ProgressChangedArgs e) => logger.LogInformation(e.Description);
_pdfConverter.PhaseChanged += (object sender, PhaseChangedArgs e) => logger.LogInformation(e.Description);
}
var doc = new HtmlToPdfDocument()
{
Objects =
{
new ObjectSettings
{
HtmlContent = html,
}
}
};
byte[] pdfBytes = _pdfConverter.Convert(doc);
}
from dinktopdf.
I did what you said.
It worked for 30 minutes.
Then I had the same effect, including with the test project (DinkToPdf.TestWebServer).
from dinktopdf.
Interestingly, it works on IIS.
The client has been using it for some time and I have done several tests on my machine.
from dinktopdf.
As erwindamsma said, I put as Singleton and works fine.
from dinktopdf.
It seems to be a problem with https://github.com/wkhtmltopdf/wkhtmltopdf , because it ocours in other librarys that use wkhtmltopdf.
from dinktopdf.
My Problem is, the first time it works perfectly. If I start the second document to convert, it will never end. Any Solutions?
dotnet core version: 2.1.3
from dinktopdf.
@psychos4
For example I created a web application using dotnet core 2.1, take a look because when generate pdf I can push button many times and many PDFs are created.
https://github.com/lkolodziey/UsingDinkToPdf_Example
from dinktopdf.
Hi, @lkolodziey
Have you solved your problem? I am facing the same problem with Dotnet Core SDK 3.0.100-preview5-011568.
from dinktopdf.
Related Issues (20)
- Incorrect page number in the footer displayed
- bootstrap format in html partial view HOT 1
- Not able to convert math related symbols
- It is possible to use html footer with page number ?
- nodejs : Depends: libc6 (>= 2.28) but 2.24-11+deb9u4 is to be installed
- css flex not working HOT 4
- I can't generate on a second request HOT 3
- Erro docker linux HOT 2
- Including image in the footer
- HTML tags removed HOT 1
- libwkhtmltox.dylib for mac M1 chip HOT 1
- One or more errors occurred. (Unable to load shared library 'libwkhtmltox' or one of its dependencies HOT 3
- Can't convert Page url to Pdf on Linux HOT 2
- How can I add background-image?
- Footer not working when there is an image
- Docker Image Error on arm64 Linux EC2 Instance HOT 2
- Outline of globalsetting is not working
- library not loading correctly
- StopThread() cannot stop the newly opened background thread, resulting in unlimited thread growth and eventually breaking the Linux system limit.
- Still maintaned? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dinktopdf.