File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -495,6 +495,17 @@ var PDFDocument = (function PDFDocumentClosure() {
495
495
if (find (stream , '%PDF-' , 1024 )) {
496
496
// Found the header, trim off any garbage before it.
497
497
stream .moveStart ();
498
+ // Reading file format version
499
+ var MAX_VERSION_LENGTH = 12 ;
500
+ var version = '', ch;
501
+ while ((ch = stream .getChar ()) > ' ' ) {
502
+ if (version .length >= MAX_VERSION_LENGTH ) {
503
+ break ;
504
+ }
505
+ version += ch ;
506
+ }
507
+ // removing "%PDF-"-prefix
508
+ this .pdfFormatVersion = version .substring (5 );
498
509
return ;
499
510
}
500
511
// May not be a PDF file, continue anyway.
@@ -519,7 +530,9 @@ var PDFDocument = (function PDFDocumentClosure() {
519
530
if (this .xref .trailer .has ('Info' )) {
520
531
var infoDict = this .xref .trailer .get ('Info' );
521
532
522
- docInfo = {};
533
+ docInfo = {
534
+ PDFFormatVersion : this .pdfFormatVersion
535
+ };
523
536
var validEntries = DocumentInfoValidators .entries ;
524
537
// Only fill the document info with valid entries from the spec.
525
538
for (var key in validEntries ) {
Original file line number Diff line number Diff line change @@ -1288,6 +1288,11 @@ var PDFView = {
1288
1288
self .documentInfo = info ;
1289
1289
self .metadata = metadata ;
1290
1290
1291
+ // Provides some basic debug information
1292
+ console .log ('PDF ' + pdfDocument .fingerprint + ' [' +
1293
+ info .PDFFormatVersion + ' ' + (info .Producer || '-' ) +
1294
+ ' / ' + (info .Creator || '-' ) + ']' );
1295
+
1291
1296
var pdfTitle ;
1292
1297
if (metadata ) {
1293
1298
if (metadata .has ('dc:title' ))
You can’t perform that action at this time.
0 commit comments