Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Зуев Егор
/
wiki.dev
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Authored by
Dan Brown
2017-01-01 12:20:30 +0000
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Commit
3f0ef57d31d88ef072c9ea24f43cad75443e3e21
3f0ef57d
1 parent
0eb90cb3
Added wkhtmltopdf support and done some style tweaks
Closes #248
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
151 additions
and
7 deletions
.gitignore
app/Services/ExportService.php
composer.json
composer.lock
config/app.php
config/snappy.php
resources/assets/sass/_forms.scss
resources/views/pages/revisions.blade.php
.gitignore
View file @
3f0ef57
...
...
@@ -13,3 +13,4 @@ _ide_helper.php
/storage/debugbar
.phpstorm.meta.php
yarn.lock
/bin
\ No newline at end of file
...
...
app/Services/ExportService.php
View file @
3f0ef57
<?php
namespace
BookStack\Services
;
use
BookStack\Page
;
class
ExportService
...
...
@@ -28,8 +27,13 @@ class ExportService
{
$cssContent
=
file_get_contents
(
public_path
(
'/css/export-styles.css'
));
$pageHtml
=
view
(
'pages/pdf'
,
[
'page'
=>
$page
,
'css'
=>
$cssContent
])
->
render
();
$useWKHTML
=
config
(
'snappy.pdf.binary'
)
!==
false
;
$containedHtml
=
$this
->
containHtml
(
$pageHtml
);
if
(
$useWKHTML
)
{
$pdf
=
\SnappyPDF
::
loadHTML
(
$containedHtml
);
}
else
{
$pdf
=
\PDF
::
loadHTML
(
$containedHtml
);
}
return
$pdf
->
output
();
}
...
...
composer.json
View file @
3f0ef57
...
...
@@ -15,7 +15,8 @@
"league/flysystem-aws-s3-v3"
:
"^1.0"
,
"barryvdh/laravel-dompdf"
:
"^0.7"
,
"predis/predis"
:
"^1.1"
,
"gathercontent/htmldiff"
:
"^0.2.1"
"gathercontent/htmldiff"
:
"^0.2.1"
,
"barryvdh/laravel-snappy"
:
"^0.3.1"
},
"require-dev"
:
{
"fzaninotto/faker"
:
"~1.4"
,
...
...
composer.lock
View file @
3f0ef57
...
...
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
,
"This file is @generated automatically"
],
"hash"
:
"
3124d900cfe857392a94de479f3ff6d4
"
,
"content-hash"
:
"
a968767a73f77e66e865c276cf76eedf
"
,
"hash"
:
"
2438a2f4a02adbea5f378f9e9408eb29
"
,
"content-hash"
:
"
6add8bff71ecc86e0c90858590834a26
"
,
"packages"
:
[
{
"name"
:
"aws/aws-sdk-php"
,
...
...
@@ -256,6 +256,58 @@
"time"
:
"2016-07-04 11:52:48"
},
{
"name"
:
"barryvdh/laravel-snappy"
,
"version"
:
"v0.3.1"
,
"source"
:
{
"type"
:
"git"
,
"url"
:
"https://github.com/barryvdh/laravel-snappy.git"
,
"reference"
:
"509a4497be63d8ee7ff464a3daf00d9edde08e21"
},
"dist"
:
{
"type"
:
"zip"
,
"url"
:
"https://api.github.com/repos/barryvdh/laravel-snappy/zipball/509a4497be63d8ee7ff464a3daf00d9edde08e21"
,
"reference"
:
"509a4497be63d8ee7ff464a3daf00d9edde08e21"
,
"shasum"
:
""
},
"require"
:
{
"illuminate/filesystem"
:
"5.0.x|5.1.x|5.2.x|5.3.x"
,
"illuminate/support"
:
"5.0.x|5.1.x|5.2.x|5.3.x"
,
"knplabs/knp-snappy"
:
"*"
,
"php"
:
">=5.4.0"
},
"type"
:
"library"
,
"extra"
:
{
"branch-alias"
:
{
"dev-master"
:
"0.3-dev"
}
},
"autoload"
:
{
"psr-4"
:
{
"Barryvdh
\\
Snappy
\\
"
:
"src/"
}
},
"notification-url"
:
"https://packagist.org/downloads/"
,
"license"
:
[
"MIT"
],
"authors"
:
[
{
"name"
:
"Barry vd. Heuvel"
,
"email"
:
"barryvdh@gmail.com"
}
],
"description"
:
"Snappy PDF/Image for Laravel 4"
,
"keywords"
:
[
"image"
,
"laravel"
,
"pdf"
,
"snappy"
,
"wkhtmltoimage"
,
"wkhtmltopdf"
],
"time"
:
"2016-08-05 13:08:28"
},
{
"name"
:
"barryvdh/reflection-docblock"
,
"version"
:
"v2.0.4"
,
"source"
:
{
...
...
@@ -998,6 +1050,71 @@
"time"
:
"2015-12-05 17:17:57"
},
{
"name"
:
"knplabs/knp-snappy"
,
"version"
:
"0.4.3"
,
"source"
:
{
"type"
:
"git"
,
"url"
:
"https://github.com/KnpLabs/snappy.git"
,
"reference"
:
"44f7a9b37d5686fd7db4c1e9569a802a5d16923f"
},
"dist"
:
{
"type"
:
"zip"
,
"url"
:
"https://api.github.com/repos/KnpLabs/snappy/zipball/44f7a9b37d5686fd7db4c1e9569a802a5d16923f"
,
"reference"
:
"44f7a9b37d5686fd7db4c1e9569a802a5d16923f"
,
"shasum"
:
""
},
"require"
:
{
"php"
:
">=5.3.3"
,
"symfony/process"
:
"~2.3|~3.0"
},
"require-dev"
:
{
"phpunit/phpunit"
:
"~4.7"
},
"suggest"
:
{
"h4cc/wkhtmltoimage-amd64"
:
"Provides wkhtmltoimage-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency"
,
"h4cc/wkhtmltoimage-i386"
:
"Provides wkhtmltoimage-i386 binary for Linux-compatible machines, use version `~0.12` as dependency"
,
"h4cc/wkhtmltopdf-amd64"
:
"Provides wkhtmltopdf-amd64 binary for Linux-compatible machines, use version `~0.12` as dependency"
,
"h4cc/wkhtmltopdf-i386"
:
"Provides wkhtmltopdf-i386 binary for Linux-compatible machines, use version `~0.12` as dependency"
,
"wemersonjanuario/wkhtmltopdf-windows"
:
"Provides wkhtmltopdf executable for Windows, use version `~0.12` as dependency"
},
"type"
:
"library"
,
"extra"
:
{
"branch-alias"
:
{
"dev-master"
:
"0.5.x-dev"
}
},
"autoload"
:
{
"psr-0"
:
{
"Knp
\\
Snappy"
:
"src/"
}
},
"notification-url"
:
"https://packagist.org/downloads/"
,
"license"
:
[
"MIT"
],
"authors"
:
[
{
"name"
:
"KNPLabs Team"
,
"homepage"
:
"http://knplabs.com"
},
{
"name"
:
"Symfony Community"
,
"homepage"
:
"http://github.com/KnpLabs/snappy/contributors"
}
],
"description"
:
"PHP5 library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage."
,
"homepage"
:
"http://github.com/KnpLabs/snappy"
,
"keywords"
:
[
"knp"
,
"knplabs"
,
"pdf"
,
"snapshot"
,
"thumbnail"
,
"wkhtmltopdf"
],
"time"
:
"2015-11-17 13:16:27"
},
{
"name"
:
"laravel/framework"
,
"version"
:
"v5.3.11"
,
"source"
:
{
...
...
config/app.php
View file @
3f0ef57
...
...
@@ -148,6 +148,7 @@ return [
Barryvdh\DomPDF\ServiceProvider
::
class
,
Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider
::
class
,
Barryvdh\Debugbar\ServiceProvider
::
class
,
Barryvdh\Snappy\ServiceProvider
::
class
,
/*
...
...
@@ -218,6 +219,7 @@ return [
'ImageTool'
=>
Intervention\Image\Facades\Image
::
class
,
'PDF'
=>
Barryvdh\DomPDF\Facade
::
class
,
'SnappyPDF'
=>
Barryvdh\Snappy\Facades\SnappyPdf
::
class
,
'Debugbar'
=>
Barryvdh\Debugbar\Facade
::
class
,
/**
...
...
config/snappy.php
0 → 100644
View file @
3f0ef57
<?php
return
[
'pdf'
=>
[
'enabled'
=>
true
,
'binary'
=>
file_exists
(
base_path
(
'wkhtmltopdf'
))
?
base_path
(
'wkhtmltopdf'
)
:
env
(
'WKHTMLTOPDF'
,
false
),
'timeout'
=>
false
,
'options'
=>
[],
'env'
=>
[],
],
'image'
=>
[
'enabled'
=>
false
,
'binary'
=>
'/usr/local/bin/wkhtmltoimage'
,
'timeout'
=>
false
,
'options'
=>
[],
'env'
=>
[],
],
];
resources/assets/sass/_forms.scss
View file @
3f0ef57
...
...
@@ -33,7 +33,7 @@
position
:
relative
;
z-index
:
5
;
textarea
{
font-family
:
'Roboto Mono'
;
font-family
:
'Roboto Mono'
,
monospace
;
font-style
:
normal
;
font-weight
:
400
;
padding
:
$-xs
$-m
;
...
...
@@ -55,6 +55,7 @@
display
:
flex
;
flex-direction
:
column
;
border
:
1px
solid
#DDD
;
width
:
50%
;
}
.markdown-display
{
padding
:
0
$-m
0
;
...
...
@@ -68,7 +69,7 @@
.editor-toolbar
{
width
:
100%
;
padding
:
$-xs
$-m
;
font-family
:
'Roboto Mono'
;
font-family
:
'Roboto Mono'
,
monospace
;
font-size
:
11px
;
line-height
:
1
.6
;
border-bottom
:
1px
solid
#DDD
;
...
...
resources/views/pages/revisions.blade.php
View file @
3f0ef57
...
...
@@ -45,7 +45,7 @@
@else
<a
href=
"{{ $revision->getUrl() }}"
target=
"_blank"
>
{{ trans('entities.pages_revisions_preview') }}
</a>
<span
class=
"text-muted"
>
|
</span>
<a
href=
"{{ $revision->getUrl('restore') }}"
target=
"_blank"
>
{{ trans('entities.pages_revisions_restore') }}
</a>
<a
href=
"{{ $revision->getUrl('restore') }}"
>
{{ trans('entities.pages_revisions_restore') }}
</a>
@endif
</td>
</tr>
...
...
Please
register
or
sign in
to post a comment