@@ -307,7 +307,14 @@ public function testGetDataTm(): void
307
307
'201.96 ' ,
308
308
'720.68 ' ,
309
309
],
310
- $ item [0 ]
310
+ [
311
+ round ($ item [0 ][0 ], 6 ),
312
+ round ($ item [0 ][1 ], 6 ),
313
+ round ($ item [0 ][2 ], 6 ),
314
+ round ($ item [0 ][3 ], 6 ),
315
+ round ($ item [0 ][4 ], 2 ),
316
+ round ($ item [0 ][5 ], 2 )
317
+ ]
311
318
);
312
319
$ this ->assertStringContainsString ('Document title ' , $ item [1 ]);
313
320
@@ -321,7 +328,14 @@ public function testGetDataTm(): void
321
328
'70.8 ' ,
322
329
'673.64 ' ,
323
330
],
324
- $ item [0 ]
331
+ [
332
+ round ($ item [0 ][0 ], 6 ),
333
+ round ($ item [0 ][1 ], 6 ),
334
+ round ($ item [0 ][2 ], 6 ),
335
+ round ($ item [0 ][3 ], 6 ),
336
+ round ($ item [0 ][4 ], 2 ),
337
+ round ($ item [0 ][5 ], 2 )
338
+ ]
325
339
);
326
340
$ this ->assertStringContainsString ('Calibri : Lorem ipsum dolor sit amet, consectetur a ' , $ item [1 ]);
327
341
@@ -332,10 +346,17 @@ public function testGetDataTm(): void
332
346
'0 ' ,
333
347
'0 ' ,
334
348
'1 ' ,
335
- '342.840222606 ' ,
349
+ '342.84 ' ,
336
350
'81.44 ' ,
337
351
],
338
- $ item [0 ]
352
+ [
353
+ round ($ item [0 ][0 ], 6 ),
354
+ round ($ item [0 ][1 ], 6 ),
355
+ round ($ item [0 ][2 ], 6 ),
356
+ round ($ item [0 ][3 ], 6 ),
357
+ round ($ item [0 ][4 ], 2 ),
358
+ round ($ item [0 ][5 ], 2 )
359
+ ]
339
360
);
340
361
$ this ->assertStringContainsString ('nenatis. ' , $ item [1 ]);
341
362
@@ -626,7 +647,7 @@ public function testGetTextXY(): void
626
647
$ document = $ parser ->parseFile ($ filename );
627
648
$ pages = $ document ->getPages ();
628
649
$ page = $ pages [0 ];
629
- $ result = $ page ->getTextXY (201.96 , 720.68 );
650
+ $ result = $ page ->getTextXY (201.96 , 720.68 , 0.01 , 0.01 );
630
651
$ this ->assertCount (1 , $ result );
631
652
$ this ->assertCount (2 , $ result [0 ]);
632
653
$ this ->assertEquals (
@@ -638,7 +659,14 @@ public function testGetTextXY(): void
638
659
'201.96 ' ,
639
660
'720.68 ' ,
640
661
],
641
- $ result [0 ][0 ]
662
+ [
663
+ round ($ result [0 ][0 ][0 ], 6 ),
664
+ round ($ result [0 ][0 ][1 ], 6 ),
665
+ round ($ result [0 ][0 ][2 ], 6 ),
666
+ round ($ result [0 ][0 ][3 ], 6 ),
667
+ round ($ result [0 ][0 ][4 ], 2 ),
668
+ round ($ result [0 ][0 ][5 ], 2 ),
669
+ ]
642
670
);
643
671
$ this ->assertStringContainsString ('Document title ' , $ result [0 ][1 ]);
644
672
@@ -657,7 +685,14 @@ public function testGetTextXY(): void
657
685
'201.96 ' ,
658
686
'720.68 ' ,
659
687
],
660
- $ result [0 ][0 ]
688
+ [
689
+ round ($ result [0 ][0 ][0 ], 6 ),
690
+ round ($ result [0 ][0 ][1 ], 6 ),
691
+ round ($ result [0 ][0 ][2 ], 6 ),
692
+ round ($ result [0 ][0 ][3 ], 6 ),
693
+ round ($ result [0 ][0 ][4 ], 2 ),
694
+ round ($ result [0 ][0 ][5 ], 2 ),
695
+ ]
661
696
);
662
697
$ this ->assertStringContainsString ('Document title ' , $ result [0 ][1 ]);
663
698
@@ -827,10 +862,10 @@ public function testIssue454(): void
827
862
$ this ->assertEquals (2 , \count ($ dataTm [0 ]));
828
863
$ this ->assertIsArray ($ dataTm [0 ][0 ]);
829
864
$ this ->assertEquals (6 , \count ($ dataTm [0 ][0 ]));
830
- $ this ->assertEquals (201.96 , $ dataTm [0 ][0 ][4 ]);
831
- $ this ->assertEquals (720.68 , $ dataTm [0 ][0 ][5 ]);
865
+ $ this ->assertEquals (201.96 , round ( $ dataTm [0 ][0 ][4 ], 2 ) );
866
+ $ this ->assertEquals (720.68 , round ( $ dataTm [0 ][0 ][5 ], 2 ) );
832
867
$ this ->assertStringContainsString ('Document title ' , $ dataTm [0 ][1 ]);
833
- $ textData = $ page ->getTextXY (201.96 , 720.68 );
868
+ $ textData = $ page ->getTextXY (201.96 , 720.68 , 0.01 , 0.01 );
834
869
$ this ->assertStringContainsString ('Document title ' , $ textData [0 ][1 ]);
835
870
$ page = $ pages [2 ];
836
871
$ dataTm = $ page ->getDataTm ();
@@ -889,4 +924,38 @@ public function testIssue629WithoutDataTmFontInfo(): void
889
924
$ this ->assertCount (2 , $ dataTm [0 ]);
890
925
$ this ->assertFalse (isset ($ dataTm [0 ][2 ]));
891
926
}
927
+
928
+ public function testCmCommandInPdfs () : void
929
+ {
930
+ $ config = new Config ();
931
+ $ parser = $ this ->getParserInstance ($ config );
932
+ $ filename = $ this ->rootDir .'/samples/Document-Word-Landscape-printedaspdf.pdf ' ;
933
+ $ document = $ parser ->parseFile ($ filename );
934
+ $ pages = $ document ->getPages ();
935
+ $ page = $ pages [0 ];
936
+ $ dataTm = $ page ->getDataTm ();
937
+ $ item = $ dataTm [2 ];
938
+ $ this ->assertCount (6 , $ dataTm );
939
+ $ this ->assertCount (2 , $ item );
940
+ $ this ->assertCount (6 , $ item [0 ]);
941
+ $ this ->assertEquals ('This is just a test ' , trim ($ item [1 ]));
942
+ $ this ->assertEquals (
943
+ [
944
+ '0.75 ' ,
945
+ '0.0 ' ,
946
+ '0.0 ' ,
947
+ '0.75 ' ,
948
+ '59.16 ' ,
949
+ '500.4 '
950
+ ],
951
+ [
952
+ round ($ item [0 ][0 ], 6 ),
953
+ round ($ item [0 ][1 ], 6 ),
954
+ round ($ item [0 ][2 ], 6 ),
955
+ round ($ item [0 ][3 ], 6 ),
956
+ round ($ item [0 ][4 ], 2 ),
957
+ round ($ item [0 ][5 ], 2 )
958
+ ]
959
+ );
960
+ }
892
961
}
0 commit comments