Download the PHP package netflex/renderer without Composer
On this page you can find all versions of the php package netflex/renderer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download netflex/renderer
More information about netflex/renderer
Files in netflex/renderer
Package renderer
Short Description High level API for working with the Netflex Foundation PDF generator
License MIT
Homepage https://github.com/netflex-sdk/renderer
Informations about the package renderer
Netflex Renderer
[READ ONLY] Subtree split of the Netflex Renderer component (see netflex/framework)
This package provides a high-level builder interface for generating PDF's, images, and server side rendering of HTML.
Full API reference is available here.
Table of contents
- Installation
- Usage
- Generating PDF/JPG/PNG/HTML
- From raw HTML
- By rendering a View
- By rendering a named Route
- By rendering a URL
- Setting pixel ratio
- Specifying a timeout
- Waiting for the document to load
- Retrieving the rendered content
- PDF
- Specify page ranges
- Print background
- Margings
- Paper format
- Document scaling
- Explicit size
- Landscape mode
- Set size from CSS
- Setting custom header and footer
- Outputting page numbers etc.
- Page break utilities
- Tags and metadata
- Images
- Setting viewport size
- Capturing a specific element using a CSS selector
- Clip
- Full page
- JPG
- Quality
- PNG
- Transparent
- HTML
- Server Side Rendering (SSR)
- MJML
- Usage in Mailable
- View macros
Installation
Usage
Generating PDF/JPG/PNG/HTML
These methods also applies to the HTML
, PNG
, and JPG
classes.
From raw HTML
By rendering a View
By rendering a named Route
By rendering a URL
Setting pixel ratio
These methods also applies to the PNG
, and JPG
classes.
Specifying a timeout
Sometimes the document can take a while to load. You can specify how long you want to wait until the request is considered timed out.
These methods also applies to the HTML
, PNG
, and JPG
classes.
Waiting for the document to load
If your document is client side rendered with JavaScript, you sometimes have to wait a bit before the document is captured. Otherwise you risk getting a blank or partial blank result.
These methods also applies to the HTML
, PNG
, and JPG
classes.
Retrieving the rendered content
These methods also applies to the HTML
, PNG
, and JPG
classes.
All the renderers implements Laravel's Responsable
interface. This means that you can return them directly from you Route or Controller, and they will automatically be converted to a Response.
Specify page ranges
Print background
Margings
Paper format
Document scaling
Explicit size
Landscape mode
Set size from CSS
Setting custom header and footer
You can override the default header and footer by providing your own view.
Do note that if you specify a custom template for the header, and don't provide a custom template for the footer, the default footer will show. This also applies the other way around. This is a limitation of the render backend.
Outputting page numbers etc.
If you do specify a custom header or footer view, you can use the following Blade directives.
Page break utilities
Tags and metadata
You can set PDF tags and metadata.
Images
Setting viewport size
The default viewport is 1920x1080
at 1x
devicePixelRatio.
These options are shared between JPG and PNG
Capturing a specific element use a CSS selector
Notice: Only the first matched element will be captured.
Clip
Notice: Clipping is always relative to the full document, even when using a selector to target an element. This is a backend limitation, and could change in the future.
Full page
If you want to capture the entire page, including content not visible in the viewport.
JPG
Quality
PNG
Transparent
Preserves background opacities.
HTML
The HTML renderer can be used for getting rendered content as HTML. This can be very useful if parts of your view/url is rendered client side with JavaScript.
Server Side Rendering (SSR)
This package provides a middleware that you can use to server side render your content.
Netflex\Render\Http\Middleware\SSR
Just register that in you app/Http/Kernel.php
file
And now you can use it in a route:
MJML
The MJML rendered is used to transform MJML to HTML. MJML is a framework for generating responsive email markup.
The MJML renderer isn't very usefull standalone, but provides a few helpers that can hook into Mailable.
Example:
Usage in Mailable
Instead of using a .blade.php file, write your view as a .mjml file.
In your Mailable class, add the trait Netflex\Render\Mail\MJML
.
Example:
The resulting rendered markup will be cached until the source .mjml file changes. But variables passed to the view will still be injected dynamically.
View macros
This package registers a few macros to the View
class for your convenience.
Licensed under the MIT license.
Copyright Apility AS © 2021
All versions of renderer with dependencies
illuminate/contracts Version ^8.0
illuminate/http Version ^8.0
illuminate/support Version ^8.0
illuminate/view Version ^8.0
netflex/api Version ^4.33
php Version ^7.4|^8.0