Permalink
Browse files

add doc

  • Loading branch information...
spipu committed Jun 15, 2017
1 parent 8c24295 commit 04c92d8c822b94cf40d9cf541109822700100b65
Showing with 71 additions and 17 deletions.
  1. +6 −2 README.md
  2. +3 −0 doc/README.md
  3. +7 −3 doc/barcode.md
  4. +7 −3 doc/basic.md
  5. +5 −1 doc/bookmark.md
  6. +7 −0 doc/exception.md
  7. +3 −3 doc/extension.md
  8. +4 −1 doc/font.md
  9. +4 −2 doc/install.md
  10. +4 −0 doc/methods.md
  11. +4 −0 doc/output.md
  12. +5 −1 doc/page.md
  13. +7 −0 doc/svg.md
  14. +5 −1 doc/tcpdf_methods.md
View
@@ -1,20 +1,24 @@
# Html2Pdf
Html2Pdf is a HTML to PDF converter written in PHP.
Html2Pdf is a HTML to PDF converter written in PHP5, and compatible with PHP7.
It allows the conversion of valid HTML in PDF format, to generate documents like invoices, documentation, ...
You have to write you HTML for Html2Pdf, and not trying to convert directly an already existing html page.
Specific tags have been implemented, to adapt the html standard to a PDF usage.
You muse use Composer to install this library.
It uses TCPDF for the PDF part.
## Requirements
Html2Pdf works with PHP >5.4 and Composer.
## Documentation
You will find all the documentation [here](./doc/).
You will find all the documentation [here](./doc/README.md).
You will find lots of examples [here](./examples/).
View
@@ -1,5 +1,6 @@
# Html2Pdf Documentation
## Documentation
* [How to Install Html2Pdf](./install.md)
@@ -9,7 +10,9 @@
* [Barcode](./barcode.md)
* [Bookmark](./bookmark.md)
* [Font](./font.md)
* [SVG](./svg.md)
* [Extensions](./extension.md)
* [Exceptions](./exception.md)
* [Useful Methods](./methods.md)
* [Tcpdf Methods](./tcpdf_methods.md)
View
@@ -1,22 +1,24 @@
# BarCode
[back](./README.md)
## tag barcode
You can directly add bar codes, by directly inserting the barcode tag in the HTML to convert :
You can add barcode, by directly inserting the `<barcode>` tag in the HTML to convert :
```html
<barcode type="EAN13" dimension="1D" value="45" label="label" style="width:30mm; height:6mm; color: #770000; font-size: 4mm"></barcode>
<barcode dimension="1D" type="EAN13" value="45" label="label" style="width:30mm; height:6mm; color: #770000; font-size: 4mm"></barcode>
```
### attributes
Attribute| Default | Description
---------|---------|-------------
dimension | 1D | create a 1D or 2D barcode
type| C39 | type of barcode to use
value| 0 | value to convert into barcode
label| label | indicates that the label must be present below the bar code (label) or not (none) (non-mandatory, default: label)
style| | sets the color for the bar, its width and height (without the label) and the size of the label if it is displayed (not required)
dimension | 1D | create a 1D or 2D barcode
### 1D types
@@ -83,3 +85,5 @@ Attribute| Default | Description
value| | value to convert into barcode
ec| H | level of error correction (L, M, Q, H)
style| | sets the width, color, background-color, and border of the qrcode
[back](./README.md)
View
@@ -1,10 +1,12 @@
# Basic Usage
[back](./README.md)
## PHP Constructor
The main class of this library is `\Spipu\Html2Pdf\Html2Pdf`.
The PHP constructor take the following parameters:
The PHP constructor takes the following parameters:
Variable | Default value |Description
---------|---------------|--------------
@@ -13,10 +15,10 @@ $format | A4 | The default page format used for pages. The list of the available
$lang | fr | Language to use, for some minor translations. The list of the available languages are [here](https://github.com/spipu/html2pdf/tree/master/src/locale)
$unicode | true | means that the input HTML string is unicode
$encoding |UTF-8 | charset encoding of the input HTML string
$margins | array(5, 5, 5, 8) | Main margins of the page (left, top, right, bottom)
$margins | array(5, 5, 5, 8) | Main margins of the page (left, top, right, bottom) in mm
$pdfa | false | If TRUE set the document to PDF/A mode
In most of the case, you will juste use the 3 first parameters :
In most of the case, you will just use the 3 first parameters :
```php
$html2pdf = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'en');
@@ -69,3 +71,5 @@ $html2pdf = new \Spipu\Html2Pdf\Html2Pdf('P', 'A4', 'en');
$html2pdf->writeHTML('<h1>HelloWorld</h1>This is my first page');
$html2pdf->output();
```
[back](./README.md)
View
@@ -1,5 +1,7 @@
# Bookmark
[back](./README.md)
## tag bookmark
You can add automatic bookmark, by directly inserting the bookmark tag in the HTML to convert :
@@ -220,4 +222,6 @@ $html2pdf = new Spipu\Html2Pdf\Html2Pdf('P','A4','en');
$html2pdf->writeHTML($html);
$html2pdf->createIndex('Summary', 25, 12, false, true, 1);
$html2pdf->output();
```
```
[back](./README.md)
View
@@ -0,0 +1,7 @@
# Exception
[back](./README.md)
@todo
[back](./README.md)
View
@@ -1,7 +1,7 @@
# Extensions
[back](./README.md)
@todo
```php
$html2pdf->addExtension(...);
```
[back](./README.md)
View
@@ -1,5 +1,7 @@
# Font
[back](./README.md)
## Creating new Font
To create new font, you should use this tutorial from TCPDF:
@@ -38,4 +40,5 @@ You can set the default font to use with the following method:
```php
$html2pdf->setDefaultFont($default);
```
[back](./README.md)
View
@@ -1,5 +1,7 @@
# How to Install Html2Pdf
[back](./README.md)
## Composer and Packagist
You must use Composer to install Html2Pdf.
@@ -58,5 +60,5 @@ To deliver you app on a server, you have to (on you dev environement) :
* Zip all
That's all, you have a beautifull package that can be deliver on a server !
[back](./README.md)
View
@@ -1,5 +1,7 @@
# Useful Methods
[back](./README.md)
## Image Must Exist
By default, if you try to use an image that Html2Pdf can not read, it will throw an `ImageException`.
@@ -59,3 +61,5 @@ You can get the current Html2Pdf version with the following methods:
$html2pdf->getVersion();
$html2pdf->getVersionAsArray();
```
[back](./README.md)
View
@@ -1,5 +1,7 @@
# Output
[back](./README.md)
The main method to use is `output`.
It takes two not required parameters.
@@ -44,3 +46,5 @@ $pdfContent = $html2pdf->output('', 'S');
```
Then, you can send it by email, using a Bin Attachment document.
[back](./README.md)
View
@@ -1,5 +1,7 @@
# Page Management
[back](./README.md)
To facilitate the layout, three specific tags have been added:
* `<page>`
@@ -131,4 +133,6 @@ $pdf->writeHTML($htmlContent);
$pdf->Output();
```
![Margins](res/margins.jpg "Margins")
![Margins](res/margins.jpg "Margins")
[back](./README.md)
View
@@ -0,0 +1,7 @@
# SVG tags
[back](./README.md)
@todo
[back](./README.md)
View
@@ -1,5 +1,7 @@
# TCPDF Methods
[back](./README.md)
All the TCPDF methods can be used, by using the `pdf` property:
```php
@@ -41,4 +43,6 @@ $html2pdf->output();
## Document Protection
http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:protect
http://wiki.spipu.net/doku.php?id=html2pdf:en:v4:protect
[back](./README.md)

0 comments on commit 04c92d8

Please sign in to comment.