Comments (3)
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.
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.
You're looking for http://github.com/pdfkit/pdfkit. This project is for Node.js. :)
from pdfkit.
Related Issues (20)
- PDFKit does not create a new page on iOS Safari HOT 8
- Links on SVGs
- Is it normal for strings to be rendered slightly differently three times than once?
- Generate PDF using HTML? HOT 1
- rollup: output.interop no longer allows value `false`
- Y position of document not updated after adding image HOT 4
- Incorrect ordering of text when RTL (arabic) text mixed with LTR (english) HOT 1
- Prevent Text Overflow
- Support for other javascript runtimes (deno, cloudflare worker, bun)
- Please use lru to cache font layout to fix memory leak HOT 1
- `pageAdded` event not called for first page with `autoFirstPage: true`
- Pattern fills HOT 1
- pdfkit generates PDFs with technical errors and incorrect PDF version
- My Css code not work properly when i convert html to pdf by pdfkit HOT 1
- File Annotations without Icons
- Argument of type 'WriteStream' is not assignable to parameter of type 'WritableStream'.
- My Portfolio using HTML and CSS
- My Portfolio using HTML and CSS
- Enabling encryption prevents destination links from working. HOT 1
- Error creating PDF: window.PDFDocument is not a constructor in packaged app HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfkit.