@@ -78,7 +78,9 @@ describe("api", function () {
78
78
}
79
79
80
80
function mergeText ( items ) {
81
- return items . map ( chunk => chunk . str + ( chunk . hasEOL ? "\n" : "" ) ) . join ( "" ) ;
81
+ return items
82
+ . map ( chunk => ( chunk . str ?? "" ) + ( chunk . hasEOL ? "\n" : "" ) )
83
+ . join ( "" ) ;
82
84
}
83
85
84
86
describe ( "getDocument" , function ( ) {
@@ -2275,6 +2277,28 @@ Caron Broadcasting, Inc., an Ohio corporation (“Lessee”).`)
2275
2277
await loadingTask . destroy ( ) ;
2276
2278
} ) ;
2277
2279
2280
+ it ( "gets text content with or without includeMarkedContent, and compare (issue 15094)" , async function ( ) {
2281
+ if ( isNodeJS ) {
2282
+ pending ( "Linked test-cases are not supported in Node.js." ) ;
2283
+ }
2284
+
2285
+ const loadingTask = getDocument ( buildGetDocumentParams ( "pdf.pdf" ) ) ;
2286
+ const pdfDoc = await loadingTask . promise ;
2287
+ const pdfPage = await pdfDoc . getPage ( 568 ) ;
2288
+ let { items } = await pdfPage . getTextContent ( {
2289
+ includeMarkedContent : false ,
2290
+ } ) ;
2291
+ const textWithoutMC = mergeText ( items ) ;
2292
+ ( { items } = await pdfPage . getTextContent ( {
2293
+ includeMarkedContent : true ,
2294
+ } ) ) ;
2295
+ const textWithMC = mergeText ( items ) ;
2296
+
2297
+ expect ( textWithoutMC ) . toEqual ( textWithMC ) ;
2298
+
2299
+ await loadingTask . destroy ( ) ;
2300
+ } ) ;
2301
+
2278
2302
it ( "gets empty structure tree" , async function ( ) {
2279
2303
const tree = await page . getStructTree ( ) ;
2280
2304
0 commit comments