Closed JHONQUISPEFLORES closed 5 years ago
Tienes instalado wkhtmltopdf? Puedes ejecutar el siguiente comando en la consola de windows
wkhtmltopdf http://google.com google.pdf
SI ACABO DE INSTALARLO EN WINDOWS @giansalex, PERO PARA QUE FUNCIONE EL COMANDO wkhtmltopdf http://google.com google.pdf, TENGO QUE EJECUTARLO DESDE SU CARPETA INSTALADA.
Entonces en el archivo .env
que esta en la raiz del proyecto, hay una configuracion WKHTMLTOPDF_PATH
, alli debes colocar la ruta completa de wkhtmltopdf.exe
SI ESTOY HACIENDO ESO PROBE CON UNA "\" Y DOS "\", WKHTMLTOPDF_PATH=C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe PERO ME BOTA UN ERROR.
@giansalex, CREO K YA ESTA, ERA POR LOS ESPACIOS EN LA RUTA, LE AGREGUE LAS COMILLAS WKHTMLTOPDF_PATH="C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"
Si, eso mismo iba a decir
PERO SI EL RESULTADO LO QUIERO CONSUMIR (VISUALIZAR) DESDE OTRO APLICATIVO, QUE DEBO HACER?
El api retorna el pdf como un archivo adjunto, si has descargado archivos de la web de cualquier sitio, es de la misma forma, leer los bytes y guardarlo en disco.
OK, MUCHAS GRACIAS @giansalex.
UNA CONSULTA MAS @giansalex AL RESPECTO, SABES LO ESTOY PROBANDO CON EL POSTMAN, Y SI ME DA LA FORMA DE DESCARGAR EL ARCHIVO EN PREVIEW, PERO EL ARCHIVO DESCARGADO EN PDF ESTA EN BLANCO, HAY QUE REALIZAR ALGUN PROCEDIMIENTO ADICIONAL.?
aunque agregando en el template xml invoice2.1.xml.twig, estaría igual
le agregue en el template, pero no refleja el cambio, imagino que debe ser por el cache, en donde puedo cambiar eso?
Eliminando la carpeta /var
UNA CONSULTA ADICIONAL, SI ESTE PROYECTO LO MANDO A PRODUCCIÓN, SOLO LE MODIFICO LAS RUTAS DEL WS SUNAT, AGREGO EL CERTIFICADO Y MODIFICO LAS CREDENCIALES DE ESTA FUNCIÓN de util.php??
public function getSee($endpoint)
{
$see = new See();
$see->setService($endpoint);
// $see->setCodeProvider(new XmlErrorCodeProvider());
$see->setCertificate(file_get_contents(__DIR__ . '/../resources/cert.pem'));
$see->setCredentials('20000000001MODDATOS', 'moddatos');
$see->setCachePath(__DIR__ . '/../cache');
return $see;
}
si, eso serian los cambios.
GRACIAS @giansalex, res un genio.
Si tienes otra consulta, crea un nuevo issue, en este no debió tocarse temas que no tenian relación con el titulo.
@giansalex @JHONQUISPEFLORES como soluciono el problema que al generar el pdf usando postman y en preview se descarga el pdf pero en blanco? intenté borrando la carpeta var, pero aun persiste el mismo problema
Estimado @heiner25 , tampoco pude solucionarlo sigo con el pdf en blanco, eso de eliminar /var, era para reflejar los cambios en el template.
Existe un boton a la derecha que dice Download, alli si se puede ver el pdf correctamente
si funciona desde Download @giansalex, MUCHAS GRACIAS.
Buenas noches @giansalex, que crees que estoy haciendo mal, el xml y cdr si esta normal, el error me muestra cuando utilizo el api "http:://localhost:8000/api/v1/invoice/pdf?token=123456".