GithubHelp home page GithubHelp logo

templates's Introduction

Document templates for Stylus Labs Write

How to use in Write

Download the template to your desired folder, then in Write long press on the template file and choose "Open Copy" (in iOS, long press and choose "Duplicate", then rename and open). Alternatively, the template can be opened directly and then a copy saved using Document -> Save As...

To add a page with a different template to a document, use Document -> Insert Document... and choose the desired template.

PDF import

On Linux or Mac, pdf2write.sh can convert PDF to SVG for use in Write. First try with the --vector argument (requires poppler-utils to be installed). When opening in Write, choose "Use as background" unless you want to modify the original content. If the results are not satisfactory, try again without --vector to render pages to images instead (requires imagemagick and ghostscript or pdftoppm from poppler-utils). Another option using inkscape is kosmospredanie/pdftowrite.

For LaTeX documents, dvisvgm produces good results converting directly from DVI: dvisvgm -p1- -bpapersize --stdout in.dvi > out.svg

Editing templates

Simple templates can be editing by manually editing the SVG file (as text). It should be possible to edit templates in, e.g., Inkscape, but this isn't tested yet. Send a pull request if you'd like to share your template.

Example w/ explanation:

<svg id="write-document" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<rect id="write-doc-background" width="100%" height="100%" fill="#808080"/>

<svg class="write-page" color-interpolation="linearRGB" x="10" y="10" width="768px" height="1050px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <g class="write-content write-v3" width="768" height="1050" xruling="0" yruling="10" marginLeft="0" papercolor="#FFFFFF" rulecolor="#FF000000">
    <g class="ruleline write-scale-down" color="#000000" shape-rendering="crispEdges" vector-effect="non-scaling-stroke">
      <pattern id="ruling1" x="0" y="50" width="768" height="100" patternUnits="userSpaceOnUse">
        <path fill="none" stroke="currentColor" stroke-width="1" d="M68 10 l632 0" />
        <path fill="none" stroke="currentColor" stroke-width="1" d="M68 20 l632 0" />
        <path fill="none" stroke="currentColor" stroke-width="1" d="M68 30 l632 0" />
        <path fill="none" stroke="currentColor" stroke-width="1" d="M68 40 l632 0" />
        <path fill="none" stroke="currentColor" stroke-width="1" d="M68 50 l632 0" />
      </pattern>
      <rect class="pagerect" fill="#FFFFFF" x="0" y="0" width="768" height="1050" />
      <rect fill="url(#ruling1)" x="0" y="50" width="768" height="4096" />
    </g>
  </g>
</svg>

</svg>

The page background ("ruling") is determined by the content in g.ruleline. currentColor inserts the color specified in the nearest color attribute (standard SVG behavior) - the color attribute on g.ruleline is set from the "Ruling Color" chosen in the Page Setup dialog. Fixed colors are specified directly, e.g., stroke="red" or stroke="#FF0000". shape-rendering="crispEdges" gives thin lines a sharp appearance and vector-effect="non-scaling-stroke" prevents them from changing size when zooming in or out, while the class write-scale-down causes Write to lighten them when zooming out so they don't dominate the appearance when zoomed far out. Using a <pattern> enables changing page size for simple repeated rulings, up to the size of the <rect> filled with the pattern.

On g.write-content, the width, height, xruling, yruling, marginLeft, papercolor, and rulecolor attributes correspond to the values set in the Page Setup dialog. Page width, height, and color (as fill) must also be set on rect.pagerect in g.ruleline. Page width and height are also set on svg.write-page.

Any content inside g.write-content after g.ruleline will be editable in Write.

Multi-page templates can be created by adding additional pages (svg.write-page) to the template document. When editing the document in Write, the background of the last page will be duplicated when adding to new pages to the end. To prevent this, the class write-no-dup can be added to g.ruleline

templates's People

Contributors

pbsurf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

templates's Issues

Feature request

It would be interesting to have a black or green background. Simulating blackboards.

pdf2write.sh generates blank pages on Mac OS

Hi all,

as said in the subject, I tried to use the pdf2write.sh script that you suggest to write on PDFs (also thanks for suggesting the alternative software in the FAQ, but still I wanted to try), it seems to partially work because it recognizes the PDF file and it generates a number of pages equal to the original file, but the problem is that the pages are completely empty.

Perhaps this script was not tested in Mac OS? or perhaps some of the engines/tools used by the script do not work on Mac OS? Perhaps it would work if I select some specific options (like the image format, resolution, etc.)?

Unfortunately I cannot give you more information so far because apparently the script does not print any error message, it behaves as everything has been done correctly, but the PDF pages are empty.

Many thanks for your great work and your great tool, from a MacOS user with an external tablet/dispay with a stylus...

UPDATE: I looked inside the generated SVGZ file, and it seems there are actually several <image> tags (as many as the number of PDF pages) with some base64-encoded data inside (are the newline characters supposed to be there?), but they appear blank when I open the file. I paste one of the <image> tags partially here:

<image x="0" y="0" width="1239" height="1754" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAACa8AAA20CAQAAABSEOvjAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAA
ASwAAAEsAHOI6VIAAAAHdElNRQfkBg0NKR/9vd8EAAAKeHpUWHRSYXcgcHJvZmlsZSB0eXBlIGlj
YwAAWIWdl22SZKkNRf+zCi+BTwktBwSK8P434ENWd0+33TNjOyuIzHoPhJCu7hXpn+7pH3zqUEn5
...
VDExOjQxOjMxKzAyOjAwol32wwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0wNi0xM1QxMTo0MToz
MSswMjowMNMATn8AAAAmdEVYdHBkZjpIaVJlc0JvdW5kaW5nQm94ADU5NC45Nng4NDIuMDQrMCsw
7wuGawAAABR0RVh0cGRmOlZlcnNpb24AUERGLTEuMyBTBqy/AAAAAElFTkSuQmCC
"/>

How to use pdf2write.sh ?

I'm somewhat new to al this so how do I make this script actually convert a pdf to png? If I run it nothing much happens nor can i specify a file.
If I run it in terminal I get
Converting PDF to images...
I/O Error: Couldn't open file 'out': No such file or directory.
convert-im6.q16: no images defined 'out-%03d.png' @ error/convert.c/ConvertImageCommand/3258.
No page images found: make sure pdftoppm (from poppler-utils) or imagemagick and ghostscript are installed

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.