Generate PDF
                }
            }
*/
require 'pdf/pdfcrowd.php';
require_once 'product-customizer/api/api-requests.php';
$apiRequests = new ApiRequests();
$idCus = $_GET['IDcus'];
$type = $_GET['type'];
//[pdf|pdfwb]
$realSize = isset($_GET['realSize']) ? $_GET['realSize'] : false;
//if ( $_GET['IDcli'] === $apiRequests->getIdCliFromBDPedidosCustom($idCus)[0]['ID_cli']) {
try {
    $client = new Pdfcrowd('dani3rs', '6cb8fce0fa072b77c4655a4da2631cb2');
    $productId = $apiRequests->getCustomization($_GET['IDcus'])[0]['ID_pro'];
    $productWidth = $apiRequests->getProduct($productId)[0][W_anchura];
    $productHeight = $apiRequests->getProduct($productId)[0][H_altura];
    $productUnits = $apiRequests->getProduct($productId)[0][Unidad];
    $productDiameter = $apiRequests->getProduct($productId)[0][D_diametro];
    $numPages = count($apiRequests->getViews($_GET['IDcus']));
    $pageWidth = 450;
    // 600 * 72 / 96
    $pageHeight = (int) $apiRequests->getCustomization($_GET['IDcus'])[0]['Height'] * 72 / 96;
    //pixels to points conversion
    if ($realSize == true) {
        if ($productWidth !== null && $productHeight !== null && $productDiameter == null || $productWidth == null && $productHeight == null && $productDiameter !== null) {
            $scaleFactor = floatval($productWidth / 158.75);
            // 600 pixles * 72 / 96 => becomes points then 1 pint is 0.35 mm => therefor 600px are 158.75 mm in 72 pixels per inch
            $pageWidth = str_replace('.00', $productUnits, $productWidth);
            $pageHeight = -1;
            $pdf = $client->setPdfScalingFactor($scaleFactor);
<?php

require_once 'Connections/bd_SELLOS.php';
require_once 'product-customizer/api/api-requests.php';
$apiRequests = new ApiRequests();
$error = '';
$idCustom = 0;
$idProvar = 0;
$idCart = 0;
$idPro = $_GET['IDpro'];
$env = $_GET['env'];
$idClient = isset($row_RecordsetUser['IDcli']) ? $row_RecordsetUser['IDcli'] : 0;
$hideAddToCart = isset($_GET['hideAddToCart']) ? $_GET['hideAddToCart'] : false;
$hideResetBtn = isset($_GET['hideResetBtn']) ? $_GET['hideResetBtn'] : false;
$productName = $apiRequests->getProduct($idPro)[0]['Producto_esp'];
if (!isset($_GET['env']) || $_GET['env'] == '' || !isset($_GET['IDpro']) || $_GET['IDpro'] == '' || is_null($productName)) {
    $error = 'Error Env o IDpro incorrectos';
} else {
    if ($env == 'webmaster') {
        if (isset($_GET['IDcus']) && $_GET['IDcus'] != '') {
            $idCustom = $_GET['IDcus'];
        } else {
            $idCustom = $apiRequests->getTemplateId($idPro)[0]['IDcus'];
            if ($idCustom === NULL) {
                $idCustom = 0;
                $error = 'Producto no tiene Customización template. No es customizable';
            }
        }
    }
    if ($env == 'front') {
        if (!isset($_GET['IDprovar']) || $_GET['IDprovar'] == '') {