Anonymous
Not logged in
Talk
Contributions
Create account
Log in
Publication Station
Search
Editing
Research/Web-to-print
(section)
From Publication Station
Namespaces
Page
Discussion
More
More
Page actions
Read
Edit
History
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Weasyprint== [[Research/Web-to-print/WeasyPrint]] ''[https://pypi.python.org/pypi/WeasyPrint WeasyPrint] is a visual rendering engine for HTML and CSS that can export to PDF. It aims to support web standards for printing. WeasyPrint is free software made available under a BSD license.<br/>It is based on various libraries but not on a full rendering engine like WebKit or Gecko. The CSS layout engine is written in Python, designed for pagination, and meant to be easy to hack on.'' <ref name="weasyprint1">“WeasyPrint Documentation — WeasyPrint 0.22 Documentation.” http://weasyprint.org/docs/.</ref> Can be used as a Python library or as a standalone program. Remarks below refer to use as standalone program, so far. ===positive aspects=== * Uses HTML and CSS to layout the PDF, which means a smoother learning curve from web to print. * Supports features like page size, page number, hyphenation in several languages (w/ [http://pyphen.org/ pyphen lib])custom typography, allowing the production of a PDF with high level of control in terms of design. * Very simple and easy to understand syntax, does not require proficiency in command line. Example:<source lang="bash">weasyprint http://beyond-social.org/wiki/index.php/Hybrid_Publishing beyondsocial.pdf -s style.css </source> Example explained: <source lang="bash">weasyprint source-html-document pdf-output -s css-file</source> * <code>-s</code> being the flag to include the CSS that will overwrite existing CSS rules used in the web version ===negative aspects=== * Can be difficult to install, due to the dependencies. In Debian no issue was experienced. In Mac OSX, still trying to manage the installation. * It's more than difficult to install! It's very hard. It's dependencies seem to belong to another era and have small communities and scarce documentation ===sample output=== [[File:Sample_Beyondsocial.pdf]] ====style.css==== <source lang="css"> html, body{ background-color: #e0e0e0 !important; font-family: "AmericanTypewriter", serif !important; /* the font needs to be in your computer. this is not the final font, please choose a font of your choice */ color: #000 !important; } div#footer ul { list-style-type: none !important; } @page{ size: 8.5in 8.5in; background-color: white !important; counter-increment: page; font-family: "AmericanTypewriter", monospace !important; color: #000 !important; margin: 1cm; font-size: 8pt; } h1{ string-set: doctitle content(); /* not tested - not sure it is working */ /* retrieves the content from h2.title - will be used later, in the page bottom*/ } img{ width: 100%; break-page-inside: never; } #catlinks{display: none;} div#footer{ background-color: black !important; color: #fff !important; /*border-radius: 2cm;*/ font-family: sans-serif !important; font-size: .75em !important; text-align: center; padding-bottom: .2cm; position: absolute; bottom: 0; width: 100%; } @page :left { @bottom-right{ margin: 0; /* font-family: inherit; */ /* does not work */ content: string(doctitle); } @bottom-left{ margin: 0; content: counter(page); } } @page :right { @bottom-right{ margin: 0; /* font-family: inherit; */ /* does not work */ content: counter(page); } @bottom-left{ margin: 0; content: string(doctitle); } } </source>
Summary:
Please note that all contributions to Publication Station are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
Publication Station:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation
Main navigation
Main page
Printmaking Studio
Print Studio
Dig. Publishing Studio
Namespaces
Grafiwiki
Random Page
Log in
Wiki tools
Wiki tools
Page tools
Page tools
User page tools
More
What links here
Related changes
Page information
Page logs