{"_id":"l-gridlayer-pdflayer","name":"l-gridlayer-pdflayer","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"l-gridlayer-pdflayer","version":"1.0.0","main":"index.js","license":"MIT","dependencies":{"leaflet":"^1.1.0","pdfjs-dist":"^1.8.507"},"devDependencies":{"babel-cli":"^6.24.1","babel-preset-env":"^1.6.0","babelify":"^7.3.0","browserify":"^14.4.0","node-sass":"^4.5.3","watchify":"^3.9.0"},"description":"L.GridLayer.PDFLayer\r ====================","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/kurtraschke/L.GridLayer.PDFLayer.git"},"keywords":["leaflet"],"author":"","bugs":{"url":"https://github.com/kurtraschke/L.GridLayer.PDFLayer/issues"},"homepage":"https://github.com/kurtraschke/L.GridLayer.PDFLayer#readme","gitHead":"11fb04a5eb0d36c411b788078c2c12dc313fc2c5","_id":"l-gridlayer-pdflayer@1.0.0","_nodeVersion":"19.2.0","_npmVersion":"9.6.6","dist":{"integrity":"sha512-qqkFKAR8tLZjkjpMUjLaudkQRk0BOXURjKpkcmHvE73rJT2hPSp2ndxNbXnGV5eLyWTMpl72xP70EAgGEse2cw==","shasum":"d2ccdee33cf0d994273ab0d4662223f574df9c51","tarball":"https://registry.npmjs.org/l-gridlayer-pdflayer/-/l-gridlayer-pdflayer-1.0.0.tgz","fileCount":14,"unpackedSize":12661167,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCCc0grp0EbGeHowDL1wIYLbgFPdA8kuwc4xLj+K1KWNgIhAPreZkLmdPYmm/C4cr6Fn96s2zrH65hxoLF4TaTFTC72"}]},"_npmUser":{"name":"antea-matthew","email":"toledo.matthew@anteash.com"},"directories":{},"maintainers":[{"name":"antea-matthew","email":"toledo.matthew@anteash.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/l-gridlayer-pdflayer_1.0.0_1686755497200_0.11432898450510964"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-14T15:11:37.200Z","1.0.0":"2023-06-14T15:11:37.423Z","modified":"2023-06-14T15:11:37.641Z"},"maintainers":[{"name":"antea-matthew","email":"toledo.matthew@anteash.com"}],"description":"L.GridLayer.PDFLayer\r ====================","homepage":"https://github.com/kurtraschke/L.GridLayer.PDFLayer#readme","keywords":["leaflet"],"repository":{"type":"git","url":"git+https://github.com/kurtraschke/L.GridLayer.PDFLayer.git"},"bugs":{"url":"https://github.com/kurtraschke/L.GridLayer.PDFLayer/issues"},"license":"MIT","readme":"L.GridLayer.PDFLayer\r\n====================\r\n\r\n**A [Leaflet](http://leafletjs.com/) layer for rendering PDF documents with [PDF.js](https://mozilla.github.io/pdf.js/).**\r\n\r\nIntroduction\r\n------------\r\n\r\nThis is `L.GridLayer.PDFLayer`, a Leaflet layer which renders PDF documents on a Leaflet map using PDF.js.  It can be used to render a geographic map in a PDF as an overlay, or, with [`L.CRS.Simple`](http://leafletjs.com/examples/crs-simple/crs-simple.html), to turn Leaflet into a generic viewer for non-geographic PDF documents.\r\n\r\nImplementation\r\n--------------\r\n\r\n`L.GridLayer.PDFLayer` uses PDF.js to render on an `L.GridLayer` of `<canvas>` elements.  Because PDF.js does not support partial rendering (i.e. it renders the entire document for each render operation, regardless of the size of the target canvas or the requested offset), we render to 4x4 metatiles, then extract the relevant portions with `CanvasRenderingContext2D.drawImage()`.  The `bounds` parameter is used to fit and place the PDF page on the map, meaning that (assuming suitably compatible projections), a PDF map can be precisely overlaid on other content in a Leaflet map and treated like any other Leaflet layer.\r\n\r\n### Alternatives\r\n\r\nThe metatile-based scheme is a bit ungainly—when PDF.js supports partial rendering ([#6419](https://github.com/mozilla/pdf.js/issues/6419)), then we can render directly to map tiles, without incurring the performance hit that would entail now.\r\n\r\nAlternatively, there is new support in PDF.js for [rendering to SVG](https://github.com/mozilla/pdf.js/tree/master/examples/svgviewer).  The resulting SVG could then be fed into a slicer, akin to an SVG version of [geojson-vt](https://github.com/mapbox/geojson-vt), and rendered on an `L.GridLayer` of `<svg>` elements instead.\r\n\r\nUse\r\n---\r\n\r\n`L.GridLayer.PDFLayer` is implemented as an ES6 module; the included demonstration uses Babel and Browserify, but other similar toolchains will probably work.\r\n","readmeFilename":"README.md"}