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

--pdf-stylesheet not working with example custom.css #34

Open
foreveremain opened this issue Jun 12, 2023 · 6 comments
Open

--pdf-stylesheet not working with example custom.css #34

foreveremain opened this issue Jun 12, 2023 · 6 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@foreveremain
Copy link

Firstly, thanks for LiaScript .. ! It's a fantasticly capable way of disseminating materials :)

I was wanting to customise PDF export so tried out the following, based on the README. However, I've been getting pupeteer errors:

cat pdf-export.css.example 
:root {
    --color-highlight: 2, 255, 0;
    --color-background: 122, 122, 122;
    --color-border: 0, 0, 0;
    --color-highlight-dark: 0, 0, 0;
    --color-highlight-menu: 0, 0, 0;
    --color-text: 0, 0, 255;
    --global-font-size: 1rem;
    --font-size-multiplier: 2;
}
(base) M-000981:jalview-3dbeacons jprocter$ liaex --format pdf   -o example   --pdf-stylesheet pdf-export.css.example   -i https://github.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/blob/master/08_Objekte.md
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
depending on the size of the course, this can take a while, please be patient...
/usr/local/lib/node_modules/@liascript/exporter/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221
            throw new Error('Evaluation failed: ' + helper_js_1.helper.getExceptionMessage(exceptionDetails));
                  ^

Error: Evaluation failed: Event
    at ExecutionContext._evaluateInternal (/usr/local/lib/node_modules/@liascript/exporter/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:221:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ExecutionContext.evaluate (/usr/local/lib/node_modules/@liascript/exporter/node_modules/puppeteer/lib/cjs/puppeteer/common/ExecutionContext.js:110:16)
    at async $fe4c9e5866fc6c52$export$372e2d09604f52f0 (/usr/local/lib/node_modules/@liascript/exporter/dist/index.js:12583:9)

Node.js v18.10.0

I realise this might be an incompatibility issue - I upgraded to node 20.3 to check - still no dice (but I do also get warnings suggesting I should downgrade to 14).

Any suggestions ?

@andre-dietrich
Copy link
Member

Hi and thanks for trying out ;-)

puppeteer might have done some changes, which now require an additional install step. I don't now, if the --pdf-preview option is working for you, or the general PDF export? However, if this is not the case, you have to perform the following installation step manually:

cd /usr/local/lib/node_modules/@liascript/exporter/node_modules/puppeteer
node install.js

I am currently using node v16.19.0, you could try to downgrade... It would be interesting if this solves the issue. But, you can always manually add the style to your document. This injection is only a shortcut. To do so, simply add the path of your style to the main comment:

<!--
...
link: custom.css
-->

# Main Title

...

This should do the same job. There you can also change the style of the liascript-classes, the root variables are only the basis. And if want to change the icon, you can do this with:

<!--
...
icon: https://image-url.png
-->

# Main Title

...

@andre-dietrich andre-dietrich added bug Something isn't working good first issue Good for newcomers labels Jun 13, 2023
@andre-dietrich
Copy link
Member

andre-dietrich commented Jun 13, 2023

@foreveremain ... I just saw, that you send an example command, I tried it and it did not work, but there was the URL not working anymore. I guess @SebastianZug changed the names of the files 🙈 ... so I have to update the URLs in the READMEs ... sorry for that, you could try:

liaex --format pdf --pdf-preview --pdf-stylesheet YOUR.css -i https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/08_PythonGrundlagen.md

@SebastianZug
Copy link
Contributor

@foreveremain, @andre-dietrich ... That's correct. Due to an adapted focus of this lecture, we renamed the individual files. The current version addresses data aggregation with microcontrollers (C++) and data analysis based on Python. The urls of the corresponding files are:

https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/README.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/00_Einfuehrung.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/01_EingabeAusgabeDatentypen.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/02_OperatorenKontrollstrukturen.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/03_ArrayZeigerReferenzen.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/04_Funktionen.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/05_OOPI.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/06_OOPII.md
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/07_Microcontroller.md 
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/08_PythonGrundlagen.md 
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/09_PythonVertiefung.md 
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/10_Datenvisualisierung.md 
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/11_DatenAnalyse.md 
https://raw.githubusercontent.com/TUBAF-IfI-LiaScript/VL_ProzeduraleProgrammierung/master/12_Anwendungen.md 

@foreveremain
Copy link
Author

thanks @andre-dietrich for the reminder of using link: to load my own css. That works.

As for the original issue: - adding --pdf-stylesheet to any invocation of liaex that otherwise works (ie a pdf is generated if requested) causes it to error out.

Adding --pdf-preview makes no difference to the error, except I see Chromium start up and then close.

I'll explore on another environment to check and post results here.

@andre-dietrich
Copy link
Member

@foreveremain ... but it is possible to generate pdfs, such that the inject-css causes the error only?

@foreveremain
Copy link
Author

no. there is no output file written at all. Chromium is crashing out after intial page load when css is passed via the argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants