deri pushed a commit to branch master
in repository groff.

commit d31fbc2b9fb67394af81c59c8379f9230d9c2ceb
Author: Deri James <[email protected]>
AuthorDate: Wed Sep 23 11:52:33 2026 +0100

    Inkscape exported pdfs fail to load.
    
    PDF files may introduce commments into objects with '%' which
    should be stripped on loading. Since PDF 1.5 objects may be
    compressed into a stream.
    
    * src/devices/gropdf/gropdf.pl (LoadPDF): Remove comments from
    objects contained in compressed stream pf ObjStm objects.
    
    Fixes <https://savannah.gnu.org/bugs/?68705>
---
 ChangeLog                    | 13 +++++++++++++
 src/devices/gropdf/gropdf.pl |  4 ++++
 2 files changed, 17 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ea553c8ba..d638fd396 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2026-09-23 Deri James  <[email protected]>
+
+       Inkscape exported pdfs fail to load.
+
+       PDF files may introduce commments into objects with '%' which
+       should be stripped on loading. Since PDF 1.5 objects may be
+       compressed into a stream.
+
+       * src/devices/gropdf/gropdf.pl (LoadPDF): Remove comments from
+       objects contained in compressed stream pf ObjStm objects.
+
+       Fixes <https://savannah.gnu.org/bugs/?68705>
+
 2026-09-17  G. Branden Robinson <[email protected]>
 
        * tmac/an.tmac (TS): Unconditionally break the line.
diff --git a/src/devices/gropdf/gropdf.pl b/src/devices/gropdf/gropdf.pl
index 418c4fdc0..810e85ac0 100644
--- a/src/devices/gropdf/gropdf.pl
+++ b/src/devices/gropdf/gropdf.pl
@@ -2594,6 +2594,10 @@ sub LoadPDF
         LoadStream($pdf->[$ObjStm],$pdf);
         my $pos=$pdf->[$ObjStm]->{OBJ}->{First};
         my $s=$pdf->[$ObjStm]->{STREAM};
+        while ($s=~m/(\s+%\s*\w*)\n/gp)
+        {
+           $s=${^PREMATCH}.(" " x length($1))."\n".${^POSTMATCH}
+        }
         my @o=split(' ',substr($s,0,$pos));
         substr($s,0,$pos)='';
         push(@o,-1,length($s));

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to