giansalex / lycet

API REST de Facturación Electrónica Sunat utilizando Greenter.
MIT License
81 stars 43 forks source link

error al generar pdf #13

Closed JHONQUISPEFLORES closed 5 years ago

JHONQUISPEFLORES commented 5 years ago

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". pdf_lycet_rror

giansalex commented 5 years ago

Tienes instalado wkhtmltopdf? Puedes ejecutar el siguiente comando en la consola de windows

wkhtmltopdf http://google.com google.pdf
JHONQUISPEFLORES commented 5 years ago

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. convertir a pdf

giansalex commented 5 years ago

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

JHONQUISPEFLORES commented 5 years ago

SI ESTOY HACIENDO ESO PROBE CON UNA "\" Y DOS "\", WKHTMLTOPDF_PATH=C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe PERO ME BOTA UN ERROR.

JHONQUISPEFLORES commented 5 years ago

@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"

giansalex commented 5 years ago

Si, eso mismo iba a decir

JHONQUISPEFLORES commented 5 years ago

PERO SI EL RESULTADO LO QUIERO CONSUMIR (VISUALIZAR) DESDE OTRO APLICATIVO, QUE DEBO HACER?

giansalex commented 5 years ago

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.

JHONQUISPEFLORES commented 5 years ago

OK, MUCHAS GRACIAS @giansalex.

JHONQUISPEFLORES commented 5 years ago

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.?

JHONQUISPEFLORES commented 5 years ago

aunque agregando en el template xml invoice2.1.xml.twig, estaría igual

JHONQUISPEFLORES commented 5 years ago

le agregue en el template, pero no refleja el cambio, imagino que debe ser por el cache, en donde puedo cambiar eso?

giansalex commented 5 years ago

Eliminando la carpeta /var

JHONQUISPEFLORES commented 5 years ago

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;
    }
giansalex commented 5 years ago

si, eso serian los cambios.

JHONQUISPEFLORES commented 5 years ago

GRACIAS @giansalex, res un genio.

giansalex commented 5 years ago

Si tienes otra consulta, crea un nuevo issue, en este no debió tocarse temas que no tenian relación con el titulo.

heiner25 commented 5 years ago

@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

JHONQUISPEFLORES commented 5 years ago

Estimado @heiner25 , tampoco pude solucionarlo sigo con el pdf en blanco, eso de eliminar /var, era para reflejar los cambios en el template.

giansalex commented 5 years ago

Existe un boton a la derecha que dice Download, alli si se puede ver el pdf correctamente

JHONQUISPEFLORES commented 5 years ago

si funciona desde Download @giansalex, MUCHAS GRACIAS.