Initial commit

This commit is contained in:
Francois Pelletier 2022-12-28 00:04:27 -05:00
commit 7d0eeff739
46 changed files with 1166 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.idea/

41
Dockerfile Normal file
View file

@ -0,0 +1,41 @@
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update
RUN apt-get install -y \
pandoc\
imagemagick \
lmodern
RUN apt-get install -y \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-lang-french \
texlive-luatex
# Set the working directory
WORKDIR /app
# Copy the requirements file
COPY requirements.txt .
# Install Python dependencies
RUN pip install -r requirements.txt
# Copy the application code
COPY . .
# Policy for ImageMagick
COPY conf/policy.xml /etc/ImageMagick-6/policy.xml
# Expose the application port
EXPOSE 8000
# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

1
build-local.sh Normal file
View file

@ -0,0 +1 @@
docker build -t local/fabriquedoc .

99
conf/policy.xml Normal file
View file

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policymap [
<!ELEMENT policymap (policy)*>
<!ATTLIST policymap xmlns CDATA #FIXED ''>
<!ELEMENT policy EMPTY>
<!ATTLIST policy xmlns CDATA #FIXED '' domain NMTOKEN #REQUIRED
name NMTOKEN #IMPLIED pattern CDATA #IMPLIED rights NMTOKEN #IMPLIED
stealth NMTOKEN #IMPLIED value CDATA #IMPLIED>
]>
<!--
Configure ImageMagick policies.
Domains include system, delegate, coder, filter, path, or resource.
Rights include none, read, write, execute and all. Use | to combine them,
for example: "read | write" to permit read from, or write to, a path.
Use a glob expression as a pattern.
Suppose we do not want users to process MPEG video images:
<policy domain="delegate" rights="none" pattern="mpeg:decode" />
Here we do not want users reading images from HTTP:
<policy domain="coder" rights="none" pattern="HTTP" />
The /repository file system is restricted to read only. We use a glob
expression to match all paths that start with /repository:
<policy domain="path" rights="read" pattern="/repository/*" />
Lets prevent users from executing any image filters:
<policy domain="filter" rights="none" pattern="*" />
Any large image is cached to disk rather than memory:
<policy domain="resource" name="area" value="1GP"/>
Use the default system font unless overwridden by the application:
<policy domain="system" name="font" value="/usr/share/fonts/favorite.ttf"/>
Define arguments for the memory, map, area, width, height and disk resources
with SI prefixes (.e.g 100MB). In addition, resource policies are maximums
for each instance of ImageMagick (e.g. policy memory limit 1GB, -limit 2GB
exceeds policy maximum so memory limit is 1GB).
Rules are processed in order. Here we want to restrict ImageMagick to only
read or write a small subset of proven web-safe image types:
<policy domain="delegate" rights="none" pattern="*" />
<policy domain="filter" rights="none" pattern="*" />
<policy domain="coder" rights="none" pattern="*" />
<policy domain="coder" rights="read|write" pattern="{GIF,JPEG,PNG,WEBP}" />
-->
<policymap>
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<policy domain="resource" name="memory" value="256MiB"/>
<policy domain="resource" name="map" value="512MiB"/>
<policy domain="resource" name="width" value="16KP"/>
<policy domain="resource" name="height" value="16KP"/>
<!-- <policy domain="resource" name="list-length" value="128"/> -->
<policy domain="resource" name="area" value="128MP"/>
<policy domain="resource" name="disk" value="1GiB"/>
<!-- <policy domain="resource" name="file" value="768"/> -->
<!-- <policy domain="resource" name="thread" value="4"/> -->
<!-- <policy domain="resource" name="throttle" value="0"/> -->
<!-- <policy domain="resource" name="time" value="3600"/> -->
<!-- <policy domain="coder" rights="none" pattern="MVG" /> -->
<!-- <policy domain="module" rights="none" pattern="{PS,PDF,XPS}" /> -->
<!-- <policy domain="path" rights="none" pattern="@*" /> -->
<!-- <policy domain="cache" name="memory-map" value="anonymous"/> -->
<!-- <policy domain="cache" name="synchronize" value="True"/> -->
<!-- <policy domain="cache" name="shared-secret" value="passphrase" stealth="true"/>
<!-- <policy domain="system" name="max-memory-request" value="256MiB"/> -->
<!-- <policy domain="system" name="shred" value="2"/> -->
<!-- <policy domain="system" name="precision" value="6"/> -->
<!-- <policy domain="system" name="font" value="/path/to/font.ttf"/> -->
<!-- <policy domain="system" name="pixel-cache-memory" value="anonymous"/> -->
<!-- <policy domain="system" name="shred" value="2"/> -->
<!-- <policy domain="system" name="precision" value="6"/> -->
<!-- not needed due to the need to use explicitly by mvg: -->
<!-- <policy domain="delegate" rights="none" pattern="MVG" /> -->
<!-- use curl -->
<policy domain="delegate" rights="none" pattern="URL" />
<policy domain="delegate" rights="none" pattern="HTTPS" />
<policy domain="delegate" rights="none" pattern="HTTP" />
<!-- in order to avoid to get image with password text -->
<policy domain="path" rights="none" pattern="@*"/>
<!-- disable ghostscript format types -->
<!--<policy domain="coder" rights="none" pattern="PS" /> -->
<!--<policy domain="coder" rights="none" pattern="PS2" /> -->
<!--<policy domain="coder" rights="none" pattern="PS3" /> -->
<!--<policy domain="coder" rights="none" pattern="EPS" /> -->
<!--<policy domain="coder" rights="none" pattern="PDF" /> -->
<!--<policy domain="coder" rights="none" pattern="XPS" /> -->
</policymap>

