Kamis, 18 April 2013

How to use rst2pdf tool on Windows and Linux

In this post I am gonna write basic tutorial on how create PDF using Rst2pdf tool on windows or linux. Rst2pdf can generate very rich quality PDFs from lightly marked up text files(.rst).

It can be installed easily.On Ubuntu linux you can install it using "Ubuntu software centre". To see how to install rst2pdf on windows visit my previous post How to install rst2pdf on Windows platform . Now I Suppose you have rst2pdf installed on your Computer.

I have explained the code in Following code itself. Browse through the code and read carefully. You might also like to see output PDF file simultaneously(link:how to use rst2pdf - example file).

Note: Space and NewLine is most important in this language.

Input:

Example File
============
.. contents::

.. section-numbering::

.. footer::

Page: ###Page###/###Total###, Example file.

Section/Header 1
----------------

Texts underlined with '=' will be main header and
Texts underlined with '-' are Sub-section.

Sub-section
~~~~~~~~~~~

Texts underlined with '~' will be Sub-sub-section

Text format
------------

Texts enclosed within **bold** will be Bold.
And those enclosed within *italic* will be Italicized

* ``Texts in double block-quote`` will lok different.

Auto numbering
~~~~~~~~~~~~~~
#. '#' will number the line automaticaly
#. this will be line number 2.

Images
~~~~~~

.. image:: logo.png

you can specify attribute of image also

.. image:: logo.png
:height: 140px
:width: 250px
:scale: 100
:alt: alternate text

you can put inline images also:

Assuming |logo.png| is already there on your machine.

.. |logo.png| image:: logo.png
:height: 10px
:width: 10px

Block
~~~~~

* you can put any text like command in box using '::'.
For example, to convert .rst to PDF enter following command ::

rst2pdf myFile.rst

* you can number the line as follow:

.. code-block:: c
:linenos:

#include
int main() {
printf("Hello World\n");
return 0;
}

Links
~~~~~

**Links** can be put in following manner

My Blog ``_

you can put **reference link** like this way.
For example, you can visit my blog [#]_

.. [#] `<http://khuntronak.blogspot.com/>`_

Lists
~~~~~

* a bullet point using "*"

- a sub-list using "-"

+ yet another sub-list

- another item

Copy this code into file myFile.rst and Execute rst2pdf myFile.rst and it will generate myFile.pdf.

You can also run rst2pdf myFile.rst -o outputFileName.pdf .
You can see the output PDF file how to use rst2pdf - example file here.

There are many other things you can do with this markup language/


Tidak ada komentar:

Posting Komentar