abemedia / jekyll-pdf

Create PDFs from Jekyll pages & documents.
http://abemedia.co.uk/jekyll-pdf/
GNU General Public License v3.0
104 stars 35 forks source link

PDFs generated using Markdown content #11

Open atnpgo opened 7 years ago

atnpgo commented 7 years ago

The PDFs generated by the plugin appear to have the raw markdown content embedded in them instead of the generated HTML.

Is there an undocumented setting to get the generated contents instead of the raw markdown within the PDFs?

zhulik commented 6 years ago

@atnpgo fixed in my fork https://github.com/zhulik/jekyll_blog

dmalan commented 6 years ago

Afraid we're running into the same issue with, e.g., this proof of concept, https://gist.github.com/dmalan/a034800c08562da301dc57e355ff56e8 using jekyll-pdf 0.1.7 (with jekyll 3.6.2 and jekyll-assets 2.4.0). The resulting foo.html file is as expected, but the resulting foo.pdf file is:

screen shot 2017-11-24 at 12 10 22 pm

@zhulik, thanks for the mention of your fork. Though when we instead updated our Gemfile with

gem "jekyll-pdf", :git => "https://github.com/zhulik/jekyll-pdf.git"

afraid we then ran into the below:

# bundle exec jekyll serve  --host=0.0.0.0 --port=8080 --incremental --verbose --trace
  Logging at level: debug
Configuration file: /home/ubuntu/tmp/_config.yml
  Logging at level: debug
Creating a new instance of:  Jekyll::Assets::Env
The old value of Sprockets:  
         Requiring: jekyll-pdf
         Requiring: kramdown
            Source: /home/ubuntu/tmp
       Destination: /home/ubuntu/tmp/_site
 Incremental build: enabled
      Generating... 
Creating a new instance of:  Jekyll::Assets::Env
The old value of Sprockets:  #<Jekyll::Assets::Env:0x00561bf3bb5fc0>
       EntryFilter: excluded /Gemfile
       EntryFilter: excluded /Gemfile.lock
        Generating: Jekyll::PDF::Generator finished in 0.006145728 seconds.
         Rendering: foo.pdf
  Pre-Render Hooks: foo.pdf
  Rendering Liquid: foo.pdf
  Rendering Markup: foo.pdf
  Rendering Layout: foo.pdf
bundler: failed to load command: jekyll (/opt/rbenv/versions/2.4.0/bin/jekyll)
NoMethodError: undefined method `scan' for nil:NilClass
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/pdfkit-0.8.2/lib/pdfkit/pdfkit.rb:92:in `find_options_in_meta'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/pdfkit-0.8.2/lib/pdfkit/pdfkit.rb:29:in `initialize'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/jekyll-pdf-631496a81a59/lib/jekyll/pdf/document.rb:82:in `new'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/bundler/gems/jekyll-pdf-631496a81a59/lib/jekyll/pdf/document.rb:82:in `write'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:210:in `block in write'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:331:in `block (2 levels) in each_site_file'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:330:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:330:in `block in each_site_file'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:329:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:329:in `each_site_file'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:209:in `write'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/site.rb:75:in `process'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/command.rb:28:in `process_site'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:65:in `build'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/build.rb:36:in `process'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/serve.rb:42:in `block (3 levels) in init_with_program'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/serve.rb:42:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/lib/jekyll/commands/serve.rb:42:in `block (2 levels) in init_with_program'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
  /opt/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/jekyll-3.6.2/exe/jekyll:15:in `<top (required)>'
  /opt/rbenv/versions/2.4.0/bin/jekyll:22:in `load'
  /opt/rbenv/versions/2.4.0/bin/jekyll:22:in `<top (required)>'
zhulik commented 6 years ago

I'm so sorry that you spent a time for this PR, I didn't even think that you will look at this. I'm new to Jekyll and these fixes helped me to build a valid PDF for my blog while the upstream version didn't work for me. I didn't make any tests for any other environments and cases. Unfortunately I don't have a time to help you with debugging, sorry

dmalan commented 6 years ago

No worries at all, @zhulik!

Happy to take a stab at fixing, @abeMedia, if the symptom sounds familiar! Much obliged.

benfrick commented 5 years ago

I am also having this issue. Anyone found a fix for it?

hoijui commented 5 years ago

see https://github.com/abeMedia/jekyll-pdf/issues/24

this also includes mcqueeney's fixes