I have generated a pdf file using third party now I want apply my own style to the content in pdf.
Can I insert an External CSS File into a generate PDF.
I have tried many ways but all is not working.
Thanks,
You cannot style an already generated PDF with CSS. It is not made out of selectable elements and there is no way to link the CSS to the PDF.
You will have to do the styling before the PDF is created. It's like trying to add more sugar to an already baked cake, there is no way to do it.
Related
I'm currently working on a DASH\Plotly app. I am using dash-bootstrap-components with a custom CSS file.
My current problem is, that my plots aren't styled from the CSS file. So they don't perfectly match with the rest of the theme. From what I found this functionality is not possible.
https://plotly.com/python/templates
Is there maybe a possibility to generate a custom plotly.io Template for the plots which is generated from the CSS file? So that the colors, fonts, fontsizes inside the plots match to the rest of the app.
Asciidoctor mades it very easy to apply a theme or stylesheet to a pdf for export. There is an entire github repo of high quality stylesheets that you can apply to PDF exports.
Now I use Emacs orgmode for so much of my work, I wanted to be able to similarly apply a stylesheet to the pdf output. My question is, how can someone apply a stylesheet when publishing an org file to PDF? I know that beamer has themes that you can apply to slides, and that generates PDF output. However I was looking for the same functionality to write notes and documents.
I looked at the following tutorial on org-publish. The tutorial is actually about exporting to html. But the key insight is that you can apply a setting like:
# Local Variables:
# org-export-html-style: "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/stylesheet.css\" />"
# End:
to the org file header, and it should apply this info to the output. HOWEVER, this solution makes sense in the context of HTML but not necessarily PDF. With HTML you just have to make the stylesheet accessible to the HTML file through the reference and don't need to actually change the HTML, etc. The browser takes care of the rest. But with a PDF it is not so simple--especially since org seems to export to PDF through Latex.
So I went back and checked on Asciidoctor to see how it was about to apply stylesheets to Asciidoc output. Turns out that Asciidoctor does not generate Latex code, but instead exports to PDF using the Ruby Prawn generator. So that explains a key difference between the orgmode pipeline and the Asciidoctor pipeline.
So again, my question was how to apply a stylesheet to an org file when exporting to pdf.
Thanks for any help.
Org-mode exports to LaTeX and then converts the LaTeX to PDF. see here This suggests that the styling of a PDF should use LaTeX classes. That implies semantic markup rather than graphic markup.
To me, it looks like the obvious way to use CSS for a PDF is to export to HTML and then convert the HTML to PDF. The long term approach is probably to learn LaTeX since this is the way org-mode is currently designed to work.
I'm using Apache FOP library to make a transform from a html + css file to pdf file. To do this process, I use several API's to reach to the final pdf. Firstly, I convert the html file to xml using TagSoup, then I transform xml to xsl-fo using xslt stylesheet for then and last step, I transform the xls-fo generated to pdf file. My problem comes when I view the pdf. I want to apply the same css styles as I apply in the html to the pdf too. I know if there are any way to link or include the css files in the xslt file when I try to do the transform to apply this styles on the final pdf.
I know this question is more theorical than a concrete practical case.
I hope anyone can help me.
Thanks!
I would like to change the css feel of my datatable. I am currently using jquerydatatables.css and jquery-ui.css. Is there any free download of datatable css?
Did you try checking the datatables website?
https://datatables.net/manual/styling/theme-creator
They provide support for several themes.
This online style builder will let you customise the colouring of the DataTables stylesheet to fit in seamlessly with your web-site or app. Simply select the colours you want for your table using the options below, and click the Create stylesheet button. The page will then reload and show your customised table below, with the CSS available to copy and paste for your site.
Here is the correct link-
Data tables applying your own css for changing the css of datatables.
You can provide it your own theme.
Just select the colors and
styling.
It will generate a CSS for your applied styling.
You can copy
in your css file.
You are good to go.
Hope this helps...
How would one do this in Drupal 7? I want to add a few small style edits to the way the PDF outputs. I am using TCPDF. I read somewhere that its not posible with TCPDF, but other sources say it is. Should I be switching to dompdf? I've read the documentation but just can't seem to understand which file generates the PDF.
I have the module successfully generating a PDF from a View, so this is the last step in moving on with this project.
For anytime you want to style PDFs use DOMPDF, it will be less painful. Then style your pdf using print.css in the sites/domain.com/themes/yourtheme/css folder.
You can also copy the print.tpl.php file from the module's folder and paste it in sites/domain.com/themes/yourtheme/templates to choose exactly what you want to display in your pdf.