Installation
============
* Download the .zip file and unzip it
* Create a folder e.g. /mpdf on your server
* Upload all of the files to the server, maintaining the folders as they are
* Ensure that you have write permissions set (CHMOD 6xx or 7xx) for the following folders:
/ttfontdata/ - used to cache font data; improves performance a lot
/tmp/ - used for some images and ProgressBar
/graph_cache/ - if you are using JpGraph in conjunction with mPDF
To test the installation, point your browser to the basic example file : [path_to_mpdf_folder]/mpdf/examples/example01_basic.php
If you wish to define a different folder for temporary files rather than /tmp/ see the note on 'Folder for temporary files' in
the section on Installation & Setup in the manual (http://mpdf1.com/manual/).
If you have problems, please read the section on troubleshooting in the manual.
Fonts
=====
Let us refer to font names in 2 ways:
"CSS font-family name" - mPDF is designed primarily to read HTML and CSS. This is the name used in CSS e.g.
<p style="font-family: 'Trebuchet MS';">
"mPDF font-family name" - the name used internally to process fonts. This could be anything you like,
but by default mPDF will convert CSS font-family names by removing any spaces and changing
to lowercase. Reading the name above, mPDF will look for a "mPDF font-family name" of
'trebuchetms'.
The configurable values referred to below are set in the config_fonts.php file
When parsing HTML/CSS, mPDF will read the CSS font-family name (e.g. 'Trebuchet MS') and convert
by removing any spaces and changing to lowercase, to look for a mPDF font-family name (trebuchetms).
Next it will look for a translation (if set) in config_font.php e.g.:
$this->fonttrans = array(
'trebuchetms' => 'trebuchet'
)
Now the mPDF font-family name to be used is 'trebuchet'
If you wish to make this font available, you need to specify the Truetype .ttf font files for each variant.
These should be defined in config_font.php in the array:
$this->fontdata = array(
"trebuchet" => array(
'R' => "trebuc.ttf",
'B' => "trebucbd.ttf",
'I' => "trebucit.ttf",
'BI' => "trebucbi.ttf",
)
)
This is the array which determines whether a font is available to mPDF. Each font-family must have a
Regular ['R'] file defined - the others (bold, italic, bold-italic) are optional.
mPDF will try to load the font-file. If you have defined _MPDF_SYSTEM_TTFONTS at the top of the
config_fonts.php file, it will first look for the font-file there. This is useful if you are running
mPDF on a computer which already has a folder with TTF fonts in (e.g. on Windows)
If the font-file is not there, or _MPDF_SYSTEM_TTFONTS is not defined, mPDF will look in the folder
/[your_path_to_mpdf]/ttfonts/
Note that the font-file names are case-sensitive and can contain capitals.
If the folder /ttfontdata/ is writeable (CHMOD 644 or 755), mPDF will save files there which it can
re-use next time it accesses a particular font. This will significantly improve processing time
and is strongly recommended.
mPDF should be able to read most TrueType Unicode font files with a .ttf extension
Truetype fonts with .otf extension that are OpenType also work OK.
TrueType collections (.ttc) will also work if they contain TrueType Unicode fonts.
Character substitution
----------------------
Most people will have access to a Pan-Unicode font with most Unicode characters in it such as
Arial Unicode MS. Set $this->backupSubsFont = array('arialunicodems'); at the top of the config_fonts.php file
to use this font when substituting any characters not found in the specific font being used.
Example:
You can set $mpdf->useSubstitutions = true; at runtime
or $this->useSubstitutions = true; in the config.php file
<p style="font-family: 'Comic Sans MS'">This text contains a Thai character ม which does not exist
in the Comic Sans MS font file</p>
When useSubstitutions is true, mPDF will try to find substitutions for any missing characters:
1) firstly looks if the character is available in the inbuilt Symbols or ZapfDingbats fonts;
2) [If defined] looks in each of the the font(s) set by $this->backupSubsFont array
NB There is an increase in processing time when using substitutions, and even more so if
a backupSubsFont is defined.
Controlling mPDF mode
=====================
The first parameter of new mPDF('') works as follows:
new mPDF('c') - forces mPDF to only use the built-in [c]ore Adobe fonts (Helvetica, Times etc)
new mPDF('') - default - font subsetting behaviour is determined by the configurable variables
$this->maxTTFFilesize and $this->percentSubset (see below)
Default values are set so that: 1) very large font files are always subset
2) Fonts are embedded as subsets if < 30% of the characters are used
new mPDF('..+aCJK') new mPDF('+aCJK')
new mPDF('..-aCJK') new mPDF('-aCJK')
- used optionally together with a language or language/country code, +aCJK will force mPDF
to use the Adobe non-embedded CJK fonts when a passage is marked with e.g. "lang: ja"
This can be used at runtime to override the value set for $mpdf->useAdobeCJK in config.php
Use in conjunction with settings in config_cp.php
For backwards compatibility, new mPDF('-s') and new mPDF('s') will force subsetting by
setting $this->percentSubset=100
new mPDF('utf-8-s') and new mPDF('ar-s') are also recognised
Configuration variables changed
===============================
Configuration variables are documented in the on-line manual (http://mpdf1.com/manual/).
Font folders
============
If you wish to define your own font file folders (perhaps to share),
you can define the 2 constants in your script before including the mpdf.php script e.g.:
define('_MPDF_TTFONTPATH','your_path/ttfonts/');
define('_MPDF_TTFONTDATAPATH','your_path/ttfontdata/'); // should be writeable
没有合适的资源?快使用搜索试试~ 我知道了~
mpdf将内容导出为pdf,php类库
共745个文件
php:295个
dat:274个
ttf:64个
需积分: 10 67 下载量 80 浏览量
2018-05-11
11:16:52
上传
评论
收藏 44.54MB RAR 举报
温馨提示
该类库可以将你获取的内容导出为pdf文档,可以保存网页布局样式及图片等,挺好用的。资源分最小也得是1分,本想免费分享的,所以就这样吧,一分拿走,童叟无欺。如果开发过程有不懂的可以参考我的博客,有详细代码贴出。
资源推荐
资源详情
资源评论
收起资源包目录
mpdf将内容导出为pdf,php类库 (745个子文件)
tiger.bmp 944KB
lang2fonts.css 9KB
mpdfstyletables.css 5KB
mpdfstylePaged.css 4KB
mpdfstyleA4.css 2KB
mpdf.css 2KB
progbar.css 1KB
linebrdictK.dat 1MB
linebrdictT.dat 295KB
linebrdictL.dat 124KB
qrv40_2.dat 87KB
qrv40_3.dat 87KB
qrv40_0.dat 87KB
qrv40_1.dat 87KB
qrv39_2.dat 83KB
qrv39_3.dat 83KB
qrv39_0.dat 83KB
qrv39_1.dat 83KB
qrv38_2.dat 79KB
qrv38_3.dat 79KB
qrv38_0.dat 79KB
qrv38_1.dat 79KB
qrv37_2.dat 75KB
qrv37_3.dat 75KB
qrv37_0.dat 75KB
qrv37_1.dat 75KB
qrv36_2.dat 71KB
qrv36_3.dat 71KB
qrv36_0.dat 71KB
qrv36_1.dat 71KB
qrv35_2.dat 67KB
qrv35_3.dat 67KB
qrv35_0.dat 67KB
qrv35_1.dat 67KB
qrv34_2.dat 65KB
qrv34_3.dat 65KB
qrv34_0.dat 65KB
qrv34_1.dat 65KB
qrv33_2.dat 61KB
qrv33_3.dat 61KB
qrv33_0.dat 61KB
qrv33_1.dat 61KB
qrv32_2.dat 58KB
qrv32_3.dat 58KB
qrv32_0.dat 58KB
qrv32_1.dat 58KB
qrv31_2.dat 55KB
qrv31_3.dat 55KB
qrv31_0.dat 55KB
qrv31_1.dat 55KB
qrv30_2.dat 51KB
qrv30_3.dat 51KB
qrv30_0.dat 51KB
qrv30_1.dat 51KB
qrv29_2.dat 48KB
qrv29_3.dat 48KB
qrv29_0.dat 48KB
qrv29_1.dat 48KB
qrv28_2.dat 45KB
qrv28_3.dat 45KB
qrv28_0.dat 45KB
qrv28_1.dat 45KB
qrv27_2.dat 43KB
qrv27_3.dat 43KB
qrv27_0.dat 43KB
qrv27_1.dat 43KB
qrv26_2.dat 40KB
qrv26_3.dat 40KB
qrv26_0.dat 40KB
qrv26_1.dat 40KB
qrv25_2.dat 37KB
qrv25_3.dat 37KB
qrv25_0.dat 37KB
qrv25_1.dat 37KB
qrv24_2.dat 35KB
qrv24_3.dat 35KB
qrv24_0.dat 35KB
qrv24_1.dat 35KB
modele40.dat 33KB
qrv23_2.dat 32KB
qrv23_3.dat 32KB
qrv23_0.dat 32KB
qrv23_1.dat 32KB
modele39.dat 32KB
qrvfr40.dat 31KB
modele38.dat 31KB
qrv22_2.dat 30KB
qrv22_3.dat 30KB
qrv22_0.dat 30KB
qrv22_1.dat 30KB
qrvfr39.dat 29KB
modele37.dat 29KB
qrvfr38.dat 28KB
modele36.dat 28KB
qrv21_2.dat 27KB
qrv21_3.dat 27KB
qrv21_0.dat 27KB
qrv21_1.dat 27KB
qrvfr37.dat 27KB
modele35.dat 27KB
共 745 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
资源评论
zb27149
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功