Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the DOMPDF instance in Font_Metrics class. #27

Closed
wants to merge 1 commit into from

Conversation

tortuetorche
Copy link

Avoid error like file_get_contents(/assets/my_font.woff): failed to open stream: No such file or directory in vendor/dompdf/dompdf/include/font_metrics.cls.php.
Requirement: the pull request dompdf/dompdf#796 need to be merged in DomPDF repositiory and a new release tagged.

Avoid error like `file_get_contents(/assets/my_font.woff): failed to open stream: No such file or directory` in `vendor/dompdf/dompdf/include/font_metrics.cls.php`.
Requirement: the pull request dompdf/dompdf#796 need to be merged in DomPDF repositiory.
@barryvdh
Copy link
Owner

barryvdh commented Mar 5, 2014

So we have to wait before that PR is merged and a new release is tagged?

@tortuetorche
Copy link
Author

It'll be OK if you merge this pull request now, but to take effect, the dompdf/dompdf#796 need to be merged then, like you said, a new DOMPDF release need to be tagged.

Sorry for my bad English.
By the way, your package is really useful for me, many thanks Barry 😉

@barryvdh
Copy link
Owner

barryvdh commented Mar 5, 2014

And when does this issue occur? Do you have a small testcase so I can recreate this issue? I've never encountered this before..

@tortuetorche
Copy link
Author

Of course, in your CSS file, if you have things like this:

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url(/assets/fonts/glyphicons-halflings-regular.woff);
}

@barryvdh
Copy link
Owner

barryvdh commented Mar 5, 2014

Doesn't assets/fonts instead of /assets/fonts work? I thought that was what set_base_path() was for, to make it relative from the public folder.

@tortuetorche
Copy link
Author

Doesn't assets/fonts instead of /assets/fonts work?

Yes, it work, but I share my CSS file with the web application and the generated PDF files.
So, I need yo keep the first /, otherwise I have this error in my Web browser:
GET http://localhost:8000/assets/assets/fonts/glyphicons-halflings-regular.woff 404 (Not Found)
See the double assets.
FYI, there is already a discussion about this here: dompdf/dompdf/issues/739.

I thought that was what set_base_path() was for, to make it relative from the public folder.

It should, my pull request fix this behavior for font URLs.

@barryvdh
Copy link
Owner

barryvdh commented Mar 5, 2014

Okay, and using the asset() function in Laravel? That should work for both cases.

@tortuetorche
Copy link
Author

The font URL isn't generated in a PHP file, so I can't use the asset() function of Laravel.
Of course we can use this function in DOMPDF libray, here.
But it's an agnostic library who doesn't depends on Laravel.

@barryvdh
Copy link
Owner

barryvdh commented Mar 5, 2014

Okay I thought you were using it in a Blade template or something like that.
Let's see if the PR get's merged. Let me know if there is an status update.

@tortuetorche
Copy link
Author

Let me know if there is an status update.

OK, I will.

@barryvdh
Copy link
Owner

Closing this untill further updates.

@barryvdh barryvdh closed this Mar 11, 2014
@azulkipli
Copy link

Hi Barry, I have same error notification when using

file_put_contents(/web/myapp/app/storage/fonts/f96df7d9f56dfb0fe8f0443fe52ee191.ttf): failed to open stream: No such file or directory /web/myapp/vendor/dompdf/dompdf/include/font_metrics.cls.php

In my Views I use Google Font

@import url(http://fonts.googleapis.com/css?family=Bree+Serif);*/
body, h1, h2, h3, h4, h5, h6{
font-family: 'Bree Serif', serif;

@andikamri
Copy link

Hello Barry, I have the same provblem like azulkipli, please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants