yWorks / svg2pdf.js

A javascript-only SVG to PDF conversion utility that runs in the browser. Brought to you by yWorks - the diagramming experts
MIT License
654 stars 101 forks source link

Unsupported features/Known issues #82

Open HackbrettXXX opened 5 years ago

HackbrettXXX commented 5 years ago

Here is a list of known issues/unsupported features.

bernhardreiter commented 5 years ago

To me it would make sense to put the feature "Images with urls that are not inline data urls" in an issue on its own. There is the jsPDF.addImage() module which could be looked at for the functionality.

HackbrettXXX commented 5 years ago

The addImage plugin also basically only supports data urls. I just saw that the original jsPDF made some changes to support other urls via synchronous requests. Synchronous requests are deprecated and should usually not be used, though. As far as I can see there is also no option to preload images. So we can support non-data-urls only when we make the API of svg2pdf asynchronous. This should be done together with a 2.0 release.

eliaschaflo commented 4 years ago

I tried rounded corner rects (rx attribute), but the pdf export ignore this attribute.

HackbrettXXX commented 4 years ago

As far as I know, the rx/ry attributes are fully supported. Are you sure your SVG is correct? Could you give us a snippet of your SVG?

eliaschaflo commented 4 years ago

Yes you are right! This was showing good in the browser but not in the pdf <rect width="60" height="60" rx="15" /> I had to add ry value and now works perfectly fine. <rect width="60" height="60" rx="15" ry="15"/> Thanks por pointing that it is supported!

HackbrettXXX commented 4 years ago

Actually, your SVG is right. MDN states

If a properly specified value is provided for rx but not for ry (or the opposite), then the browser will consider the missing value equal to the defined one.

So omitting one of the values is correct. We should fix this (#126).

eliaschaflo commented 4 years ago

Hi again. Wanted to know if the text style attribute 'font-weight' is implemented. I am using it and the svg shows correctly but the pdf looks 'regular' everywhere. Is there something I am doing wrong?

eliaschaflo commented 4 years ago

Interesting! It works by using 'bold', 'normal' but not with numeric value. Anyway, would like to add a 'light' type with the existing fonts.

HackbrettXXX commented 4 years ago

Yes. This is mainly because jsPDF only supports 'normal', 'bold', etc.. With custom fonts and some tricking, we might be able to support other font styles, though. When adding a font to jsPDF, you can also specify the font-style, which in theory, could also be a numeric value. Needs to be tested though. Also, svg2pdf needs to support numeric values. Created a new issue (#128).

HackbrettXXX commented 4 years ago

Ah, accidentally copied the wrong issue number in #140.

xurenda commented 2 years ago

Unfortunately does not support filter elements, my svg has Gaussian blur and shadows, is there any way to work properly in pdf again?

HackbrettXXX commented 2 years ago

AFAIK, PDF has no native feature like SVG filters. A workaround might be to replace all elements with filters in the SVG with <image>s of the rendered element.

vitornvpaixao commented 2 years ago

Hi, there is any way to add multiple svgs instead one?

yGuy commented 2 years ago

Hi, there is any way to add multiple svgs instead one?

Sure, just make more calls to doc.svg(...)

vitornvpaixao commented 2 years ago

Hi @yGuy, thanks for your quick answer. I already tried but with more than one is not rendered in pdf. This pdf has only one page with a canvas image, and i'm trying to add multiple svg (with paths) layers above this image.

HackbrettXXX commented 2 years ago

Did you confirm the SVGs are in fact not there? Are they maybe just occluding each other? Please check if maybe something else is going wrong... maybe not all calls to doc.svg() are actually called? If you think this is an issue of svg2pdf, please provide a runnable example, so we can reproduce the issue.

vitornvpaixao commented 2 years ago

Hi @HackbrettXXX, i will analyse what might be going through and if necessary i will open an issue with a runnable example. Thanks boths for your help.

xurenda commented 2 years ago

Hi, please tell me why mask is not supported. As far as I know, pdf should support masking.

HackbrettXXX commented 2 years ago

@xurenda You are right, PDF supports masking and it would probably be possible to add support for the feature. It just hasn't been implemented so far, because it's used rather rarely. We would happily merge and assist with a pull request, though. Although we need to add the masking feature to jsPDF, as well, first.

xurenda commented 2 years ago

@HackbrettXXX Okay, thank you for your reply, I need the mask very much, but I am not good enough, I hope someone can solve it.😄

iziorama commented 2 years ago

HI! Did you have a plan to support CMYK colors as jsPDF supports it? Maybe using custom property like device-cmyk=""

eriese commented 2 years ago

I'd be very grateful for support for transform-origin!