Skip to content

Instantly share code, notes, and snippets.

@diegoliv
Created October 9, 2018 19:24
Show Gist options
  • Save diegoliv/e8e89b315242a72153f58404d3669b65 to your computer and use it in GitHub Desktop.
Save diegoliv/e8e89b315242a72153f58404d3669b65 to your computer and use it in GitHub Desktop.
PDFShift config
<?php
require_once('includes/vendor/pdfshift/init.php');
use \PDFShift\PDFShift;
$pdfshift = new PDFShift( array(
'sandbox' => true,
'viewport' => '768x1024',
'zoom' => 0.8,
'css' => $this->get_pdf_css(), // custom function to get a url for the css file
) );
$pdfshift->setMargin( array(
'top' => '25mm',
'left' => '25mm',
'bottom' => '25mm',
'right' => '25mm',
) );
$pdfshift->convert( $content ); // content is this url: https://fcfgolivedev.staging.wpengine.com/tropical-business-class-bout-hawaii-vs-costa-rica/pdf/
$save = $pdfshift->save( $file_url );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment