svg-to-pdfkit
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -16,3 +16,3 @@ In this folder you will find demo and test pages that use SVG-to-PDFKit: | ||
### Tests | ||
Tests are SVG files downloaded from https://www.w3.org/Graphics/SVG/WG/wiki/Test_Suite_Overview and embeded into a javascript 'Tests.js' file. Test files containing animations, filters, scripting, CSS styling or links have been removed, as these SVG features are out of this repository's scope. | ||
Tests are SVG files downloaded from https://www.w3.org/Graphics/SVG/WG/wiki/Test_Suite_Overview and embeded into a javascript `tests1.js` file. Test files containing animations, filters, scripting, CSS styling or links have been removed, as these SVG features are out of this repository's scope. Other new tests are added in the `tests2.js` file. | ||
@@ -27,5 +27,5 @@ Each SVG file is converted into PDF with SVG-to-PDFKit and <a href="https://github.com/devongovett/pdfkit">PDFKit</a>, and the resulting PDF is rendered as an image with <a href="https://github.com/mozilla/pdf.js/">PDFjs</a>. The same SVG file is drawn into a canvas by the browser (it only works in Chrome). The two images are then compared with <a href="https://github.com/Huddle/Resemble.js/">Resemble.js</a>. | ||
| --- | --- | --- | | ||
| Failed tests | 28 | 12.2% | | ||
| Passed tests | 201 | 87.8% | | ||
| **Total tests** | **229** | | | ||
| Failed tests | 21 | 9.3% | | ||
| Passed tests | 206 | 90.7% | | ||
| **Total tests** | **227** | | | ||
@@ -36,9 +36,2 @@ #### Failed tests because of bugs or missing features in SVG-to-PDFKit | ||
| --- | --- | | ||
| paths-data-20-f.svg | Special case in arcTo path | | ||
| pservers-grad-17-b.svg | Gradient fallback | | ||
| pservers-grad-20-b.svg | Gradient fallback | | ||
| pservers-pattern-03-f.svg | Pattern fallback | | ||
| pservers-pattern-09-f.svg | Pattern fallback | | ||
| struct-symbol-01-b.svg | Symbol | | ||
| struct-use-09-b.svg | Symbol | | ||
| text-align-05-b.svg | Vertical text | | ||
@@ -70,21 +63,25 @@ | text-align-06-b.svg | Vertical text | | ||
| --- | --- | | ||
| color-prop-05-t.svg | Chrome bug | | ||
| pservers-grad-02-b.svg | PDFjs bug | | ||
| pservers-grad-04-b.svg | PDFjs bug | | ||
| additional-test-01.svg | Chrome bug https://crbug.com/450368 | | ||
| additional-test-02.svg | Chrome bug | | ||
| color-prop-05-t.svg | Specifications conflict | | ||
| pservers-grad-02-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-04-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-05-b.svg | PDFjs bug | | ||
| pservers-grad-06-b.svg | PDFjs bug | | ||
| pservers-grad-06-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-07-b.svg | PDFjs bug | | ||
| pservers-grad-08-b.svg | PDFjs bug | | ||
| pservers-grad-10-b.svg | PDFjs bug | | ||
| pservers-grad-11-b.svg | PDFjs bug | | ||
| pservers-grad-12-b.svg | PDFjs bug | | ||
| pservers-grad-11-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-12-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-13-b.svg | PDFjs bug | | ||
| pservers-grad-14-b.svg | PDFjs bug | | ||
| pservers-grad-15-b.svg | PDFjs bug | | ||
| pservers-grad-14-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-15-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-grad-16-b.svg | PDFjs bug | | ||
| pservers-grad-17-b.svg | PDFjs bug | | ||
| pservers-grad-18-b.svg | PDFjs bug | | ||
| pservers-grad-20-b.svg | PDFjs bug | | ||
| pservers-grad-21-b.svg | Chrome bug + PDFjs bug | | ||
| pservers-grad-22-b.svg | PDFjs bug | | ||
| pservers-grad-22-b.svg | PDFjs bug https://git.io/vQqgG | | ||
| pservers-pattern-01-b.svg | PDFjs bug | | ||
| styling-inherit-01-b.svg | PDFjs bug | | ||
| text-text-01-b.svg | Chrome bug | |
{ | ||
"name": "svg-to-pdfkit", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Insert SVG into a PDF document created with PDFKit", | ||
@@ -20,9 +20,9 @@ "author": { | ||
}, | ||
"readme": "# SVG-to-PDFKit\nInsert SVG into a PDF document created with PDFKit.\n\n#### Use:\n\n SVGtoPDF(doc, svg, x, y, options);\n \n If you prefer, you can add the function to the PDFDocument prototype:\n\n PDFDocument.prototype.addSVG = function(svg, x, y, options) {\n return SVGtoPDF(this, svg, x, y, options), this;\n };\n\n And then simply call:\n \n doc.addSVG(svg, x, y, options);\n\n#### Parameters:\n\n doc [PDFDocument] = the PDF document created with PDFKit\n svg [SVGElement or string] = the SVG object or XML code\n x, y [number] = the position where the SVG will be added\n options [Object] = >\n - width, height [number] = initial viewport, by default it's the page dimensions\n - preserveAspectRatio [string] = override alignment of the SVG content inside its viewport\n - useCSS [boolean] = use the CSS styles computed by the browser (for SVGElement only)\n - fontCallback [function] = function called to get the fonts, see source code\n - imageCallback [function] = same as above for the images (for Node.js)\n - assumePt [boolean] = assume that units are PDF points instead of SVG pixels\n\n#### Demos:\n <a href=\"https://alafr.github.io/SVG-to-PDFKit/examples/demo.htm\" target=\"_blank\">https://alafr.github.io/SVG-to-PDFKit/examples/demo.htm</a>\n\n <a href=\"https://alafr.github.io/SVG-to-PDFKit/examples/options.htm\" target=\"_blank\">https://alafr.github.io/SVG-to-PDFKit/examples/options.htm</a>\n\n#### Supported:\n - shapes: rect, circle, path, ellipse, line, polyline, polygon\n - special elements: use, nested svg\n - text elements: text, tspan, textPath\n - text attributes: x, y, dx, dy, rotate, text-anchor, textLength, word-spacing, letter-spacing, font-size\n - styling: with attributes only\n - colors: fill, stroke & color (rgb, rgba, hex, string), fill-opacity, stroke-opacity & opacity\n - units: all standard units\n - transformations: transform, viewBox & preserveAspectRatio attributes\n - clip paths & masks\n - images\n - fonts\n - gradients\n - patterns\n\n#### Unsupported:\n - links (<a href=\"https://github.com/alafr/SVG-to-PDFKit/issues/18\">#18</a>)\n - filters\n - text attributes: text-decoration, font-variant, writing-mode, unicode-bidi\n - foreignObject (<a href=\"https://github.com/alafr/SVG-to-PDFKit/issues/37\">#37</a>)\n - other things I don't even know they exist\n\n#### Warning:\n - Use an updated PDFKit version (≥0.8.1): see <a href=\"https://github.com/alafr/pdfkit/wiki/How-to-install-and-build-a-PDFKit-branch\">here</a> how to build it, or use the prebuilt file in the <a href=\"https://github.com/alafr/SVG-to-PDFKit/tree/master/examples\">examples</a> folder.\n - There are bugs, please send issues and/or pull requests.\n \n#### License:\n <a href=\"http://choosealicense.com/licenses/mit/\">MIT</a>\n\n#### Other useful projects:\n - <a href=\"https://github.com/devongovett/pdfkit\">PDFKit</a>, the JavaScript PDF generation library for Node and the browser.\n - For inserting SVG graphics into a PDFKit document there is also <a href=\"https://github.com/devongovett/svgkit\">svgkit</a>.\n - For the opposite conversion, from PDF to SVG, you can use <a href=\"https://github.com/mozilla/pdf.js\">Mozilla's PDF.js</a>.\n", | ||
"readme": "# SVG-to-PDFKit\nInsert SVG into a PDF document created with PDFKit.\n\n#### Use:\n\n SVGtoPDF(doc, svg, x, y, options);\n \n If you prefer, you can add the function to the PDFDocument prototype:\n\n PDFDocument.prototype.addSVG = function(svg, x, y, options) {\n return SVGtoPDF(this, svg, x, y, options), this;\n };\n\n And then simply call:\n \n doc.addSVG(svg, x, y, options);\n\n#### Parameters:\n\n doc [PDFDocument] = the PDF document created with PDFKit\n svg [SVGElement or string] = the SVG object or XML code\n x, y [number] = the position where the SVG will be added\n options [Object] = >\n - width, height [number] = initial viewport, by default it's the page dimensions\n - preserveAspectRatio [string] = override alignment of the SVG content inside its viewport\n - useCSS [boolean] = use the CSS styles computed by the browser (for SVGElement only)\n - fontCallback [function] = function called to get the fonts, see source code\n - imageCallback [function] = same as above for the images (for Node.js)\n - warningCallback [function] = function called when there is a warning\n - assumePt [boolean] = assume that units are PDF points instead of SVG pixels\n - precision [number] = precision factor for approximative calculations (default = 3)\n\n#### Demos:\n <a href=\"https://alafr.github.io/SVG-to-PDFKit/examples/demo.htm\" target=\"_blank\">https://alafr.github.io/SVG-to-PDFKit/examples/demo.htm</a>\n\n <a href=\"https://alafr.github.io/SVG-to-PDFKit/examples/options.htm\" target=\"_blank\">https://alafr.github.io/SVG-to-PDFKit/examples/options.htm</a>\n\n#### Supported:\n - shapes: rect, circle, path, ellipse, line, polyline, polygon\n - special elements: use, nested svg\n - text elements: text, tspan, textPath\n - text attributes: x, y, dx, dy, rotate, text-anchor, textLength, word-spacing, letter-spacing, font-size\n - styling: with attributes only\n - colors: fill, stroke & color (rgb, rgba, hex, string), fill-opacity, stroke-opacity & opacity\n - units: all standard units\n - transformations: transform, viewBox & preserveAspectRatio attributes\n - clip paths & masks\n - images\n - fonts\n - gradients\n - patterns\n\n#### Unsupported:\n - links (<a href=\"https://github.com/alafr/SVG-to-PDFKit/issues/18\">#18</a>)\n - filters\n - text attributes: text-decoration, font-variant, writing-mode, unicode-bidi\n - foreignObject (<a href=\"https://github.com/alafr/SVG-to-PDFKit/issues/37\">#37</a>)\n - other things I don't even know they exist\n\n#### Warning:\n - Use an updated PDFKit version (≥0.8.1): see <a href=\"https://github.com/alafr/pdfkit/wiki/How-to-install-and-build-a-PDFKit-branch\">here</a> how to build it, or use the prebuilt file in the <a href=\"https://github.com/alafr/SVG-to-PDFKit/tree/master/examples\">examples</a> folder.\n - There are bugs, please send issues and/or pull requests.\n \n#### License:\n <a href=\"http://choosealicense.com/licenses/mit/\">MIT</a>\n\n#### Other useful projects:\n - <a href=\"https://github.com/devongovett/pdfkit\">PDFKit</a>, the JavaScript PDF generation library for Node and the browser.\n - For inserting SVG graphics into a PDFKit document there is also <a href=\"https://github.com/devongovett/svgkit\">svgkit</a>.\n - For the opposite conversion, from PDF to SVG, you can use <a href=\"https://github.com/mozilla/pdf.js\">Mozilla's PDF.js</a>.\n", | ||
"readmeFilename": "README.md", | ||
"homepage": "https://github.com/alafr/SVG-to-PDFKit#readme", | ||
"_id": "svg-to-pdfkit@0.1.2", | ||
"_shasum": "5409ed37dcb94749caa7639e26eedd73e8e0d6e4", | ||
"_id": "svg-to-pdfkit@0.1.3", | ||
"_shasum": "5f2ce29d1cf9ac89121a4bebc335b0c516ec45df", | ||
"_resolved": "https://github.com/alafr/SVG-to-PDFKit/tarball/master", | ||
"_from": "https://github.com/alafr/SVG-to-PDFKit/tarball/master" | ||
} |
@@ -29,3 +29,5 @@ # SVG-to-PDFKit | ||
- imageCallback [function] = same as above for the images (for Node.js) | ||
- warningCallback [function] = function called when there is a warning | ||
- assumePt [boolean] = assume that units are PDF points instead of SVG pixels | ||
- precision [number] = precision factor for approximative calculations (default = 3) | ||
@@ -32,0 +34,0 @@ #### Demos: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11
71
4089612
65554