On 13.09.17, Stephan Witt wrote:
> Am 12.09.2017 um 09:19 schrieb Guenter Milde <mi...@users.sf.net>:
> > On 14.08.17, Stephan Witt wrote:
> >> Am 14.08.2017 um 14:46 schrieb Guenter Milde <mi...@users.sf.net>:
> >>> On 2017-08-14, Stephan Witt wrote:
> >>>> Am 14.08.2017 um 09:43 schrieb Jean-Pierre Chrétien 
> >>>> <jeanpierre.chret...@free.fr>:

> >>>>> No information for converting svgz format files to pdf6.\n
> >>>>> Define a converter in the preferences.

> >>>> One can easily see the images are converted by rsvg-convert on my Mac.

> >>> Mind, that all icons in the toolbar work without external converter.
> > 
> > Yes, OSx can convert SVG to preview-bitmaps.
> > You can do this from the command line with "qlmanage"
> > https://superuser.com/questions/134679/command-line-application-for-converting-svg-to-png-on-mac-os-x

> The output is not useful. It’s a png - but the original svg-image sits
> in the upper left corner of a big A4- or Letter-PNG.

I suppose this can be solved with the correct command line arguments, but ...
> > Unfortunatly, this is not a good option for SVG graphics that should
> > end up as vector in the PDF output. (And, if I remember right,
> > converting to a bitmap is also supported by QT.)

> Yes, that’s the way I’m trying to go. A small utility based on Qt to
> convert SVG (or SVGZ) to PNG (or JPEG).

QT seems to have all the requirements onboard:

* read and render SVG with Qt SVG:

    SVG drawings can be rendered onto any QPaintDevice subclass.

    --- http://doc.qt.io/qt-5/svgrendering.html
    
* "print" QImage to PDF file:

    Since QPrinter inherits QPaintDevice, anything that supports
    outputting graphical content to a QPaintDevice (or has convenience API
    for printing with QPrinter) can thus be used for generating PDFs
    
    --- https://wiki.qt.io/Handling_PDF#Reading_.2F_Writing

I don't know, whether this route keeps the image as vector or converts it to
a bitmap, though.

The QT wiki also mentions Hummus and PoDoFo as external libraries able to
write to PDF and Inkscape as external tool.
  

> >> A more smart conversion process should be implemented
> >> instead. Isn’t this a possible problem for LyX on Linux too?
> > 
> > In Linux, it is the work of the packagers (creating a Debian LyX package,
> > say) to ensure all requirements for proper working are met.
> > In Debian, this is 
> > 
> > requires: ... libqt5svg5 (>=5.6.0~beta), ...
> > suggests: ..., librsvg2-bin | inkscape, …

> Suggest doesn't mean required…

If I got it right, libqt5svg5 is required to ensure that the GUI-preview
works without external converters.

According to the OP,

  1) opening splash.lyx, gets a message
     "No information for converting svgz format files to pdf6."

This seems odd, the conversion to pdf6 == PDF (graphics) only happens on
*export* to PDF or *view PDF (...)*, not when just opening a file.

  a) There is an error when *opening* splash.lyx: 
  
     This is grave but an SVG to bitmap converter suffices.
  
  b) There is an error when *compiling* splash.lyx (with View or Export):
  
     This is bad advertising but does not prevent use with documents not
     containing SVG images.
     
     We should provide for "painless" use of a high quality SVG -> PDF
     converter that keeps vector graphics as vector. Usually this means
     automatic setup of a converter with "configure" if a third party
     tool (inkscape, rsvg) is detected. Shipping (or linking to) a small
     third-party tool as backup would be a bonus.     

With the inclusion of SVG graphics in Splash and the User Guide,
dependency on SVG conversion is now comparable with dependency on LaTeX,
imagemagick, or a PDF viewer. The correct category for Debian would
be"recommended".

  Package A *depends* on Package B if B absolutely must be installed in
  order to run A. …
  
  Package A *recommends* Package B, if the package maintainer judges that
  most users would not want A without also having the functionality
  provided by B.

  Package A *suggests* Package B if B contains files that are related to
  (and usually enhance) the functionality of A.
  
  --- 
https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html#s-depends

This should be updated in the notes for packagers.


Is there a dependency/recommendation system we could use for Mac?
Or is it just a: "we recommend you also to install ..." line in the docs?


> > The above link lists some options for converting SVG to other formats.
> > For SVG to PDF, we have
> > 
> > inkscape (good but large)
> > 
> > librsvg  (problem with many images on one side -- breaks the internal 
> > preview
> >       -- maybe we can solve this with some librsvg setting?)
> > 
> > svglib   pure Python, but requires ReportLab (not tested)
> >         https://pypi.python.org/pypi/svglib/
> > 
> > cairosvg based on the Cairo 2D graphics library; 
> >      known to work at least on Linux, OS X, and Windows;
> >      requires Python 3
> >      http://cairosvg.org/

> Cairosvg is not usable on Mac - it uses the X11 raster device.

The documentation http://cairosvg.org/documentation/ explicitly states:

  CairoSVG is a SVG 1.1 to PNG, PDF, PS and SVG converter. It provides
  both a command-line interface and Python 3.4+ library, for Unix-like
  operating systems (at least Linux and macOS) and Windows.
 
And as dependency:

  on macOS, you’ll have to install cairo, libxml2 and libffi (with
  Homebrew for example);
 
What am I missing?

Günter

Reply via email to