Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.1K
Views
Laravel DomPdf Agregar fuente personalizada

Estoy tratando de usar la fuente en inglés ANTIGUO en Dompdf con Laravel. He insertado la fuente en la vista de laravel. Pero parece que al generar el pdf no funciona. Intenté editar dompdf >vendor >.../dompdf_font_family_cache.dist.php Pero no tuve suerte,

¿Puede alguien sugerir una solución?

Gracias de antemano.

about 4 years ago · Santiago Trujillo
3 answers
Answer question

0

  1. Cree un directorio de fuentes en la carpeta de almacenamiento de su proyecto Laravel. (almacenamiento/fuentes)
  2. Coloque sus archivos .otf o .ttf en el directorio de almacenamiento/fuentes.
  3. En su vista/html, agregue las reglas @font-face usando el método storage_path que proporciona Laravel.

     @font-face { font-family: 'Your custom font name'; src: url({{ storage_path('fonts\your-custom-font.ttf') }}) format("truetype"); font-weight: 400; // use the matching font-weight here ( 100, 200, 300, 400, etc). font-style: normal; // use the matching font-style here }
  4. Agregue reglas de familia de fuentes a su css como se ve a continuación

     body { font-family: "Your custom font name"; }

Espero que esto ayude.

about 4 years ago · Santiago Trujillo Report

0

Estaba tratando de incluir fuentes personalizadas también. Incluí la fuente en la vista (usando la declaración @font-face), pero cuando traté de generar el pdf, me dio una ErrorException en AdobeFontMetrics.php. Lo resolví creando una carpeta de fuentes en la carpeta de almacenamiento de su proyecto laravel. Así que ahora tengo:

 > storage > app > fonts > framework > logs

espero que ayude

about 4 years ago · Santiago Trujillo Report

0

@font-face { font-family: 'Journal'; src: url('yourwebsite.com/journal.ttf")}}') format('truetype'); } .typed { font-family: 'Journal'; } <p class='typed'>Signature</p>

Asegúrese de poner el nombre de su fuente como esta fuente: Diario ; Funcionará.

Además, agregue la carpeta de fuentes en su carpeta de almacenamiento.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!