Comments (9)
That is possible. Do you have an example?
from pdfkit.
var pdfkit = require('pdfkit');
var pdfdoc = new pdfkit;
pdfdoc.transform(1,0,0,1,100,200);
pdfdoc.text('hi');
pdfdoc.write('tester.pdf');
This is supposed to translate the origin to (100, 200), but in this case we wouldn't see the text anymore!
from pdfkit.
Did you try the translate
method instead of including the whole matrix?
from pdfkit.
No, but I need to use the transform, since I have matrix.
I'm thinking about getting the new coordinates by solving the matrix myself, then using translate.
I just realized that if we put pdfdoc.transform(1,0,0,1,-100,-200) works the same as transform="matrix(1 0 0 1 100 200)" in svg files.
from pdfkit.
Ah. That's because internally, PDF documents use a flipped coordinate system where (0,0) is equal to the bottom left corner of the page rather than the top left one. The transform method does not abstract this away like the other methods (e.g. translate) do so that must have been your problem. Thinking of abstracting that away so they all use the same coordinate system. Should I?
from pdfkit.
But for transformations like this pdfdoc.transform(2.3282, 0, 0, 1, 11.8491, 33.2144), if we just put a minus for the last two numbers( pdfdoc.transform(2.3282, 0, 0, 1, -11.8491, -33.2144) ) wouldnt work the same way.
from pdfkit.
Well that would be awesome, if that's the problem. But how come when we do pdfdoc.text('hi', 100, 200), it uses the top left?
from pdfkit.
yeah it's not just the last two numbers that would be affected by this. I'll work on abstracting the differences between the coordinate systems. Thanks for reporting!
from pdfkit.
Any updates on this issue?
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.