laravel-dompdf icon indicating copy to clipboard operation
laravel-dompdf copied to clipboard

Generated PDF does not take custom font

Open sreejithcj opened this issue 3 years ago • 12 comments

HI,

The PDF is getting generated, but it has the default font instead of the custom font (Anitto). The text is rendered in custom font when I print the input HTML on the browser, but the PDF takes the default font. I see that the storage/fonts folder is writeable and the font files and the cache files are getting generated in that folder.

Any thoughts please?

Sreejith C J

sreejithcj avatar Jun 29 '22 14:06 sreejithcj

HI,

The PDF is getting generated, but it has the default font instead of the custom font (Anitto). The text is rendered in custom font when I print the input HTML on the browser, but the PDF takes the default font. I see that the storage/fonts folder is writeable and the font files and the cache files are getting generated in that folder.

Any thoughts please?

Sreejith C J

++

MrAndrewsHere avatar Jul 01 '22 18:07 MrAndrewsHere

Hi,

I would like to hear your thoughts on this.

Regards Sreejith C J

sreejithcj avatar Jul 02 '22 07:07 sreejithcj

Hi, work for me: put fonts with styles to public folder. image

write in style.css image

include in .blade.php image

after PDF::loadView()->stream() (or some rendering) files are getting generated in that folder and text is rendered in custom fonts. image

MrAndrewsHere avatar Jul 03 '22 04:07 MrAndrewsHere

This is only a wraper for laravel, the real package is https://github.com/dompdf/dompdf https://github.com/barryvdh/laravel-dompdf/blob/f7384cf9af89df4b74559fac9ce3355cd686ede5/config/dompdf.php#L31-L48

erikn69 avatar Jul 04 '22 16:07 erikn69

Hi,

Thank you very much for the details, but I face the same issue. Please find the details below and please check the screenshots.

  1. This is a Laravel application and I am trying to generate a PDF file with Anitto font. When I echo the HTML file (just before creating the PDF file), I see the font being applied correctly (seen in the attached file html-output.png. But the PDf file rendered just after the HTML is created has a default font (as seen in the attached file pdf.png)
  2. The fonts folder is /storage/fonts and the same is being configured in the dom-pdf's config file (as seen in the attached dompdf-config.png)
  3. When I delete all contents of the /storage/fonts folder and run my application, I see that the files are getting created in that folder (as seen in the fonts-folder.png). This confirms that dom-pdf is able to create files in this folder.
  4. You can also see the cache file's content (as in dompdf-cachefile.png)
  5. style.png has the style config

The interesting fact is that I am able to generate the PDF file with Anitto font with the same configuration on our staging server. It does not work on production server alone. Please let me know if you have any thoughts.

Regards Sreejith C J

On Mon, Jul 4, 2022 at 10:14 PM erikn69 @.***> wrote:

This is only a wraper for laravel, the real package is https://github.com/dompdf/dompdf

— Reply to this email directly, view it on GitHub https://github.com/barryvdh/laravel-dompdf/issues/900#issuecomment-1173998103, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMKDVU4D4J2KQCLBLRWO3LVSMIGDANCNFSM52GBJ4WQ . You are receiving this because you authored the thread.Message ID: @.***>

sreejithcj avatar Jul 12 '22 14:07 sreejithcj

Hi, Thank you very much for the details, but I face the same issue. Please find the details below and please check the screenshots. 1. This is a Laravel application and I am trying to generate a PDF file with Anitto font. When I echo the HTML file (just before creating the PDF file), I see the font being applied correctly (seen in the attached file html-output.png. But the PDf file rendered just after the HTML is created has a default font (as seen in the attached file pdf.png) 2. The fonts folder is /storage/fonts and the same is being configured in the dom-pdf's config file (as seen in the attached dompdf-config.png) 3. When I delete all contents of the /storage/fonts folder and run my application, I see that the files are getting created in that folder (as seen in the fonts-folder.png). This confirms that dom-pdf is able to create files in this folder. 4. You can also see the cache file's content (as in dompdf-cachefile.png) 5. style.png has the style config The interesting fact is that I am able to generate the PDF file with Anitto font with the same configuration on our staging server. It does not work on production server alone. Please let me know if you have any thoughts. Regards Sreejith C J On Mon, Jul 4, 2022 at 10:14 PM erikn69 @.> wrote: This is only a wraper for laravel, the real package is https://github.com/dompdf/dompdf — Reply to this email directly, view it on GitHub <#900 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMKDVU4D4J2KQCLBLRWO3LVSMIGDANCNFSM52GBJ4WQ . You are receiving this because you authored the thread.Message ID: @.>

can't see ur attachments

MrAndrewsHere avatar Jul 12 '22 15:07 MrAndrewsHere

oh, u just ref on my attachments)

MrAndrewsHere avatar Jul 12 '22 16:07 MrAndrewsHere

Whether you could find my attachments or do I need to send them on a separate email? or do I need to upload to Gdrive and share?

Regards Sreejith C J

On Tue, Jul 12, 2022 at 9:31 PM MrAndrewsHere @.***> wrote:

oh, u just ref on my attachments)

— Reply to this email directly, view it on GitHub https://github.com/barryvdh/laravel-dompdf/issues/900#issuecomment-1181947887, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMKDVXM662EZEQR425ALS3VTWJEFANCNFSM52GBJ4WQ . You are receiving this because you authored the thread.Message ID: @.***>

sreejithcj avatar Jul 13 '22 01:07 sreejithcj

Hi,

Could you check my scenario? Could you find the attachments that I had sent?

Regards Sreejith C J

On Wed, Jul 13, 2022 at 7:15 AM Sreejith C J @.***> wrote:

Whether you could find my attachments or do I need to send them on a separate email? or do I need to upload to Gdrive and share?

Regards Sreejith C J

On Tue, Jul 12, 2022 at 9:31 PM MrAndrewsHere @.***> wrote:

oh, u just ref on my attachments)

— Reply to this email directly, view it on GitHub https://github.com/barryvdh/laravel-dompdf/issues/900#issuecomment-1181947887, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMKDVXM662EZEQR425ALS3VTWJEFANCNFSM52GBJ4WQ . You are receiving this because you authored the thread.Message ID: @.***>

sreejithcj avatar Jul 15 '22 03:07 sreejithcj

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Sep 21 '22 03:09 stale[bot]

Hi,

This got resolved after I installed the library again in the server. I am not able to see this issue in Github when I tried to add this comment.

Regards Sreejith C J

On Wed, Sep 21, 2022 at 8:39 AM stale[bot] @.***> wrote:

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

— Reply to this email directly, view it on GitHub https://github.com/barryvdh/laravel-dompdf/issues/900#issuecomment-1253150326, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMKDVURE5UDGCP6YYUH5RDV7J36TANCNFSM52GBJ4WQ . You are receiving this because you authored the thread.Message ID: @.***>

sreejithcj avatar Sep 21 '22 03:09 sreejithcj

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.

stale[bot] avatar Jun 18 '23 08:06 stale[bot]