Add CSS to the Technical document PDF #2

Open
opened 2021-06-02 12:53:04 +02:00 by chris · 8 comments
Owner

We need to set font type and some css to the pdf. Maybe add a footer text too.

We need to set font type and some css to the pdf. Maybe add a footer text too.
Owner

wich pdf? the one generated by omeka?

thant would just be a css calling @media print {}

where is the css called from? is it a plugin generated in the server or is it the browser processing the html/web?

wich pdf? the one generated by omeka? thant would just be a css calling `@media print {}` where is the css called from? is it a plugin generated in the server or is it the browser processing the html/web?
jorge self-assigned this 2021-07-29 10:20:59 +02:00
Author
Owner
PDF generation happens here https://git.hangar.org/arcHIVE-tech/arc-hive-TechDocument-omeka-module/src/branch/main/src/Site/BlockLayout/TechDocument.php#L89 It uses mPDF https://mpdf.github.io/css-stylesheets/introduction.html#example-using-a-stylesheet
Owner

created branch fix/print-pdf to solve this issue and to keep print styles all together.

https://git.hangar.org/arcHIVE-tech/Arc-hive-omeka-theme/src/branch/fix/print-pdf-css

created branch fix/print-pdf to solve this issue and to keep print styles all together. https://git.hangar.org/arcHIVE-tech/Arc-hive-omeka-theme/src/branch/fix/print-pdf-css
Owner

i was checking this issue, the PDF generation happens at:

$mpdf->WriteHTML($html); 

so we have to do this https://mpdf.github.io/css-stylesheets/introduction.html#example-using-a-stylesheet

and parameters are explained here https://mpdf.github.io/reference/mpdf-functions/writehtml.html

so the result is

$stylesheet = file_get_contents('print.css');

$mpdf->WriteHTML($stylesheet,\Mpdf\HTMLParserMode::HEADER_CSS);

it is no working as spected, I can't find where to put the print.css file

i was checking this issue, the PDF generation happens at: ```php $mpdf->WriteHTML($html); ``` so we have to do this https://mpdf.github.io/css-stylesheets/introduction.html#example-using-a-stylesheet and parameters are explained here https://mpdf.github.io/reference/mpdf-functions/writehtml.html so the result is ```php $stylesheet = file_get_contents('print.css'); $mpdf->WriteHTML($stylesheet,\Mpdf\HTMLParserMode::HEADER_CSS); ``` it is no working as spected, I can't find where to put the `print.css` file
Author
Owner

Hi,

I have commited here eeaed03d7d

print.css works.

Hi, I have commited here https://git.hangar.org/arcHIVE-tech/arc-hive-TechDocument-omeka-module/commit/eeaed03d7de28ba4899fec597fb3a629cbdc6e87 print.css works.
Owner

I was trying to understand where the h1 {color: red} it is applied but I can't.

What I understand is that this module will use the @media print {} definition in the ./modules/TechDocument/asset/css/print.css defined by the module, but I can see that what is applying is the default.css defined by the theme.

Is it correct? is this one where I have to focus?
https://git.hangar.org/arcHIVE-tech/Arc-hive-omeka-theme/src/branch/develop/asset/css/default.css

I got lost in may thoughts... thanks for the help

I was trying to understand where the `h1 {color: red}` it is applied but I can't. What I understand is that this module will use the `@media print {}` definition in the `./modules/TechDocument/asset/css/print.css` defined by the module, but I can see that what is applying is the `default.css` defined by the theme. Is it correct? is this one where I have to focus? https://git.hangar.org/arcHIVE-tech/Arc-hive-omeka-theme/src/branch/develop/asset/css/default.css I got lost in may thoughts... thanks for the help
Author
Owner

My guess is that Mpdf does not use any css unless defined. We don't tell Mpdf about default.css, so it is never included. We do tell Mpdf about print.css, so it is the only only css included.

My guess is that Mpdf does not use any css unless defined. We don't tell Mpdf about default.css, so it is never included. We do tell Mpdf about print.css, so it is the only only css included.
Owner
as @chris found out we need to check https://git.hangar.org/arcHIVE-tech/arc-hive-TechDocument-omeka-module/src/branch/main/asset/css I'll take this from here
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: arcHIVE-tech/fixes#2
No description provided.