Hugo: Hugo export to PDF (save as PDF) option possible?

Created on 18 Dec 2019  路  7Comments  路  Source: gohugoio/hugo

I am using Hugo in localhost and trying to export my single page as PDF. When i ctrl+p on a page and select a pdf printer it renders all the page with the menus. can anybody solve this?

Proposal Stale

Most helpful comment

Possible dup of #6332.

All 7 comments

Possible dup of #6332.

@bugrakeskin Unless there is a special PDF output format you'll need to use CSS to remove parts from the PDF. You can do this with the @media print media query, for example the following would hide the elements with classes sidebar, menu and footer.

@media print {
  .sidebar, .menu, .footer { display: none; } 
}

Additional reading:

@kevingimbel thank you Kevin. Ive managed to do that in css. I added to my themes css file and change the names and it worked.
can you show me how to hide the page details..thank you
resim

@bugrakeskin I don't know how to do this, I think they are added by the browser when you save the PDF

@bugrakeskin Those can be turned off in the browser preferences.

Because browsers have such strong opinions on print to pdf (and the implementation of the paginated media spec is spotty/in progress) having a pdf output in Hugo would be quite nice

Hey folks, I made a small implementation of paged.js for www.pagedjs.org so you can have a look at it and tell me how it works for you.

Still pretty experimental, but i鈥檇 love to have your thoughts.

https://gitlab.pagedmedia.org/julientaq/pagedjs-hugo

If you follow the readme, you鈥檒l get a print button that you can add to any page as part of the template. next step is to add a configurable option in the front matter to show it or not :)

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

digitalcraftsman picture digitalcraftsman  路  3Comments

MunifTanjim picture MunifTanjim  路  3Comments

marekr picture marekr  路  3Comments

artelse picture artelse  路  3Comments

chrissparksnj picture chrissparksnj  路  3Comments