Comments (1)
Me too! I don't know how to stop it, I generate image from HTML, here is my code :
var browserFetcher = new BrowserFetcher();
await browserFetcher.DownloadAsync();
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
{
Headless = true
});
var page = await browser.NewPageAsync();
await page.SetViewportAsync(new ViewPortOptions
{
Width = 500,
Height = 500,
DeviceScaleFactor = 2 // Enlarge the image size by 2 times so that it will be 1000x1000
});
await page.SetContentAsync(content);
await using (var memStream = new MemoryStream())
{
await using (var screenshotStream = await page.ScreenshotStreamAsync())
{
await screenshotStream.CopyToAsync(memStream);
memStream.Position = 0;
var imageName = RandomString(10);
var formFile = new FormFile(memStream, 0, memStream.Length, null, $"{imageName}.jpg");
using (var serviceScope = _serviceProvider.GetService<IServiceScopeFactory>().CreateScope())
{
var uploadFileService = serviceScope.ServiceProvider.GetService<IUploadFileService>();
imageUrl = await uploadFileService.UploadImageAndGetUrl(formFile, "marketReport");
return new ServiceResult { Response = imageUrl };
}
}
}
from puppeteer-sharp.
Related Issues (20)
- Failed to download Chrome for Win64
- How to make link opened in new tab (page) by click on the link and access new opened page HOT 2
- fix: add an option to not wait for fonts when pdf printing
- fix: correct quality condition judgement HOT 2
- fix: do not allow switching tabs while the screenshot operation is in progress
- fix: don't rely on Buffer to be present
- fix: make sure bindings are working after a page is restored from bfcache
- fix: support evaluateOnNewDocument for out-of-process frames
- fix: support out-of-process iframes in exposeFunction
- PuppeteerSharp "leaks" temporary files on exit HOT 10
- fix: execution contexts might be created before previous is destroyed
- fix: reset the viewport after taking a fullPage screenshot if defaultViewport is null
- fix: use RAF-based polling for ARIA selectors
- Some configurations of MarginOption lead to -> startIndex ('-1') must be a non-negative value. (Parameter 'startIndex') HOT 1
- CookieSourceScheme Enum Missing StringEnumConverter JsonConverter HOT 1
- SetRequestInterceptionAsync(false) throwing TargetClosedException (Network.setCacheDisabled) HOT 1
- No Space Available HOT 1
- Disposal of CdpElementHandle.Handle HOT 1
- fix: include Puppeteer version into utility world name
- Read-only file system HOT 2
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 puppeteer-sharp.