Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@open-pioneer/printing
Advanced tools
Readme
This package provides a UI component and an API to export the current map view as a printable file.
The UI allows users to enter a title, switch between the printing file formats, and trigger the export.
The supported file formats are PDF and PNG. If file format is PNG, the current map canvas is exported as an image. If file format is PDF, the map is printed as a DIN A4 landscape PDF file, preserving the current map scale and showing the current map center in the middle of the exported map image.
The package also provides a printing service that creates an image of the map as a canvas element or a data URL for a PNG image.
To integrate the printing in your app, insert the following snippet and reference a map ID:
<Printing mapId="map_id" />
To use the printing service, inject it as following:
// build.config.mjs
import { defineBuildConfig } from "@open-pioneer/build-support";
export default defineBuildConfig({
ui: {
references: ["printing.PrintingService"]
}
});
const printingService = useService<PrintingService>("printing.PrintingService");
// Triggers printing and waits for the result.
const printResult = await printingService.printMap(map);
// An HTMLCanvasElement containing an image of the map
const canvas = printResult.getCanvas();
// For convenience, an image encoded as PNG (i.e. `data:image/png;base64,...`)
const dataURL = printResult.getPNGDataURL();
It is configurable whether to add an overlay element above the map or not. The default overlay blocks user interactions while the map is printing. The text content of the overlay can be overwritten by configuring a custom text.
Example:
const printResult = await printingService.printMap(map, {
blockUserInteraction: true,
overlayText: "custom text"
});
The printed map contains all map elements, visible layers, scale-bar and a title. If the user does not enter a title, the map is printed without title.
To prevent custom elements from showing in the printed map, add the classname printing-hide
to the elements.
Apache-2.0 (see LICENSE
file)
FAQs
This package provides a UI component to export the current map view as a printable file.
The npm package @open-pioneer/printing receives a total of 4 weekly downloads. As such, @open-pioneer/printing popularity was classified as not popular.
We found that @open-pioneer/printing demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.