Thread overview
printed v0.0.3: a low-level API to generate self-contained PDF/SVG
Oct 01, 2018
Guillaume Piolat
Oct 01, 2018
Dukc
Oct 01, 2018
Guillaume Piolat
Oct 01, 2018
Dukc
Oct 02, 2018
Andrea Fontana
Oct 02, 2018
Cristian Vasile
Oct 03, 2018
Guillaume Piolat
Nov 02, 2018
Guillaume Piolat
October 01, 2018
printed is a low-level API to generate self-contained PDF 1.4/SVG 1.1 documents hopefully suitable for print.

Currently it does not provide any "layout" option, you are just provided a sort of 2D Canvas API which can then render to either SVG or PDF.

No line-breaking, paragraphs, ligature, vertical glyphs, or any type of layout are provided, they would have to be implemented on top of it.

The most saliant feature is that you are able to embed a TrueType/OpenType font inside the generated PDF, instead of being restricted to the default fonts of PDF.

It includes an OpenType parser, font matching algorithms and a FontRegistry which deals with "finding whatever font are installed".

http://code.dlang.org/packages/printed
October 01, 2018
On Monday, 1 October 2018 at 09:34:34 UTC, Guillaume Piolat wrote:
> printed is a low-level API to generate self-contained PDF 1.4/SVG 1.1 documents hopefully suitable for print.

At work, I had to make a file converter which converts an obsolete CAD format to image files. It currently makes png and bmp files via dlib and svg files via dxml. This one will be useful if I need to extend it to pdf files. Thank you.
October 01, 2018
On Monday, 1 October 2018 at 10:19:12 UTC, Dukc wrote:
> On Monday, 1 October 2018 at 09:34:34 UTC, Guillaume Piolat wrote:
>> printed is a low-level API to generate self-contained PDF 1.4/SVG 1.1 documents hopefully suitable for print.
>
> At work, I had to make a file converter which converts an obsolete CAD format to image files. It currently makes png and bmp files via dlib and svg files via dxml. This one will be useful if I need to extend it to pdf files. Thank you.

Mmmm you mean dlib has a software renderer?
October 01, 2018
On Monday, 1 October 2018 at 10:44:53 UTC, Guillaume Piolat wrote:
> Mmmm you mean dlib has a software renderer?

Yes.

https://github.com/gecko0307/dlib/blob/master/dlib/image/canvas.d

Small and simple, but so far enough for my converter, as it pairs well with DLib's image file i/o.
October 02, 2018
On Monday, 1 October 2018 at 09:34:34 UTC, Guillaume Piolat wrote:
> printed is a low-level API to generate self-contained PDF 1.4/SVG 1.1 documents hopefully suitable for print.
>
> Currently it does not provide any "layout" option, you are just provided a sort of 2D Canvas API which can then render to either SVG or PDF.
>
> No line-breaking, paragraphs, ligature, vertical glyphs, or any type of layout are provided, they would have to be implemented on top of it.
>
> The most saliant feature is that you are able to embed a TrueType/OpenType font inside the generated PDF, instead of being restricted to the default fonts of PDF.
>
> It includes an OpenType parser, font matching algorithms and a FontRegistry which deals with "finding whatever font are installed".
>
> http://code.dlang.org/packages/printed

Nice!
October 02, 2018
On Monday, 1 October 2018 at 09:34:34 UTC, Guillaume Piolat wrote:
> printed is a low-level API to generate self-contained PDF 1.4/SVG 1.1 documents hopefully suitable for print.
>
> Currently it does not provide any "layout" option, you are just provided a sort of 2D Canvas API which can then render to either SVG or PDF.
>
> No line-breaking, paragraphs, ligature, vertical glyphs, or any type of layout are provided, they would have to be implemented on top of it.
>
> The most saliant feature is that you are able to embed a TrueType/OpenType font inside the generated PDF, instead of being restricted to the default fonts of PDF.
>
> It includes an OpenType parser, font matching algorithms and a FontRegistry which deals with "finding whatever font are installed".
>
> http://code.dlang.org/packages/printed


Hello,

Pdf is good however please take a look at djvu format (http://djvu.org/) one of the authors is Yann LeCun.


October 03, 2018
On Tuesday, 2 October 2018 at 18:54:38 UTC, Cristian Vasile wrote:
> Hello,
>
> Pdf is good however please take a look at djvu format (http://djvu.org/) one of the authors is Yann LeCun.

Hello,

It seems this is primarily an image codec.
printed'd goal is to make reproducible printable documents, and the format for this is PDF.

PDF also includes JPEG2000 compression, and as you would guess it's not very much used.
November 02, 2018
On Monday, 1 October 2018 at 09:34:34 UTC, Guillaume Piolat wrote:
> printed is a low-level API to generate self-contained PDF 1.4/SVG 1.1 documents hopefully suitable for print.
>

Hello,

printed:htmlcolors is a sub-package for parsing HTML color (supporting a subset of CSS Color Module Level 4). @safe pure.

------ example.d ----------

import printed.htmlcolors;

parseHTMLColor("black");                      // all HTML named colors
parseHTMLColor("#fe85dc");                    // hex colors
parseHTMLColor("rgba(64, 255, 128, 0.24)");   // alpha
parseHTMLColor("rgb(9e-1, 50%, 128)");        // percentage, floating-point
parseHTMLColor("hsl(120deg, 25%, 75%)");      // hsv colors
parseHTMLColor("gray(0.5)");                  // gray colors
parseHTMLColor(" rgb ( 245 , 112 , 74 )  ");  // strips whitespace


----------------

Give a const(char)[], get a ubyte[4] back.

http://printed.dpldocs.info/printed.htmlcolors.parseHTMLColor.html