Skip to content

Commit bed4837

Browse files
committed
Add PDFio fix for MS Word PDFs.
1 parent e722614 commit bed4837

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

tools/pdfio-object.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,9 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
420420
}
421421

422422
ptr += 3;
423+
while (*ptr && isspace(*ptr & 255))
424+
ptr ++;
425+
423426
_pdfioFileConsume(obj->pdf, (size_t)(ptr - line));
424427

425428
// Then grab the object value...
@@ -438,11 +441,14 @@ _pdfioObjLoad(pdfio_obj_t *obj) // I - Object
438441
return (false);
439442
}
440443

444+
if (tb.bufptr && tb.bufptr < tb.bufend && (*(tb.bufptr) == 0x0d || *(tb.bufptr) == 0x0a))
445+
tb.bufptr ++; // Skip trailing CR or LF after token
446+
441447
_pdfioTokenFlush(&tb);
442448

443449
if (!strcmp(line, "stream"))
444450
{
445-
// Yes, save its location...
451+
// Yes, this is an embedded stream so save its location...
446452
obj->stream_offset = _pdfioFileTell(obj->pdf);
447453
PDFIO_DEBUG("_pdfioObjLoad: stream_offset=%lu.\n", (unsigned long)obj->stream_offset);
448454
}

tools/pdfio.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// Public header file for PDFio.
33
//
4-
// Copyright © 2021-2022 by Michael R Sweet.
4+
// Copyright © 2021-2023 by Michael R Sweet.
55
//
66
// Licensed under Apache License v2.0. See the file "LICENSE" for more
77
// information.
@@ -34,7 +34,7 @@ extern "C" {
3434
// Version...
3535
//
3636

37-
# define PDFIO_VERSION "1.1.1"
37+
# define PDFIO_VERSION "1.1.2"
3838

3939

4040
//

0 commit comments

Comments
 (0)