public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* PDF doesn't render custom CSS with base64 encoded image
@ 2019-09-30 23:54 Gabriel Volpe
       [not found] ` <cac929e5-e772-4a83-9f4b-eeb89b86ec8e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Gabriel Volpe @ 2019-09-30 23:54 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1520 bytes --]

Hi,

I have a custom css with a base64-encoded image, something like: 

.box-tip {
    background-color: #fff8e6;
    background-image: url('data:image/png;base64,iVBORw0KGgoAAAAN=');
    border: solid 1px #fad264;
}

It is rendered properly when I convert my markdown files to EPUB but not 
when I convert it to PDF. 

pandoc 2.7.3
Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1

I'm on *Ubuntu 19.04* if that matters. Here's the full command I'm using 
for EPUB:

pandoc -o book.epub title.txt chapter1.md chapterN.md --from markdown+implicit_figures 
--toc --highlight-style pygments --epub-cover-image=img/cover.png --css css/
boxes.css --css css/book.css

And here's the full command for PDF:

pandoc -o book.pdf title.txt chapter1.md chapterN.md --from markdown+implicit_figures 
--toc --highlight-style pygments --css css/boxes.css --css css/book.css --
pdf-engine=pdflatex -V documentclass=book -V papersize=A4 -V subparagraph -V 
links-as-notes -V classoption=oneside -V classoption=openany

Any ideas on whether this is a bug or it's just me doing something wrong?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/cac929e5-e772-4a83-9f4b-eeb89b86ec8e%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 12876 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PDF doesn't render custom CSS with base64 encoded image
       [not found] ` <cac929e5-e772-4a83-9f4b-eeb89b86ec8e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2019-10-01  0:16   ` John MacFarlane
       [not found]     ` <yh480k7e5p2uby.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: John MacFarlane @ 2019-10-01  0:16 UTC (permalink / raw)
  To: Gabriel Volpe, pandoc-discuss


If you're generatinng PDF by the default method (which
internally converts to LaTeX and then runs pdflatex on the
result), CSS will have no effect, because CSS is for HTML, not LaTeX.
(Going to EPUB, the CSS is passed through and thus still has
an effect.)

You could explore using one of the --pdf-engine settings that
goes via HTML.

Gabriel Volpe <volpegabriel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> Hi,
>
> I have a custom css with a base64-encoded image, something like: 
>
> .box-tip {
>     background-color: #fff8e6;
>     background-image: url('data:image/png;base64,iVBORw0KGgoAAAAN=');
>     border: solid 1px #fad264;
> }
>
> It is rendered properly when I convert my markdown files to EPUB but not 
> when I convert it to PDF. 
>
> pandoc 2.7.3
> Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1
>
> I'm on *Ubuntu 19.04* if that matters. Here's the full command I'm using 
> for EPUB:
>
> pandoc -o book.epub title.txt chapter1.md chapterN.md --from markdown+implicit_figures 
> --toc --highlight-style pygments --epub-cover-image=img/cover.png --css css/
> boxes.css --css css/book.css
>
> And here's the full command for PDF:
>
> pandoc -o book.pdf title.txt chapter1.md chapterN.md --from markdown+implicit_figures 
> --toc --highlight-style pygments --css css/boxes.css --css css/book.css --
> pdf-engine=pdflatex -V documentclass=book -V papersize=A4 -V subparagraph -V 
> links-as-notes -V classoption=oneside -V classoption=openany
>
> Any ideas on whether this is a bug or it's just me doing something wrong?
>
> Thanks!
>
> -- 
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/cac929e5-e772-4a83-9f4b-eeb89b86ec8e%40googlegroups.com.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PDF doesn't render custom CSS with base64 encoded image
       [not found]     ` <yh480k7e5p2uby.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
@ 2019-10-01  0:38       ` Gabriel Volpe
  0 siblings, 0 replies; 3+ messages in thread
From: Gabriel Volpe @ 2019-10-01  0:38 UTC (permalink / raw)
  To: John MacFarlane; +Cc: pandoc-discuss

[-- Attachment #1: Type: text/plain, Size: 2841 bytes --]

Understood. Is there any workaround other than going through html?

I really like the Latex output and although `--pdf-engine=wkhtmltopdf`
renders these images the output format is terrible for a book.

On Mon, 30 Sep 2019 at 19:17, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

>
> If you're generatinng PDF by the default method (which
> internally converts to LaTeX and then runs pdflatex on the
> result), CSS will have no effect, because CSS is for HTML, not LaTeX.
> (Going to EPUB, the CSS is passed through and thus still has
> an effect.)
>
> You could explore using one of the --pdf-engine settings that
> goes via HTML.
>
> Gabriel Volpe <volpegabriel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>
> > Hi,
> >
> > I have a custom css with a base64-encoded image, something like:
> >
> > .box-tip {
> >     background-color: #fff8e6;
> >     background-image: url('data:image/png;base64,iVBORw0KGgoAAAAN=');
> >     border: solid 1px #fad264;
> > }
> >
> > It is rendered properly when I convert my markdown files to EPUB but not
> > when I convert it to PDF.
> >
> > pandoc 2.7.3
> > Compiled with pandoc-types 1.17.5.4, texmath 0.11.2.2, skylighting 0.8.1
> >
> > I'm on *Ubuntu 19.04* if that matters. Here's the full command I'm using
> > for EPUB:
> >
> > pandoc -o book.epub title.txt chapter1.md chapterN.md --from
> markdown+implicit_figures
> > --toc --highlight-style pygments --epub-cover-image=img/cover.png --css
> css/
> > boxes.css --css css/book.css
> >
> > And here's the full command for PDF:
> >
> > pandoc -o book.pdf title.txt chapter1.md chapterN.md --from
> markdown+implicit_figures
> > --toc --highlight-style pygments --css css/boxes.css --css css/book.css
> --
> > pdf-engine=pdflatex -V documentclass=book -V papersize=A4 -V
> subparagraph -V
> > links-as-notes -V classoption=oneside -V classoption=openany
> >
> > Any ideas on whether this is a bug or it's just me doing something wrong?
> >
> > Thanks!
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "pandoc-discuss" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/cac929e5-e772-4a83-9f4b-eeb89b86ec8e%40googlegroups.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAJReL35rWKCF14FTu_%2Btkb-Q%3Ddnq2d2Wz2gp%2Bb3OPDA373N6BA%40mail.gmail.com.

[-- Attachment #2: Type: text/html, Size: 4125 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-01  0:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-30 23:54 PDF doesn't render custom CSS with base64 encoded image Gabriel Volpe
     [not found] ` <cac929e5-e772-4a83-9f4b-eeb89b86ec8e-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2019-10-01  0:16   ` John MacFarlane
     [not found]     ` <yh480k7e5p2uby.fsf-pgq/RBwaQ+zq8tPRBa0AtqxOck334EZe@public.gmane.org>
2019-10-01  0:38       ` Gabriel Volpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).