8
docker-run.sh Normal file
View file

@ -0,0 +1,8 @@
#!/usr/bin/zsh
#!/usr/bin/zsh
docker stop fabriquedoc
docker rm fabriquedoc
# Ce programme sert à lancer le job_dispatcher dans un docker localement pour tester
docker run -p 8080:8080 --name fabriquedoc --network host local/fabriquedoc

Binary file not shown.

View file

@ -0,0 +1,41 @@
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects, to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works. The fonts and derivatives, however, cannot be released under any other type of license. The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting -- in part or in whole -- any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed under any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

93
font/SourceCodePro/LICENSE.txt Executable file
View file

@ -0,0 +1,93 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

72
font/SourceCodePro/ReadMe.html Executable file
View file

@ -0,0 +1,72 @@
<!DOCTYPE html>
<html>
<head>
<title>Read Me File for Adobe® OpenType® Fonts</title>
<meta charset="utf-8" />
</head>
<body bgcolor="white" link="#ce0000" alink="#ce0000" vlink="#9c6363">
<h2><font color="#333333"
face="verdana,geneva,arial">Adobe&reg; OpenType&reg; Fonts</font></h2>
<p><font size="2" face="verdana,geneva,arial">Thank
you for licensing Adobe OpenType fonts. In order to ensure that you
have the most up-to-date product information, Adobe has posted <a
href="http://www.adobe.com/type/browser/OTReadMe.html">an OpenType
Read Me file</a> on the Adobe web site that contains information such
as minimum system requirements, technical support contact information
and software installation notes. We have also posted <a
href="http://www.adobe.com/type/browser/pdfs/OTGuide.pdf">an OpenType
User's Guide</a> in PDF format on the Adobe web site that can be
viewed online and downloaded to your computer. <P>If you have
licensed an Adobe OpenType Pro font, there may be additional PDF
documents, such as a specimen book, a glyph complement showing, and a
typeface-specific Read Me file, available on the typeface&#146;s
product pages on the Adobe web site. These additional files may be
viewed online or downloaded to your computer.<P>To get you started
quickly, below are links to localized installation instructions for
your fonts.
<h4>Installation Instructions</h4><hr>
<p lang=en><b>English</b><br>
Instructions for installing this font can be found online at <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p lang=fr><b>French / Fran&#231;ais</b><br>
Le mode d'installation de cette police de caract&#232;re se trouve en
ligne &#224; <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p lang=de><b>German / Deutsch</b><br>
Die Anweisungen zur Installation dieser Schriftart finden Sie online
unter <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p lang=it><b>Italian / Italiano</b><br>
Le istruzioni per l'installazione di questo font sono disponibili
online all'indirizzo <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p lang=es><b>Spanish / Espa&#241;ol</b><br>
Las instrucciones para instalar esta fuente se pueden encontrar
online en <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p lang=nl><b>Dutch / Hollands</b><br>
De instructies voor de installatie van dit lettertype vindt u op <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p><b>Swedish / Svenska</b><br>
Anvisningar f&#246;r hur det h&#228;r teckensnittet installeras finns
online p&#229; <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p><b>Norwegian / Norsk</b><br>
Instruksjoner for installering av skrifttypen finnes online p&#229;
<a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p><b>Finnish / Suomi</b><br>
Ohjeet t&#228;m&#228;n fontin asentamiseen l&#246;ytyv&#228;t
osoitteesta <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p><b>Danish / Dansk</b><br>
Du finder en vejledning i installation af denne skrifttype online
p&#229; adressen <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>.</p>
<p lang=ja><b>Japanese / 日本語</b><br>
このフォントをインストールする手順は、オンラインで <a
href="http://www.adobe.com/type/browser/fontinstall/instructions_main.html">http://www.adobe.com/type/browser/fontinstall/instructions_main.html</a>
を参照してください。</p>
</body>
</html>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,230 @@
<!DOCTYPE html>
<html>
<head>
<title>Read Me File for Source Code Pro</title>
<meta charset="utf-8" />
<meta name="description" content= "Read Me file for Source Code Pro ... " />
<title>Read Me</title>
<style type="text/css" media="screen">
/*********************** fonts ************************/
body
{font-family: sans-serif;
font-weight: normal;
font-size: 10pt;
color: #000000;
margin: 0px;
background-color: white;}
h1
{display:inline;
font-family: sans-serif;
font-weight: normal;
color: #999999;}
h2
{display:inline;
font-size: 10pt;
font-family: sans-serif;
font-weight: bold;
color: #666666;}
/*********************** links ************************/
a:link
{color:#004477;
text-decoration:none;
margin: 0px 0px 0px 0px;}
a:visited
{color:#6d7f8e;
text-decoration:none;
margin: 0px 0px 0px 0px;}
a:hover
{color:#ff0000;
text-decoration:none;
margin: 0px 0px 0px 0px;}
/*********************** div tags ************************/
#page
{float:left;
width:700px;
margin:20px 20px 20px 20px;}
#subTitle
{background-color:#e3e3e3;
float:left;
width:700px;
border-bottom:solid #999999 1.0pt;
border-bottom-alt:solid #999999 .5pt;
padding:2px 0px 4px 0px;}
#title
{background-color:#e3e3e3;
float:left;
width:700px;
border-bottom:solid #999999 1.0pt;
border-bottom-alt:solid #999999 .5pt;
padding:2px 0px 4px 0px;}
#description
{float:left;
width:700px;
padding:15px 0px 15px 0px;}
.style6 {color: #666666}
.style7 {color: #FF0000}
</style>
</head>
<body>
<div id="page">
<h1><span style="font-size:16pt">Source&#153; Code Pro</span></h1>
<br />
<div id="description1">
<p> This document contains late-breaking product information, updates, and troubleshooting tips.<br />
<br />
<a href="#A1">Minimum system requirements</a> <br />
<a href="#A7">Font installation</a> <br />
<a href="#A2">Family information</a> <br />
<a href="#A3">Release Notes</a><br />
<a href="#A8">Known issues</a> <br />
<a href="#A9">Customer care</a> <br />
<a href="#A10">Other resources</a> <br />
<a href="#A12"></a><br />
</p>
</div>
<div id="title"><a name="A1" id="A1"></a><h2 class="style6">Minimum system requirements</h2>
</div>
<div id="description2">
<p>Windows&reg;</p>
<ul>
<li> Intel&reg; Pentium,&reg; Intel Centrino,&reg; Intel Xeon,&reg; or Intel Core&trade; Duo processor</li>
<li>Microsoft Windows 2000, Windows XP, Windows Vista&trade;, or Windows 7<br />
</li>
<li>16 MB of RAM (32 MB recommended)</li>
<li>Note:
Fonts from Font Folio 11 may also be installed under Microsoft Windows 98, Windows Millennium Edition,
and Windows NT&reg; 4.0 with Service Pack 4 if you install Adobe Type Manager&reg; (ATM&trade;) Light
4.1 on your system. If using a PostScript&reg; printer on Windows 98/ME, AdobePS&trade; printer
driver 4.3 or later is recommended. If using a PostScript printer
on Windows NT 4.0, AdobePS printer driver 5.1.2 or later is recommended.</li>
</ul>
<p>Macintosh</p>
<ul>
<li> PowerPC&reg; G4 or G5 or multicore Intel processor</li>
<li>Mac OS X</li>
<li>16 MB of RAM (32 MB recommended)</li>
<li>If using a PostScript printer, the latest AdobePS printer driver is recommended.</li>
<li>Note: Fonts from Font Folio 11 may be installed under Mac OS 8.6 through 9.2 with ATM Light 4.6,
and under Classic mode in Mac OS X with ATM Light 4.6.2.</li>
</ul>
</div>
<div id="title3"><h2><a name="A7" id="A7">Font installation</a></h2></div>
<div id="description3">
<p>For information on installing these fonts, see<span class="style7"> <a title="http://www.adobe.com/go/learn_fontinstall_en" href="http://www.adobe.com/go/learn_fontinstall_en">http://www.adobe.com/go/learn_fontinstall_en</a>.</span></p>
</div>
<div id="title4"><h2><a name="A2" id="A2">Family information</a></h2></div>
<div id="description4">
<p><strong>History</strong></p>
Source Code Pro was designed by Paul D. Hunt as a companion to Source Sans. This complementary family was adapted from the Source design due to a request to create a monospaced version for coding applications. Source Code preserves the design features and vertical proportions of Source Sans, but alters the glyph widths so that they are uniform across all glyphs and weights. Although this family was designed specifically for coding environments, for which a regular weight will typically suffice, Source Code has been made available in the same weight range as the corresponding Source Sans design.<br><br>Source Code Pro currently supports a wide range of languages using the Latin script, and includes all the characters in the Adobe Latin 4 glyph set. As an open source project, it is expected that incremental updates will be made over time to extend glyph set coverage and functionality. Future releases are expected to add support for Greek and Cyrillic scripts, italics, and other features documented on the project page at <A HREF="http://sourceforge.net/adobe/sourcesans/wiki/Home/">Open@Adobe</A>, which is hosted by SourceForge.net®. If you are interested in contributing to this open source project, please visit this project page for information on how to become involved. Source Code Pro can be adapted and redistributed according to the terms of the <A HREF="http://www.adobe.com/type/browser/legal/pdfs/OpenFontLicense.pdf">Open Font License (OFL) agreement</A>.
<p><strong>Menu Names And Style Linking</strong> </p>
<p>In many Windows&reg; applications, instead of every font appearing on
the menu, fonts are grouped into style-linked sets, and only the name of
the base style font for a set is shown in the menu. The italic and the
bold weight fonts of the set (if any) are not shown in the font menu, but can still be
accessed by selecting the base style font, and then using the italic
and bold style buttons. In this family, such programs will show only the
following base style font names in the menu:</p>
<p>Source Code Pro<br>
Source Code Pro Black<br>
Source Code Pro ExtraLight<br>
Source Code Pro Light<br>
Source Code Pro Semibold<br></p>
<p>The other fonts in this family must be selected by choosing a menu name
and then a style option following the guide below.</p>
<table border="0">
<tr> <td>Menu Name</td> <td> </td> <td>plus Style Option... </td> <td> </td> <td>selects this font</td> </tr>
<tr> <td>Source Code Pro</td> <td> </td> <td>[none]</td> <td> </td> <td>Source Code Pro Regular</td> </tr>
<tr> <td>Source Code Pro</td> <td> </td> <td>Bold</td> <td> </td> <td>Source Code Pro Bold</td> </tr>
<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
<tr> <td>Source Code Pro ExtraLight</td> <td> </td> <td>[none]</td> <td> </td> <td>Source Code Pro ExtraLight</td> </tr>
<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
<tr> <td>Source Code Pro Light</td> <td> </td> <td>[none]</td> <td> </td> <td>Source Code Pro Light</td> </tr>
<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
<tr> <td>Source Code Pro Semibold</td> <td> </td> <td>[none]</td> <td> </td> <td>Source Code Pro Semibold</td> </tr>
<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
<tr> <td>Source Code Pro Black</td> <td> </td> <td>[none]</td> <td> </td> <td>Source Code Pro Black</td> </tr>
<tr> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr>
</table>
<p>On the Mac OS, although each font appears as a separate entry on the
font menu, users may also select fonts by means of style links.
Selecting a base style font and then using the style links (as described
above for Windows) enhances cross-platform document compatibility with
many applications, such as Microsoft&reg; Word and Adobe PageMaker&reg;,
although it is unnecessary with more sophisticated Adobe applications
such as recent versions of Illustrator&reg;, Photoshop&reg; or
InDesign&reg;.</p>
<p>One should not, however, select a base font which has no style-linked
variant, and then use the bold or italic styling button. Doing so will
either have no effect, or result in programmatic bolding or slanting of
the base font, which will usually produce inferior screen and print
results.</p>
</div>
<div id="title5"><h2><a name="A3" id="A3">Release Notes</a></h2></div>
<div id="description5">
<p>For all fonts of family Source Code Pro : version 1.009 created on Thu Sep 20 16:40:47 2012.</p>
<p>version 1.009 created 2012/09/20</p>
<ul>
<li> First release.</li>
</ul>
</div>
<div id="title6"><h2><a name="A8" id="A8">Known issues</a></h2></div>
<div id="description6">
<ul> <li>Some glyphs in the font cannot be accessed unless you are using an OpenType-savvy application.
</li>
</ul>
</div>
<div id="title7"><h2><a name="A9" id="A9"> Customer care</a></h2></div>
<div id="description7">
<p><strong>Customer Service</strong><br />
Adobe Customer Service provides assistance with product information, sales, registration, and other non-technical issues. To find out how to contact Adobe Customer Service, please visit Adobe.com for your region or country and click on Contact.</p>
<p><strong>Support Plan Options and Technical Resources </strong><br />
If you require technical assistance for your product, including information on free and paid support options and troubleshooting resources, more information is available at <a title="http://www.adobe.com/go/support/" href="http://www.adobe.com/go/support/"><span title="http://www.adobe.com/go/support/">http://www.adobe.com/go/support/</span></a>. Outside of North America, go to <a title="http://www.adobe.com/go/intlsupport/" href="http://www.adobe.com/go/intlsupport/"><span title="http://www.adobe.com/go/intlsupport/">http://www.adobe.com/go/intlsupport/</span></a>. Free troubleshooting resources include Adobe&rsquo;s support knowledgebase, Adobe user-to-user forums and more.</p>
</div>
<div id="title8"><h2><a name="A10" id="A10"> Other resources</a></h2></div>
<div id="description8">
<p><strong>Online Resources</strong><br />
<a href="http://www.adobe.com/type">Adobe Type Showroom</a><br />
<a href="http://www.adobe.com/type/family_readmes.html">Adobe Type Showroom - all current Read-Me files for our font families</a><br />
<a href="http://www.adobe.com/support/forums/">User Forums</a><br />
</p>
<p align="left"><br />
</p>
</div>
<br />
<br />
&copy; 2012 Adobe Systems Incorporated. All rights reserved.
</div>
</body>
</html>

115
main.py Normal file
View file

@ -0,0 +1,115 @@
import datetime
import logging
from fastapi import FastAPI
from fastapi.responses import FileResponse
from pydantic import BaseModel
import pypandoc
import json
import httpx
from fastapi.testclient import TestClient
import os
from wand.image import Image
from wand.color import Color
import shutil
class DocumentSpecs(BaseModel):
format: str
style: str
linkcolor: str
tocdepth: int
pdfengine: str
content: str
fontsize: int
paperwidth: int
paperheight: int
margin: int
extension: str
def convert_pdf_jpg(filename, output_path, resolution=300):
""" Convert a PDF into images.
All the pages will give a single png file with format:
{pdf_filename}-{page_number}.png
The function removes the alpha channel from the image and
replace it with a white background.
"""
all_pages = Image(filename=filename, resolution=resolution)
for i, page in enumerate(all_pages.sequence):
with Image(page) as img:
img.format = 'jpg'
img.background_color = Color('black')
#img.alpha_channel = 'remove'
image_filename = os.path.splitext(os.path.basename(filename))[0]
image_filename = '{}-{}.jpg'.format(image_filename, i)
image_filename = os.path.join(output_path, image_filename)
img.save(filename=image_filename)
app = FastAPI()
@app.get("/generer/")
async def generer(specs: DocumentSpecs):
header_file = f'{os.getcwd()}/styles/{specs.style}/{specs.format}/header.tex'
cover_file = f'{os.getcwd()}/styles/{specs.style}/{specs.format}/cover.tex'
datef = datetime.datetime.now().strftime("%m-%d-%Y")
output_file = f"./{specs.style}-{specs.format}-{datef}-output.pdf"
filters = []
pdoc_args = [
f'--include-in-header={header_file}',
f'--include-after-body={cover_file}',
'--listings',
'--dpi=300',
f'--toc-depth={specs.tocdepth}',
f'--pdf-engine={specs.pdfengine}',
'-V',f'linkcolor={specs.linkcolor}',
'-V',f'fontsize={specs.fontsize}pt',
'-V',f'geometry:paperwidth={specs.paperwidth/300}in',
'-V',f'geometry:paperheight={specs.paperheight/300}in',
'-V',f'geometry:margin={specs.margin/300}in'
]
try:
logging.info("Dossier courant = " + os.getcwd())
result = pypandoc.convert_text(source=specs.content,
to='pdf',
format='markdown+implicit_figures+smart',
encoding='utf-8',
extra_args=pdoc_args,
filters=filters,
cworkdir=os.getcwd(),
outputfile=output_file
)
except RuntimeError as rerr:
logging.exception(rerr)
except OSError as oerr:
logging.exception(oerr)
if specs.extension=="zip":
zip_filename = os.path.splitext(os.path.basename(output_file))[0]
png_output_dir = "./png_output"
if not os.path.exists(png_output_dir):
os.mkdir(png_output_dir)
try:
convert_pdf_jpg(output_file, png_output_dir, resolution=300)
shutil.make_archive(zip_filename, 'zip', png_output_dir)
shutil.rmtree(png_output_dir)
except Exception as e:
logging.exception(e)
return FileResponse(zip_filename+".zip")
elif specs.extension=="pdf":
return FileResponse(output_file)
else:
return 0
client = TestClient(app)
def test_generer():
test_json = json.read("test.json")
response = client.get("/generer/", json=test_json)
assert response.status_code == 200

26
requirements.txt Normal file
View file

@ -0,0 +1,26 @@
h11~=0.14.0
pip~=21.3.1
wheel~=0.37.1
PyYAML~=6.0
anyio~=3.6.2
sniffio~=1.3.0
click~=8.1.3
httpcore~=0.16.3
idna~=3.4
rfc3986~=1.5.0
certifi~=2022.12.7
pandoc~=2.3
ply~=3.11
plumbum~=1.8.0
uvloop~=0.17.0
fastapi~=0.88.0
starlette~=0.22.0
pydantic~=1.10.2
websockets~=10.4
uvicorn~=0.20.0
httptools~=0.5.0
watchfiles~=0.18.1
httpx~=0.23.1
setuptools~=60.2.0
pypandoc~=1.10
Wand~=0.6.10

1
run.sh Normal file
View file

@ -0,0 +1 @@
uvicorn main:app --reload

View file

@ -0,0 +1,27 @@
\newpage
\thispagestyle{empty}
\noindent Tu apprécies ? \emoji{red-heart} et partage !\newline
\leavevmode \newline
\noindent Certains droits réservés\ \ccbysa\ \newline \the\year{}\ -\ François Pelletier
\leavevmode \newline
\noindent Visite mon site web au \url{https://jevalide.ca} et mes réseaux sociaux au \url{https://linktr.ee/jevalideca}
\leavevmode \newline
\noindent \doclicenseThis
\leavevmode \newline
\noindent Publié le \today
\leavevmode \newline
\noindent Mise en page effectuée avec \LaTeX
\pagebreak

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -0,0 +1,49 @@
\usepackage[french]{babel} % Césure en français
\usepackage[autolanguage]{numprint}
\usepackage[
type={CC},
modifier={by-sa},
version={4.0},
]{doclicense}
\usepackage{wallpaper}
\makeatletter
\ULCornerWallPaper{1}{./styles/jevalideca/a4/fonds_a4.pdf}
\makeatother
\usepackage{listings}
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth
}
% Override default figure placement To be within the flow of the text rather
% than on it's own page.
\usepackage{float}
\makeatletter
\def\fps@figure{H}
\makeatother
\usepackage{fontspec}
\setmainfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setsansfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setmonofont[Path=font/SourceCodePro/]{SourceCodePro-Regular.ttf}
\usepackage{emoji}

View file

@ -0,0 +1,17 @@
\newpage
\thispagestyle{empty}
\noindent Tu apprécies ? \emoji{red-heart} et partage !\newline
\noindent Certains droits réservés\newline\ccbysa\newline \the\year{}\ -\ François Pelletier
\noindent Site web: \newline\url{https://jevalide.ca}
\noindent Réseaux sociaux: \newline\url{https://linktr.ee/jevalideca}
\noindent Publié le \today.
\noindent Mise en page effectuée avec \LaTeX
\pagebreak

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 89 KiB

View file

@ -0,0 +1,59 @@
\usepackage[french]{babel} % Césure en français
\usepackage[autolanguage]{numprint}
\usepackage[
type={CC},
modifier={by-sa},
version={4.0},
]{doclicense}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{geometry}
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth
}
\usepackage{wallpaper}
\makeatletter
\ULCornerWallPaper{1}{./styles/jevalideca/instagram/fonds_instagram.pdf}
\makeatother
% Override default figure placement To be within the flow of the text rather
% than on it's own page.
\usepackage{float}
\makeatletter
\def\fps@figure{H}
\makeatother
\pagenumbering{gobble}
\AddToHook{cmd/section/before}{\clearpage}
\AddToHook{cmd/subsection/before}{\clearpage}
\usepackage{caption}
\DeclareCaptionLabelFormat{nolabel}{}
\captionsetup{labelformat=nolabel,textformat=empty}
\usepackage{fontspec}
\setmainfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setsansfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setmonofont[Path=font/SourceCodePro/]{SourceCodePro-Regular.ttf}
\usepackage{emoji}

View file

@ -0,0 +1,27 @@
\newpage
\thispagestyle{empty}
\noindent Tu apprécies ? \emoji{red-heart} et partage !\newline
\leavevmode \newline
\noindent Certains droits réservés\ \ccbysa\ \newline \the\year{}\ -\ François Pelletier
\leavevmode \newline
\noindent Visite mon site web au \url{https://jevalide.ca} et mes réseaux sociaux au \url{https://linktr.ee/jevalideca}
\leavevmode \newline
\noindent \doclicenseThis
\leavevmode \newline
\noindent Publié le \today
\leavevmode \newline
\noindent Mise en page effectuée avec \LaTeX
\pagebreak

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -0,0 +1,49 @@
\usepackage[french]{babel} % Césure en français
\usepackage[autolanguage]{numprint}
\usepackage[
type={CC},
modifier={by-sa},
version={4.0},
]{doclicense}
\usepackage{xcolor}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth
}
\usepackage{wallpaper}
\makeatletter
\ULCornerWallPaper{1}{./styles/jevalideca/lettre/fonds_lettre.pdf}
\makeatother
% Override default figure placement To be within the flow of the text rather
% than on it's own page.
\usepackage{float}
\makeatletter
\def\fps@figure{H}
\makeatother
\usepackage{fontspec}
\setmainfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setsansfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setmonofont[Path=font/SourceCodePro/]{SourceCodePro-Regular.ttf}
\usepackage{emoji}

View file

@ -0,0 +1,19 @@
\newpage
\thispagestyle{empty}
\noindent Tu apprécies ? \emoji{red-heart} et partage !\newline
\noindent Site web: \url{https://jevalide.ca}
\noindent Réseaux sociaux: \newline\url{https://linktr.ee/jevalideca}
\pagebreak
\noindent Certains droits réservés\ \ccbysa \newline \the\year{}\ -\ François Pelletier
\noindent Publié le \today.
\noindent Mise en page effectuée avec \LaTeX
\pagebreak

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -0,0 +1,53 @@
\usepackage[french]{babel} % Césure en français
\usepackage[autolanguage]{numprint}
\usepackage{ccicons}
\usepackage{wallpaper}
\makeatletter
\ULCornerWallPaper{1}{./styles/jevalideca/linkedin/fonds_linkedin.pdf}
\makeatother
\usepackage{xcolor}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth
}
% Override default figure placement To be within the flow of the text rather
% than on it's own page.
\usepackage{float}
\makeatletter
\def\fps@figure{H}
\makeatother
\pagenumbering{gobble}
\AddToHook{cmd/section/before}{\clearpage}
\AddToHook{cmd/subsection/before}{\clearpage}
\usepackage{caption}
\DeclareCaptionLabelFormat{nolabel}{}
\captionsetup{labelformat=nolabel,textformat=empty}
\usepackage{fontspec}
\setmainfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setsansfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setmonofont[Path=font/SourceCodePro/]{SourceCodePro-Regular.ttf}
\usepackage{emoji}

View file

@ -0,0 +1,17 @@
\newpage
\thispagestyle{empty}
\noindent Tu apprécies ? \emoji{red-heart} et partage !\newline
\noindent Certains droits réservés\newline\ccbysa\newline \the\year{}\ -\ François Pelletier
\noindent Site web: \newline\url{https://jevalide.ca}
\noindent Réseaux sociaux: \newline\url{https://linktr.ee/jevalideca}
\noindent Publié le \today.
\noindent Mise en page effectuée avec \LaTeX
\pagebreak

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 87 KiB

View file

@ -0,0 +1,57 @@
\usepackage[french]{babel} % Césure en français
\usepackage[autolanguage]{numprint}
\usepackage[
type={CC},
modifier={by-sa},
version={4.0},
]{doclicense}
\usepackage{xcolor}
\usepackage{listings}
\lstset{
basicstyle=\ttfamily,
numbers=left,
numberstyle=\footnotesize,
stepnumber=2,
numbersep=5pt,
backgroundcolor=\color{black!10},
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2,
captionpos=b,
breaklines=true,
breakatwhitespace=true,
breakautoindent=true,
linewidth=\textwidth
}
\usepackage{wallpaper}
\makeatletter
\ULCornerWallPaper{1}{./styles/jevalideca/slide169/fonds_slide.pdf}
\makeatother
% Override default figure placement To be within the flow of the text rather
% than on it's own page.
\usepackage{float}
\makeatletter
\def\fps@figure{H}
\makeatother
\pagenumbering{gobble}
\AddToHook{cmd/section/before}{\clearpage}
\AddToHook{cmd/subsection/before}{\clearpage}
\usepackage{caption}
\DeclareCaptionLabelFormat{nolabel}{}
\captionsetup{labelformat=nolabel,textformat=empty}
\usepackage{fontspec}
\setmainfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setsansfont[Path=font/GlacialIndifference/]{GlacialIndifference-Regular.otf}
\setmonofont[Path=font/SourceCodePro/]{SourceCodePro-Regular.ttf}
\usepackage{emoji}

59
test_main.http Normal file
View file

@ -0,0 +1,59 @@
# Test your FastAPI endpoints
GET http://127.0.0.1:8000/generer/
Content-Type: application/json
Accept: application/zip
{
"format": "instagram",
"style": "jevalideca",
"linkcolor": "blue",
"tocdepth": 2,
"pdfengine": "lualatex",
"content": "# Ceci est un titre\n## Ceci est un sous-titre\n\nCeci est un paragraphe\n\n## Ceci est un autre sous-titre\n\n> Ceci est du code",
"fontsize": 14,
"paperwidth": 1080,
"paperheight": 1920,
"margin": 180,
"extension": "zip"
}
###
GET http://127.0.0.1:8000/generer/
Content-Type: application/json
Accept: application/pdf
{
"format": "linkedin",
"style": "jevalideca",
"linkcolor": "blue",
"tocdepth": 2,
"pdfengine": "lualatex",
"content": "# Ceci est un titre\n## Ceci est un sous-titre\n\nCeci est un paragraphe\n\n## Ceci est un autre sous-titre\n\n> Ceci est du code",
"fontsize": 14,
"paperwidth": 1080,
"paperheight": 1080,
"margin": 90,
"extension": "pdf"
}
###
GET http://127.0.0.1:8000/generer/
Content-Type: application/json
Accept: application/pdf
{
"format": "slide169",
"style": "jevalideca",
"linkcolor": "blue",
"tocdepth": 2,
"pdfengine": "lualatex",
"content": "# Ceci est un titre\n## Ceci est un sous-titre\n\nCeci est un paragraphe\n\n## Ceci est un autre sous-titre\n\n> Ceci est du code",
"fontsize": 14,
"paperwidth": 1920,
"paperheight": 1080,
"margin": 90,
"extension": "pdf"
}