Giter VIP home page Giter VIP logo

Comments (3)

devongovett avatar devongovett commented on August 21, 2024

Hey, thanks for trying out PDFKit, I'm glad you like it so far! Luckily, it's pretty easy to change the page orientation and size. There are two ways of doing it: individually per page, or by setting the default for all the pages in your document. They are both options passed to the addPage method for individual pages, and directly to the PDFDocument constructor for the defaults. Here is an example:

doc.addPage
  size: 'legal'
  layout: 'landscape'

The layout property can be either portrait (the default) or landscape. The size property can be either an array specifying [width, height] in PDF points (72 per inch), or a string specifying a predefined size. All of the standard paper sizes (and more) are predefined, so generally you can just use the standard name of the paper size you want and it will just work.

I recommend checking out the PDFKit programming guide for more information. Thanks again!

Devon

from pdfkit.

praxismistic avatar praxismistic commented on August 21, 2024

but, in rails, how to do?

:(

my codigo:

@groups=Group.find(:all,:conditions=>["load_approved_id=?",params[:id]])
@preloads=Preload.find(:all,:conditions=>["load_approved_id=?",params[:id]])

html1 = ""
html2 = ""
@groups.each do |n|

  html1 << "<html><head><meta name='pdfkit-orientation' content='Landscape'"+n.horariohtml + "<div style='page-break-before:always'></div>"
end
@preloads.each do |n|
  html2 << "<html><head><meta name='pdfkit-orientation' content='Portrait'"+n.horarioteacher + "<div style='page-break-before:always'></div>"
end
html3=html1+html2
pdf = PDFKit.new(html3)
pdf.to_file("#{Rails.root}/public/example.pdf")

in result, all pages are orientation Portrait :'(

from pdfkit.

devongovett avatar devongovett commented on August 21, 2024

You're looking for http://github.com/pdfkit/pdfkit. This project is for Node.js. :)

from pdfkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.