Devon Govett
22499ee4bd
Include a static list of standard fonts so they can be included by browserify/brfs
2014-04-12 20:48:29 -07:00
Devon Govett
78946e97fc
Rework mixin so it can be statically compiled by browserify
2014-04-12 20:47:54 -07:00
Devon Govett
98489d64a8
Store the font name
2014-04-12 20:45:42 -07:00
Devon Govett
4b8b031188
Don't embed fonts until they are actually used
2014-04-12 20:45:15 -07:00
Devon Govett
bb9b77cb82
Allow loading fonts from Buffers in addition to filenames
2014-04-12 20:44:19 -07:00
Devon Govett
801981728c
Make AFMFont.open different from constructor
2014-04-12 20:35:14 -07:00
Devon Govett
8c51ee077f
Make sure that sfnt key exists in dfont so we don't throw random errors
2014-04-09 23:44:31 -07:00
Devon Govett
f463512b2f
Don't embed fonts more than once
2014-04-09 23:41:40 -07:00
Devon Govett
87fd69b7e5
Don't overwrite cmap method
2014-04-09 23:41:06 -07:00
Devon Govett
ae28782eb1
Fix writing indexed PNG palettes
2014-04-09 09:51:59 -07:00
Devon Govett
876db9e067
Don't set the Length key on images. It will be set by the PDFReference class automatically
2014-04-09 09:51:43 -07:00
Devon Govett
665fd935ef
Make loading images from buffers way faster by not converting to a string inadvertently
2014-04-06 19:19:17 -07:00
Devon Govett
8eece7e9ea
Make sure heightOfString doesn't break pages
2014-03-29 20:36:10 -07:00
Devon Govett
c72b50927c
Add heightOfString method that uses the line wrapper without actually adding content to the document.
...
Very useful for layout purposes
2014-03-29 20:22:21 -07:00
Devon Govett
cf564ac3da
Fixes for text justification
2014-03-29 19:56:36 -07:00
Devon Govett
16e00aa9e2
Allow setting compress option from constructor
2014-03-29 19:45:41 -07:00
Devon Govett
0907968905
Don't store all objects in memory, just offsets once they are written
2014-03-23 18:16:42 -07:00
Devon Govett
f6c4b2c226
Free memory after embedding images
2014-03-23 17:37:13 -07:00
Devon Govett
b570ac219e
Simplify image loading
2014-03-23 17:31:07 -07:00
Devon Govett
f8a40dba76
Make PDFDocument a node stream
2014-03-23 17:11:48 -07:00
Devon Govett
1305a9592a
Switch to 2 space indentation
2014-03-23 12:25:09 -07:00
Devon Govett
fda5b400e6
Another path parser fix
2014-02-25 00:42:25 -08:00
Devon Govett
06e6419533
Handle reused commands in path parser for last command
2014-02-25 00:08:41 -08:00
Devon Govett
67e6640b92
Fix bug in path parser
2014-02-24 23:44:50 -08:00
Devon Govett
350863bfda
Fix the ellipse method
2014-02-24 23:25:41 -08:00
Devon Govett
c1319acff8
Allow 0 opacities
2014-02-24 01:09:27 -08:00
Devon Govett
4257e69e07
Fix typo
2014-02-19 12:02:57 -08:00
Devon Govett
8139b4fa30
Add missing word count
2014-02-19 12:02:53 -08:00
Darius Kazemi
d7336a4bd0
"Dangling" single word lines now get emitted
...
This commit adds an extra emit to a required line break if there's a "dangling" word on the end.
2014-02-19 14:54:47 -05:00
Darius Kazemi
6637dca8eb
Correcting for edge case in line wrapping
...
If you look at the flow of the `eachWord` function, you'll notice that we add the word to the buffer if the width of the word `w` is less than the space available.
There's an edge case where `linebreaker` says that a line break is required on a word (because of a manual break: `theword\n`) and the width of the word being considered is greater than `spaceLeft`. In the current pdfkit, if this is the case:
* we do not append the word to the buffer
* we emit the line
* we break and move on to the next line, starting with a clean line
This omits the word entirely.
This commit makes it so that we only break the line and start with a clean line if we already had the space to write the line to the buffer. Otherwise, we append the word to the buffer and go to a new line.
2014-02-19 13:38:50 -05:00
Devon Govett
a0901c75a0
Make sure we use global.setImmediate
2014-02-17 23:20:32 -08:00
Devon Govett
cb81273b49
Trim spaces from the ends of lines when right aligning
2014-02-17 22:02:55 -08:00
Devon Govett
18512661b5
Apply current transformation to annotations
2014-02-17 22:01:49 -08:00
Devon Govett
415d5a371a
Reset continuedX if there is more than one line
2014-02-17 13:53:39 -08:00
Devon Govett
7fdc3b8d14
Fix for multiple continuations on the same line
2014-02-17 13:35:49 -08:00
Devon Govett
3f15f761e2
Calculate lineWidth of underline/strike based on font size
2014-02-17 02:34:27 -08:00
Devon Govett
7df3ccdf4d
Add link, underline, and strike options to text method. #183
...
Should make it way easier to do these common things.
2014-02-17 02:21:29 -08:00
Devon Govett
6a323bf0a2
Make sure justified wordSpacing value is always > 0
2014-02-17 02:19:11 -08:00
Devon Govett
9357ff5a4a
Extend text options for continued segments
2014-02-17 02:18:40 -08:00
Devon Govett
00c6dabf3c
Stop wrapping text after filling specified height, and add ellipsis option. Fixes #149 .
...
No longer makes new pages after user specified heights, but still does so if no height is given (page edge by default). This works with multiple columns too. It will fill the columns in the horizontal and vertical space provided and then stop, rather than going to a new page.
Also adds the `ellipsis` option which can be used to append an ellipsis character like `…` to the end of the cut off text. If you set `ellipsis: true`, it will use the default ellipsis character, but you can also set the option to any string you want to use.
2014-02-16 20:08:19 -08:00
Devon Govett
25c0348755
Fix character width calculations ( #185 , #169 )
...
Follows TTF hmtx rules for missing entries, and encodes WinAnsi first for builtin fonts.
2014-02-16 19:46:35 -08:00
Devon Govett
5b1f030329
Move WinAnsi encoding to AFMFont class
2014-02-16 19:43:25 -08:00
Devon Govett
087f3f4aca
Reset the X position to the starting X after line wrapping is done (unless continued)
2014-02-16 18:33:39 -08:00
Devon Govett
da593f077f
Force break words that are longer than the entire line into pieces. Fixes #159 .
2014-02-16 15:55:41 -08:00
Devon Govett
630bfd74a6
Make sure we don't divide by zero when calculating justification word spacing
2014-02-16 15:54:42 -08:00
Devon Govett
5a74677c66
Store continuedX on the line wrapper instead of the document, since the line wrapper is now reused
2014-02-16 14:48:40 -08:00
Devon Govett
7fafa309b8
Use the same line wrapper instance when text is continued, fixes multicolumns
2014-02-16 14:41:26 -08:00
Devon Govett
50b6bab177
Make sure we don't pass the maximum Y position
2014-02-16 13:17:45 -08:00
Devon Govett
b0de8975f9
Fix justification of embedded TTF fonts. Closes #52 .
...
Encodes each word separately instead of relying on Tw operator, which only supports character code 32, which isn't used by embedded fonts.
Still to do: proper unicode word breaking with support for non-space separated languages.
2014-02-16 13:10:18 -08:00
Devon Govett
670bb09bf7
Reset X position to start on new page (fix for columns)
2014-02-16 13:07:24 -08:00