To convert an Angular 11 element to a JPEG in the browser, render the view, pass the element to html2canvas, convert the returned canvas with toDataURL('image/jpeg', quality), and download the resulting data URL. This captures a selected DOM subtree rather than the entire application.
What the conversion actually does
The workflow has two explicit stages:
- Angular renders the component’s DOM and styles.
html2canvasreconstructs the selected subtree in a canvas. - The browser encodes that canvas as JPEG and downloads it. The conversion is not a native browser screenshot and is not guaranteed to reproduce every CSS property exactly.
Consequently, capture only after the component, images and fonts needed in the output have finished loading. Complex CSS, external assets and browser security rules can change the result.
Prerequisites for an Angular 11 JPEG export
- An Angular 11 application with a component containing the content to export.
- The
html2canvaspackage installed in that application. - A browser that supports
HTMLCanvasElement.toDataURL()and downloads created links. - Compatible CORS headers (or a proxy) for images hosted on another origin.
Install the library from the application directory:
npm install html2canvas
Complete Angular 11 example
1. Mark the element in the template
Assign a template reference to the exact element that should become the JPEG. Add an export button outside the capture area if you do not want the button in the image.
#1 Best Overall
- AV To HDMI Converter 3.0 - Convert & Upscale RCA / S-Video / Analog Video Input to HDMI (TV or Monitor) at 1080P or 720P - Plug and Play Adapter with No Computer or Drivers Required
- Upscaler Compatible with VCR, VHS, Camcorders, Hi8, Gaming Systems, Set-Top Boxes, DVD Players, & More. RCA/AV/Composite and S-Video Input. HDMI Output. Works with PAL and NTSC. (Important Note: Does NOT Downscale HDMI to RCA/AV/S-Video)
- NEW! Remote Control Included - Fine Tune Your Video's Image Quality By Adjusting Brightness, Contrast, Saturation, Hue, Resolution (1080P or 720P), Aspect Ratio (Preserve Original 4:3 Look with Black Bars or Stretch To 16:9 HD Widescreen To Fill Your TV Screen)
- NEW! S-Video Input - Allows S-Video Input From Camcorder, VCR, DVD Player, & More - Providing The Highest Possible Video Quality From These Sources (S-Video Cable Not Included - RCA/AV Cable Required For Audio Signal)
- Includes 2-Year Warranty & Tech Support from ClearClick, a USA-Based Small Business (Extendable to 3 Years for Free - See User's Manual)
<section #capture class="capture">
<h1>Monthly report</h1>
<p>This Angular view will be saved as a JPEG.</p>
<div class="metric">42 completed tasks</div>
</section>
<button type="button" (click)="downloadJpeg()">
Download JPEG
</button>
To exclude an element that is inside the section, add data-html2canvas-ignore to it:
<button data-html2canvas-ignore type="button">Edit</button>
2. Capture the element and download it
import { Component, ElementRef, ViewChild } from '@angular/core';
import html2canvas from 'html2canvas';
@Component({
selector: 'app-export',
templateUrl: './export.component.html'
})
export class ExportComponent {
@ViewChild('capture', { static: false })
capture!: ElementRef<HTMLElement>;
async downloadJpeg(): Promise<void> {
const canvas = await html2canvas(this.capture.nativeElement, {
scale: window.devicePixelRatio,
useCORS: true
});
const jpegUrl = canvas.toDataURL('image/jpeg', 0.9);
const link = document.createElement('a');
link.download = 'angular-capture.jpg';
link.href = jpegUrl;
link.click();
}
}
The ViewChild reference is available after Angular has created the view because static is false. Calling the method from a user action ensures that the section normally exists; do not call it before the view has rendered.
Control JPEG quality, sharpness and size
JPEG quality
The second argument to toDataURL is a number from 0 to 1. A value such as 0.9 is a practical starting point. Lower values generally reduce the file size but introduce more compression artifacts, especially around small text and sharp edges. Check the resulting file for your actual design rather than assuming one value is best.
const jpegUrl = canvas.toDataURL('image/jpeg', 0.85);
JPEG has no transparency. Transparent canvas areas are represented by the format’s background behavior, so use a solid background when the output must look consistent.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Retina and output dimensions
scale: window.devicePixelRatio increases the canvas pixel dimensions on high-density displays and usually makes text sharper. It also increases memory use and encoding time. For a predictable export size, provide your own scale instead:
Rank #2
- Composite to HDMI Converter: Converts analog AV composite (Yellow, White, Red) input to HDMI 720P/1080P (60HZ) output, displayed on smart TV, Projector or HD Display, which bring back your old and cherish memories.
- Plug to Play: This HDMI Converter no extra drivers need, just plug and play,easy to use. Please hook up the USB Power Cable (included) to 5V power source during use. Note: The Video Converters only support converts AV to HDMI, can't converts HDMI to AV.
- Widely Used: This composite to hdmi adapter is widely applied to PS1, PS2, PS3, Xbox, N64, Wii, STB, VHS, VCR, DVD Players and other devices with standard composite AV input. Note: It can only be used when PS2 is set to RGB output.
- Wide Compatibility: This Video Audio Converter Adapter supports source formats of PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV. Provide advanced signal processing with great precision, colors, resolutions, and details. Important Note: This converter can't improve video quality!
- Attention & Package: Please ensure to connect this av hdmi converter to power source to make it work. Package include: 1*AV to HDMI Adaptor, 1*USB Power Cable(adapter not included), 1*User Manual.
const canvas = await html2canvas(this.capture.nativeElement, {
scale: 2,
backgroundColor: '#ffffff',
useCORS: true
});
The resulting image dimensions are the rendered element dimensions multiplied by the scale. Very large, tall sections can exceed browser canvas or memory limits; capture a smaller region or split the content into several images.
Capture only a region
Use crop coordinates when the element contains extra space or when you need a sub-rectangle. Coordinates are relative to the document/capture rendering used by html2canvas:
const canvas = await html2canvas(this.capture.nativeElement, {
x: 20,
y: 10,
width: 800,
height: 450,
scale: 2,
useCORS: true
});
When possible, selecting a smaller element with ViewChild is easier to reason about than maintaining crop coordinates as the layout changes.
Make the capture happen at the right time
A click handler is often sufficient for a static component. For data-driven views, wait until the data has arrived and Angular has rendered it. Images and web fonts must also be ready, otherwise the canvas may contain blank areas or fallback fonts.
async downloadAfterAssetsLoad(): Promise<void> {
await document.fonts?.ready;
const images = Array.from(
this.capture.nativeElement.querySelectorAll('img')
);
await Promise.all(images.map(img => {
if (img.complete) return Promise.resolve();
return new Promise<void>(resolve => {
img.addEventListener('load', () => resolve(), { once: true });
img.addEventListener('error', () => resolve(), { once: true });
});
}));
const canvas = await html2canvas(this.capture.nativeElement, {
scale: window.devicePixelRatio,
useCORS: true
});
const link = document.createElement('a');
link.download = 'report.jpg';
link.href = canvas.toDataURL('image/jpeg', 0.9);
link.click();
}
If the component changes immediately before capture, wait for the change-detection/render cycle before invoking html2canvas. A deliberate short delay can help an animation settle, but waiting for the actual image/font load event is more reliable.
Rank #3
- Input: RCA, Output: HDMI; Converts Analog Composite Input to HDMI 1080p or 720p Output.
- RCA to HDMI Converter - Plug and Play, Easy to Install and Operate, Powered by External USB Cable.
- RCA to HDMI Converter supports connecting HDMI capture card (note that we do not include HDMI capture card).
- Composite to HDMI Converter Widely Applied to PS One, PS2, PS3, N64, WII, WII U, STB, VHS, VCR, Blue-Ray DVD Players Projector (Note: It can only be used when PS2 is set to RGB output).
- AV to HDMI Converter Support PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N tv format.
Cross-origin images, CORS and iframes
Images from another origin
useCORS: true requests images in a way that can preserve readable pixels, but it works only when the image server sends compatible CORS headers. The option does not bypass browser security. If the server does not authorize your Angular origin, the image can taint the canvas and toDataURL will fail or the image will be omitted.
- Configure the image host to return an appropriate
Access-Control-Allow-Originvalue. - Use an application-controlled proxy that retrieves the image and serves it with suitable headers.
- As a last resort, omit the external image or replace it with a same-origin asset.
Do not assume that adding crossorigin to an img element alone fixes a server that does not send CORS headers.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Iframes
Same-origin iframe content can be traversed in situations supported by the library. Cross-origin iframe documents cannot be read by your Angular page because the browser’s same-origin policy blocks access. Capture the iframe application from within its own origin, request an image from that application, or use a server-side screenshot service instead.
CSS and content limitations
html2canvas recreates the DOM in a canvas; it does not ask the browser for a compositor-level screenshot. Unsupported or partially supported CSS, pseudo-elements, filters, complex shadows, animations and third-party widgets may differ from what you see on screen. The documentation explicitly cautions that the result may not be 100% accurate to the real representation.
- Freeze animations and transitions before capture.
- Use a capture-only class with stable dimensions and a solid background.
- Hide controls, overlays and focus indicators with
data-html2canvas-ignoreor a temporary CSS class. - Test every browser and asset combination your users will use; Angular 11 does not make output identical across browsers.
SVG, web fonts and images should be tested with the exact URLs and loading strategy used in production. A local development result does not prove that production CDN headers or authentication will work.
Rank #4
- RCA to HDMI Converter: Converts analog RCA composite (Yellow, White, Red) input to HDMI 720P/1080P (60HZ) output,displayed on HDTV/Monitor,which can bring back your childhood memories.
- Plug to Play: ABLEWE Mini RCA to HDMI converter no extra drivers need, just plug and play,easy to use.Please hook up the USB power cable (included) to 5V power source during use.
- Wide Compatibility: Support source formats of PAL, NTSC3.58, NTSC4.43, SECAM, PAL/M, PAL/N standard TV. Provide advanced signal processing with great precision, colors, resolutions, and details.
- Widely Used:Widely applied to PS2,PS3,Xbox,N64, WII, STB, VHS, VCR, DVD Players and other devices with standard composite AV input.
- Attention & Package:Please ensure to connect this rca to hdmi converter to power source to make it work.Package include:1*RCA to HDMI Converter,1*usb power cable(adapter not included),1*User Manual.
Download alternatives and blob handling
The data URL approach is simplest for ordinary component-sized images. For very large output, a blob can avoid keeping as much base64 text in JavaScript memory:
Recommended Free Tools
canvas.toBlob(blob => {
if (!blob) return;
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.download = 'angular-capture.jpg';
link.href = url;
link.click();
URL.revokeObjectURL(url);
}, 'image/jpeg', 0.9);
Keep the object URL alive until the download has been initiated. If your browser or application policy blocks programmatic downloads, show the generated image in a new view and let the user save it manually.
Troubleshooting Angular JPEG exports
| Symptom | Likely cause | Fix |
|---|---|---|
capture is undefined |
The method ran before the view existed, or the reference is inside an inactive structural directive. | Call it after rendering (usually from a button), keep static: false, and ensure the conditional section is visible. |
| External images are missing | The image host did not provide compatible CORS headers. | Configure CORS, proxy the assets, or use same-origin files; keep useCORS: true when the server is configured. |
SecurityError from toDataURL |
A cross-origin resource tainted the canvas. | Find every external image, canvas or iframe in the subtree and make each resource CORS-compatible or remove it. |
| Text or fonts look wrong | Fonts were still loading or the CSS is not reproduced by the library. | Await document.fonts.ready, wait for images, disable animations and test the relevant CSS in the target browser. |
| The export is blurry | The canvas scale is too low for the display density. | Use window.devicePixelRatio or a controlled scale such as 2, while monitoring memory. |
| The tab freezes or crashes | The capture is too large at the selected scale. | Reduce scale, crop the region, capture sections separately, or move capture to a service designed for full pages. |
| The JPEG includes the export button | The button is inside the referenced element. | Move it outside the section or add data-html2canvas-ignore. |
When a browser DOM capture is the wrong tool
This approach is appropriate when the user is looking at an Angular view and needs a local download. It is less suitable for scheduled captures, server-side rendering, cross-origin pages you do not control, consistent screenshots across browsers, or pages that require authentication and complex navigation. In those cases, a screenshot API can run the capture remotely and return an image or PDF.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup: ScreenshotNeo
ScreenshotNeo is a website screenshot API and MCP server. One GET request returns a PNG, JPEG or WebP screenshot (or a PDF), so you do not need to package browser capture code in your Angular bundle. For an Angular route that is reachable by the service, use the API documented at https://screenshotneo.com/docs/:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://your-app.example/report -o report.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://your-app.example/report"}, timeout=90)
r.raise_for_status()
open("report.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://your-app.example/report' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const data = Buffer.from(await res.arrayBuffer());
await import('node:fs/promises').then(fs => fs.writeFile('report.webp', data));
ScreenshotNeo accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets before capture; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers. Its MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchEvery plan includes its features, including full-page and selector capture, dark mode, device presets, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agent, authorization, timezone, geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed links, asynchronous webhooks, bulk capture of up to 100 URLs per call, a usage API and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify a migration.
Best Value
- Convert RCA to HDMI Instantly – BD&M RCA to HDMI Converter easily converts analog RCA/composite AV signals to HDMI output, allowing you to connect older devices to modern HDTVs, monitors, and projectors with clear video and audio quality.
- Wide Device Compatibility – Supports VHS players, VCRs, DVD players, camcorders, retro gaming consoles, and more including PS1, PS2, PS3, Xbox, N64, Wii, and older AV devices with standard RCA output.
- 1080P HDMI Output – Advanced signal processing delivers stable and sharp video output with support for 720P/1080P HDMI resolution, improving compatibility with modern TVs and displays.
- Plug & Play Setup – No drivers or software required. Simply connect the RCA cables, HDMI cable, and included USB power cable for quick and easy installation in minutes.
- Compact & Reliable Design – Lightweight mini converter design makes it perfect for home entertainment setups, retro gaming, travel, or converting old media collections while maintaining stable performance.
| Plan | Included shots | Price |
|---|---|---|
| Free | 1,000 per month | $0, no card |
| Starter | 3,000 | $5 |
| Growth | 15,000 | $15 |
| Pro | 60,000 | $39 |
| Scale | 250,000 | $99 |
| Business | 1,000,000 | $249 |
Yearly billing provides two months free. Sign up for ScreenshotNeo to get 1,000 screenshots each month at no charge and without a card.
Choosing between html2canvas and ScreenshotNeo
- Choose html2canvas when the capture is a user-initiated export of a same-origin Angular component and you need the work to stay in the browser.
- Choose ScreenshotNeo when you need repeatable URL captures, full-page output, cleanup of consent and popup clutter, server-side handling of difficult pages, PDF output or AI-agent access through MCP.
- Use both when users need an immediate local component export but your operations also need scheduled or shared captures of deployed routes.
FAQ
Can Angular 11 create a JPEG without a server?
Yes. html2canvas and the browser canvas APIs perform the conversion locally. The main restrictions are rendering fidelity and cross-origin access.
Can I capture the whole Angular page instead of one component?
Pass a top-level element such as the application host, but expect substantially higher memory use. A dedicated full-page capture service is often more reliable for long pages.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Why is a JPEG a poor choice for transparent graphics?
JPEG does not preserve transparency. Use a solid background or choose a format that supports an alpha channel when transparency is required.
Does useCORS allow private images?
No. Authentication and CORS must both be configured correctly. The browser still enforces origin and credential rules.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

