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 doc has no style #6110

Closed
RaffaeleAprea opened this issue Jun 19, 2020 · 7 comments
Closed

pdf doc has no style #6110

RaffaeleAprea opened this issue Jun 19, 2020 · 7 comments

Comments

@RaffaeleAprea
Copy link

Hi, I followed the steps described at tutorial 3 of Walkthrough Topics
and I tried to use default, statictoc and darkfx templates found here
but the pdf file has no style.

I made a repo of the docfx project referred to this issue -> here
There are a simple dll and its xml file,both inside "src" folder.

Issue infos:
Operating System: Windows

DocFX Version Used: 2.55

wkhtmltopdf Version Used: 0.12.6

Prerequisites:

  • docfx.exe and wkhtmltopdf.exe installed. (Both tested: docfx builds currectly online documentation and wkhtmltopdf converts properly a web page into a pdf file).
  • check "pdf.default" and "statitoc" are in the template list (I run docfx template list to check).
  • put darkfx template files inside a "templates" folder in the root.

Steps
run "docfx pdf"

Expected Behavior:
pdf file has style.

Actual Behavior:

  • If I use "template":"pdf.default" pdf has no style.(I expected it to be similar to online doc "default" style)
  • If I use "template":"statictoc" pdf is not built + this warning : "Warning:[PDF]No TOC file is included, no PDF file will be generated."
  • If I use "template": ["pdf.default","templates/darkfx"] pdf has no style

gitpdf

What am I missing?

Note: If I built the online documentation site instead it works with darkfx. (see "_docfx.json" inside the repo)

@trits
Copy link

trits commented Jun 19, 2020

I have the same issue, no style like in the picture and images are not rendered in the PDF. With older DocFX version the PDF did have style (pdf.default). I have installed DocFX and wkhtmltopdf with Chocolatey.
Operating System: Windows
DocFX Version Used: 2.55
wkhtmltopdf Version Used: 0.12.6

@trits
Copy link

trits commented Jun 19, 2020

This issue may be caused by wkhtmltopdf 0.12.6, which has BREAKING CHANGE: block local filesystem access by default (wkhtmltopdf/wkhtmltopdf#4536).

Edit: It is working with images and styles with docfx 2.55.0 and wkhtmltopdf 0.12.5

@RaffaeleAprea
Copy link
Author

You are right, I have tried again using instead versions 0.12.5 and 0.12.4 and I confirm pdf get expected styles (default and darkfx).

@ghost
Copy link

ghost commented Jun 21, 2020

Add this to your JSON config file:

"wkhtmltopdf": {
"additionalArguments": "--enable-local-file-access"
}

This will fix it with the latest wkhtmlpdf. Refer to #6072 , which documents this new requirement.

@RaffaeleAprea
Copy link
Author

I have added it inside the "pdf" dict and now it works, Thanks @Blake-Eryx !

I consider this closed, but first I'm just curious to know about one last thing: what's the actual
reason of the error regarding statictoc? (see point 2 of Actual Behavior).

@ghost
Copy link

ghost commented Jun 21, 2020

You will just want to use "pdf.default" for PDF files. The other themes are designed for HTML output. For example, statictoc is for when you want HTML help that is not being served by a webservice (e.g., you just want it on a website or network share where you don't have a localhost service running your help as its own website).

If you want something like dark theme, the easiest way is to make your a custom theme for PDF that goes on top of pdf.default. It could be a simple CSS file that you model after what the regular dark theme does. Of course, if you have a dark-themed PDF, that would be lot of ink when you print it :)

@RaffaeleAprea
Copy link
Author

Ok, I understand, thank you very much.
I was just struggling to get a pdf output using any style, whatever they look like :)

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

No branches or pull requests

2 participants