mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-03 15:58:25 -04:00
The PDF preview is all good, but it’s hard, finickeity and feels dirty to embed a PDF in a web page. It’s a more natural thing to embed an image in a web page. So this commit adds another endpoint to return an image of a letter template. It generates this image from the PDF preview, so the stack looks like: 1. `template.png` (generated in admin) 2. `template.pdf` (generated in admin) 3. HTML preview (generated by a `Renderer` in utils) 4. `Template` instance 5. serialised template from API 6. Template stored in database The library used to convert the PDF to an image is Wand[1], which binds to ImageMagick underneath. So in order to get this working locally on a Mac you will probably need to do: `brew install imagemagick ghostscript cairo pango`. To get it working on Ubuntu/EC2 is an exercise left to the reader… 1. http://docs.wand-py.org/en/0.4.4/
25 lines
440 B
SCSS
25 lines
440 B
SCSS
$outline-width: 5px;
|
|
|
|
.letter {
|
|
|
|
font-family: Helvetica, Arial, sans-serif;
|
|
box-shadow:
|
|
1px 1px 0 0 $panel-colour,
|
|
2px 2px 0 0 rgba($panel-colour, 0.5),
|
|
-1px 1px 0 0 $panel-colour,
|
|
-2px 2px 0 0 rgba($panel-colour, 0.5);
|
|
outline: $outline-width solid rgba($text-colour, 0.1);
|
|
padding: 0;
|
|
margin: $outline-width $outline-width $gutter;
|
|
|
|
a {
|
|
display: block;
|
|
}
|
|
|
|
img {
|
|
display: block;
|
|
max-width: 100%;
|
|
}
|
|
|
|
}
|