Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To export an Angular 11 element as a JPEG, use html2canvas to render the element into a browser canvas, then call canvas.toDataURL('image/jpeg', quality) and download the resulting data URL. This is a client-side rendering approximation, not a pixel-perfect browser screenshot: CSS support and access to external images can affect the result.
Install html2canvas and mark the element
In your Angular project, install the package:
npm install html2canvas
Add a template reference to the component or section you want to export. Keep the download button outside that region if it should not appear in the JPEG.
<section #capture class="capture">
<h1>Monthly report</h1>
<p>This content will be exported.</p>
</section>
<button type="button" (click)="downloadJpeg()">Download JPEG</button>
Capture the Angular view and download a JPEG
Import the library and use @ViewChild to access the rendered element. The following Angular 11 component captures the element, uses the display’s pixel ratio for output scale, and downloads a JPEG at 90% quality:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsimport { Component, ElementRef, ViewChild } from '@angular/core';
import html2canvas from 'html2canvas';
@Component({
selector: 'app-export',
template: `
<section #capture class="capture">
<h1>Monthly report</h1>
<p>This content will be exported.</p>
</section>
<button type="button" (click)="downloadJpeg()">Download JPEG</button>
`
})
export class ExportComponent {
@ViewChild('capture', { static: false })
capture!: ElementRef<HTMLElement>;
async downloadJpeg(): Promise<void> {
const element = this.capture?.nativeElement;
if (!element) {
return;
}
const canvas = await html2canvas(element, {
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 sequence is element to canvas to JPEG data URL. The call to html2canvas returns a Promise, so keep the capture in an asynchronous handler. With { static: false }, the view query is available after Angular has initialized the view; the button’s click handler runs after that point. Replace the sample content and filename with your own.
#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)
Wait for content the user expects in the image
Run the capture only after the view has rendered and any required images and fonts have loaded. If the component is conditionally displayed, wait until it exists before calling downloadJpeg(). A delayed or incomplete capture may omit content even when the TypeScript code is otherwise correct.
Choose image quality, resolution, and crop
toDataURL takes an image MIME type and, for JPEG, a quality value from 0 to 1. Higher values generally preserve more detail at the cost of a larger file. Start around 0.85 to 0.95, then inspect the actual file for text clarity and size. The example’s 0.9 is a starting point, not a guarantee about file size.
The scale option controls the canvas pixel scale. Using window.devicePixelRatio can produce sharper output on high-DPI displays, but it also increases pixel dimensions and memory use. For consistent output dimensions across different displays, choose an explicit scale such as 1 instead:
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC 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 & 11Rank #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(element, {
scale: 1,
useCORS: true
});
To capture a portion of the target, provide crop coordinates and dimensions. Coordinates are relative to the target element’s rendered content; check the result at the scale you plan to use.
const canvas = await html2canvas(element, {
x: 0,
y: 0,
width: 800,
height: 600,
scale: 1
});
JPEG does not preserve transparency. If your design depends on transparent areas, set an appropriate background on the captured content before rendering, or choose an image format that supports transparency instead of JPEG.
Exclude controls and overlays
Mark elements that should not be included with the library’s ignore attribute:
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.
<button data-html2canvas-ignore>Do not include in export</button>
This is useful for export controls, floating actions, or overlays that are part of the live interface but not the intended image. You can also pass capture options such as ignoreElements when exclusion needs to be selected in code.
Handle cross-origin images and iframes
Setting useCORS: true asks the renderer to load images using cross-origin access, but it does not override browser security. An external image host must send compatible CORS headers for its image to be usable in a readable canvas. If it does not, the image may be missing or the canvas may become tainted; a tainted canvas cannot be exported with toDataURL().
For images you control, configure the image server to allow the origin of your Angular application. If that is not possible, serve the asset through a proxy you control that is configured to fetch it safely and return suitable headers. Do not assume that adding useCORS: true alone fixes a third-party host.
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.
Same-origin iframe content can be traversed, but browser same-origin policy prevents reading the contents of a cross-origin iframe. This method therefore cannot reliably export a component whose required content lives inside an inaccessible third-party frame.
Know what html2canvas can and cannot reproduce
html2canvas reconstructs the selected DOM subtree into a canvas in the browser; it is not a native screenshot engine. Its output may differ from the browser’s on-screen rendering when a CSS property is unsupported or when external assets cannot be read. Test the exact component, styles, browser, fonts, and image hosts used by your application rather than assuming that all Angular 11 views will render identically.
For a reliable check, compare the exported image against the rendered component at the same viewport size. Look for missing backgrounds, altered typography, absent images, clipping, and layout differences. If a particular effect does not translate, simplify or adjust the export-specific styles rather than expecting the renderer to reproduce every browser feature.
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.
Performance and file-size considerations
- Large elements: A large capture at a high pixel scale creates a larger canvas and can use substantially more browser memory. Capture only the element and region the user needs, and lower the scale if the resulting image is too large.
- High-DPI output: Device pixel ratio can improve sharpness but may make processing slower and output dimensions much bigger. Use an explicit scale when predictable dimensions matter more than matching the user’s display density.
- JPEG quality: Reduce the quality value to trade some image detail for a smaller file. Inspect text and fine lines, which can show compression artifacts.
- Downloads: The example creates a data URL in memory and triggers a download through an anchor element. For very large captures, account for the memory cost of the canvas and encoded data.
Troubleshooting common failures
| Symptom | Likely cause | What to do |
|---|---|---|
| The export is blank or missing content. | The element was not rendered yet, or capture ran before required images or fonts loaded. | Call the method after the view exists and wait for needed assets before capturing. Confirm the template reference points to the intended element. |
toDataURL fails with a security error. |
A cross-origin image tainted the canvas. | Use an image host that sends compatible CORS headers, or load the asset through a configured proxy. useCORS: true cannot grant access by itself. |
| An external image is absent. | The remote host did not permit CORS access, or the resource did not load before capture. | Check the image request and response headers, then use a permitted host or proxy and wait for the asset to load. |
| The image differs from the page. | html2canvas’s DOM reconstruction does not support or exactly reproduce a style or resource. | Identify the specific difference and adjust export-specific CSS or the content. Test the component and asset set actually in use. |
| The image is blurry. | The canvas scale is too low for the intended display size. | Increase scale or use window.devicePixelRatio, while checking the resulting dimensions and memory use. |
| The capture is slow or consumes too much memory. | The selected area, pixel scale, or both are too large. | Capture a smaller region, reduce scale, and avoid unnecessary high-resolution output. |
| The export includes a button or floating overlay. | The element is inside the captured subtree and has not been excluded. | Add data-html2canvas-ignore to it or exclude it through capture configuration. |
| Content inside an iframe is unavailable. | The frame is cross-origin and blocked by browser security. | Use same-origin content or a separate authorized capture approach; client-side code cannot read a cross-origin frame’s DOM. |
Or skip the browser setup
If your goal is a screenshot of a public webpage rather than a particular Angular component in the current user’s browser, ScreenshotNeo can return an image or PDF from one GET request. It is a different approach from rendering an Angular DOM element with html2canvas: use the browser method above when you need to export a specific in-app component.
Install no browser automation stack for this call; replace the URL and API key with your target and credentials. See the ScreenshotNeo documentation for request options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, popups, and chat widgets before the shot; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots. The Free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000.
Recommended Free Tools
Sign up free for 1,000 screenshots a month, with no card required.
When to use this approach
Use html2canvas when the image must represent a specific rendered component in your Angular application and you want the user to create it in the browser. Choose the output scale and JPEG quality for your needs, wait for the content to be ready, and validate the actual result wherever external assets or complex styling are involved. For a URL-based webpage capture instead of an in-app element export, use the separate ScreenshotNeo request above.
Frequently Asked Questions
Does html2canvas create a screenshot of the entire browser window?
Not with the example here: it renders the DOM subtree represented by the selected element. The method is intended for a component or region, not a guaranteed full-browser screenshot.
Can I use this to export content inside a third-party iframe?
Not when the iframe is cross-origin. Browser same-origin security blocks access to its DOM.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →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.

