File tree 5 files changed +21
-0
lines changed
5 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
6
6
7
7
## [ Unreleased]
8
+ ### Fixed
9
+ - Pages from external documents should always be added with their original size #111
8
10
9
11
## [ 2.1.0] - 2018-09-22
10
12
### Changed
Original file line number Diff line number Diff line change @@ -12,13 +12,20 @@ module.exports = class ExternalDocument {
12
12
const pages = catalog . get ( 'Pages' ) . object . properties
13
13
14
14
this . pages = pages
15
+ const mediaBox = pages . get ( 'MediaBox' )
15
16
const kids = pages . get ( 'Kids' )
16
17
this . pageCount = kids . length
17
18
18
19
this . objects = [ ]
19
20
for ( const kid of kids ) {
20
21
const page = kid . object
21
22
23
+ // if the page object does not define its MediaBox, explicitly set its MediaBox to the
24
+ // value defined by its parent Pages object
25
+ if ( ! page . properties . has ( 'MediaBox' ) && mediaBox ) {
26
+ page . properties . set ( 'MediaBox' , mediaBox )
27
+ }
28
+
22
29
const objects = [ ]
23
30
Parser . addObjectsRecursive ( objects , page )
24
31
Original file line number Diff line number Diff line change
1
+ module . exports = function ( doc , { document} ) {
2
+ doc . text ( 'First' )
3
+
4
+ const pdf = require ( '../../../' )
5
+ const path = require ( 'path' )
6
+ const fs = require ( 'fs' )
7
+
8
+ const external = new pdf . ExternalDocument ( fs . readFileSync ( path . join ( __dirname , '/fixtures/200x200.pdf' ) ) )
9
+ doc . addPagesOf ( external )
10
+
11
+ doc . text ( 'Second' )
12
+ }
You can’t perform that action at this time.
0 commit comments