Breaking changes:
PDFError.pageInvalidSize
andPDFError.pageInvalidDirection
are removed.
Implemented features:
- Setting text rendering mode
- Specifying a text matrix when showing text
- Setting character spacing and word spacing
- Measuring the number of characters that fit in a width
- All the enums now conform to
CaseIterable
0.3.0 (2018-12-24)
Please note that this version requires Swift 4.2.
Breaking changes:
(Those are a bit massive, sorry.)
PDFPage.draw(_:)
is removed. The closure for drawing can now be passed to thePDFDocument.addPage(_:)
family of methods. This is because multiple calls ofPDFPage.draw(_:)
resulted in redundant drawing operations (when resetting the context to the default state before each call). To migrate, merge your multiple calls ofPDFPage.draw(_:)
to one call ofPDFDocument.addPage(_:)
. Pay attention that because of this theDrawingContext.textLeading
property is initially set to 0 (not 11 like before), so you may want to change its value before doing any text operations. Also, if you need to access thePDFPage
's properties from the drawing closure, use theDrawingContext.page
property.PDFPage.draw(object:position:)
andPDFPage.draw(object:x:y:)
are removed. Use theDrawingContext.draw(_:position:)
andDrawingContext.draw(_:x:y:)
methods instead.DashStyle.pattern
andDashStyle.phase
are nowlet
, since changing those values wasn't in any way validated.Vector
is now a separate type, not a typealias forPoint
. Its intefrace has slightly changed: the fields have been renamed fromx
andy
todx
anddy
. This new type includes some arithmetic operators that make its use simpler.- The required method
draw(in:position:)
of theDrawable
protocol is markedthrows
. PDFDocument.setEncryptionMode(to:)
andPDFDocument.setPermissions(to:)
are removed. Use thePDFDocument.setPassword(owner:user:permissions:encryptionMode:)
method instead.DrawingContext.withNewGState(_:)
doesn't throw if its argument doesn't. Same forDrawingContext.clip(to:rule:_:)
. If the graphics state stack depth exceedsstatic DrawingContext.maxGraphicsStateDepth
, a precondition failure occures.static PDFError.exceedGStateLimit
is removed.
Implemented features:
AffineTransform
struct that helps you easily apply transforms like rotation, scaling and translation to a document's coordinate system.- Concatenating the transformation matrix of a page + convenience methods for translation, scaling and rotation.
- Getting the current transformation matrix of a page.
- Added conformance to
Hashable
for many types. - Improved debug descriptions for
Color
and the geometric types.
0.2.0 (2017-06-25)
Please note that this version requires Swift 3.1.
Breaking changes:
- Changed the signature of the
DrawingContext.fill(_:evenOddRule:stroke:)
andDrawingContext.clip(to:evenOddRule:_:)
methods. Instead ofBool
value for fill rule they now require thePath.FillRule
enum value.
Closed issues:
Implemented features:
- Loading TrueType fonts from a .ttc collection
- Getting a bounding box of a specified text put at a specified position
- Getting the ascent of a font
- Getting the descent of a font
- Getting the x-height of a font
- Getting the cap height of a font
- Setting metadata (author, creator, title, subject, keywords, creation date, modification date)
- Setting a password, encryption mode and permissions
- Setting a compression mode
- Getting the depth of the graphics state stack
- Closure-based syntax for saving and restoring the graphics state
- Showing a text in a provided rectangle
- High-level customizable interface for drawing grids!
Fixes:
- Setting
miterLimit
,font
andfontSize
ofDrawingContext
,width
andheight
ofPDFPage
to an invalid value now causes precondition failure.
0.1.0 (2016-11-02)
Closed issues:
- Add CocoaPods support #4
Implemented features:
- Creating PDF documents
- Saving a document's contents into binary
Data
- Appending and inserting pages to documents
- Setting a page's layout
- Adding labels to pages
- Loading TrueType fonts from file
- Setting a page's size
- Rotating a page
- Measuring a width of a specified text
- Path construction
- Path painting
- Setting a font
- Setting a font size
- Setting a line width
- Setting a line cap
- Setting a line join
- Setting a miter limit
- Setting a dash style
- Setting a text leading
- Setting a stroke and fill color and color space
- Placing a text on a page