I have a tool that generates pdf files. For some reason, Adobe gives me "An error exists on this page" so I simplified the pdf and it seems like the problem comes from the (x, y) l paths in a stream. But I can not find exactly what is the issue.
As you can see in the following images, simply by removing some path parts, the documents becomes valid. Of course I make the necessary changes of offsets when I make this changes in code. Note that the 3 paths that I will mention below are the ones between (x,y) m and (x,y) h at the beginning of the stream.
Take a look at the following examples:
Original stream - Not working
stream
q
1991.040 1277.520 m
1991.040 583.681 l
1052.640 583.681 l
1052.640 578.521 l
1052.040 578.521 l
1052.040 532.321 l
1127.880 532.321 l
1127.880 533.159 l
1187.880 533.159 l
1187.880 532.321 l
1206.720 532.321 l
1206.720 532.922 l
1211.880 532.922 l
1211.880 572.040 l
1615.800 572.040 l
1615.800 532.922 l
1621.080 532.922 l
1621.080 532.321 l
1639.800 532.321 l
1639.800 533.159 l
1699.800 533.159 l
1699.800 532.321 l
1778.160 532.321 l
1778.160 532.922 l
1783.440 532.922 l
1783.440 572.040 l
1981.440 572.040 l
1981.440 522.960 l
1989.840 522.960 l
1989.840 522.361 l
2002.680 522.361 l
2002.680 597.959 l
2051.760 597.959 l
2051.760 605.882 l
2002.680 605.882 l
2002.680 752.159 l
2054.280 803.760 l
2054.399 804.000 l
2016.000 842.400 l
2010.120 842.400 l
2010.120 841.802 l
2004.360 841.802 l
2004.360 851.161 l
2002.680 851.161 l
2002.680 1009.679 l
2004.360 1009.679 l
2004.360 1017.600 l
2002.680 1017.600 l
2002.680 1164.000 l
2054.399 1215.720 l
2004.960 1265.160 l
2004.840 1265.160 l
2004.840 1272.240 l
2004.360 1272.240 l
2004.360 1277.520 l
1991.040 1277.520 l
h
2019.720 1218.600 m
2019.360 1218.480 l
2019.000 1218.360 l
2018.880 1218.240 l
2018.640 1218.120 l
2018.520 1218.000 l
2018.280 1217.880 l
2018.040 1217.400 l
2017.920 1217.280 l
2017.560 1216.560 l
2017.440 1215.720 l
2017.560 1215.600 l
2017.560 1214.880 l
2017.680 1214.880 l
2017.680 1214.640 l
2017.800 1214.640 l
2017.800 1214.400 l
2017.920 1214.400 l
2017.920 1214.160 l
2018.040 1214.160 l
2018.040 1213.920 l
2018.160 1213.920 l
2018.160 1213.680 l
2018.280 1213.680 l
2018.280 1213.440 l
2018.520 1213.440 l
2018.640 1213.320 l
2018.880 1213.200 l
2019.000 1213.080 l
2019.720 1212.840 l
2021.280 1212.720 l
2021.280 1212.840 l
2022.000 1213.080 l
2022.240 1213.200 l
2022.720 1213.680 l
2022.840 1213.920 l
2022.960 1214.040 l
2023.080 1214.280 l
2023.320 1215.000 l
2023.440 1216.440 l
2023.320 1216.440 l
2023.320 1216.800 l
2023.200 1216.800 l
2023.200 1217.160 l
2023.080 1217.160 l
2023.080 1217.400 l
2022.240 1218.240 l
2022.000 1218.360 l
2021.280 1218.600 l
2019.720 1218.600 l
h
2017.200 809.282 m
2016.840 809.158 l
2016.480 809.042 l
2016.120 808.681 l
2015.880 808.561 l
2015.760 808.321 l
2015.400 807.959 l
2015.280 807.600 l
2015.160 807.360 l
2015.040 806.401 l
2015.160 806.280 l
2015.160 805.560 l
2015.280 805.560 l
2015.280 805.202 l
2015.400 805.202 l
2015.400 804.841 l
2015.520 804.841 l
2015.880 804.480 l
2015.880 804.240 l
2016.120 804.240 l
2016.480 803.880 l
2017.200 803.522 l
2018.760 803.402 l
2018.760 803.522 l
2019.120 803.642 l
2019.600 803.880 l
2020.440 804.720 l
2020.920 805.682 l
2021.040 807.122 l
2020.920 807.122 l
2020.920 807.360 l
2020.800 807.360 l
2020.800 807.600 l
2020.680 807.600 l
2020.680 807.840 l
2020.560 807.840 l
2020.560 808.080 l
2019.720 808.921 l
2019.480 809.042 l
2018.760 809.282 l
2017.200 809.282 l
h
0.235 0.000 0.000 0.235 0.000 0.000 cm
1.000 g
4465.690 2217.310 m
8720.500 2217.310 l
8720.500 5422.810 l
4465.690 5422.810 l
4465.690 2217.310 l
h
W
n
f
Q
q
0.000 0.000 m
3456.000 0.000 l
3456.000 0.359 l
0.000 0.359 l
0.000 0.000 l
h
W
n
0.235 0.000 0.000 0.235 0.000 0.000 cm
1 J
1 j
10.000 M
1.528 w
0.000 G
14669.500 0.000 m
0.000 0.000 l
S
Q
q
0.351 0.000 0.000 0.359 3370.650 600.986 cm
29 0.00 0.00 -1 0.000 1.000 cm
/Im1 Do
Q
q
1.000 0.000 0.000 -1.000 3176.000 2155.000 cm
275 0.00 0.00 -51 0.000 51.000 cm
/Im2 Do
Q
endstream
Simplified all 3 blocks of paths - Works
stream
q
1991.040 1277.520 m
1991.040 583.681 l
1991.040 1277.520 l
h
2019.720 1218.600 m
2019.360 1218.480 l
2019.720 1218.600 l
h
2017.200 809.282 m
2016.840 809.158 l
2017.200 809.282 l
h
0.235 0.000 0.000 0.235 0.000 0.000 cm
1.000 g
4465.690 2217.310 m
8720.500 2217.310 l
8720.500 5422.810 l
4465.690 5422.810 l
4465.690 2217.310 l
h
f
Q
q
0.000 0.000 m
3456.000 0.000 l
3456.000 0.359 l
0.000 0.359 l
0.000 0.000 l
h
W
n
0.235 0.000 0.000 0.235 0.000 0.000 cm
1 J
1 j
10.000 M
1.528 w
0.000 G
14669.500 0.000 m
0.000 0.000 l
S
Q
q
0.351 0.000 0.000 0.359 3370.650 600.986 cm
29 0.00 0.00 -1 0.000 1.000 cm
/Im1 Do
Q
q
1.000 0.000 0.000 -1.000 3176.000 2155.000 cm
275 0.00 0.00 -51 0.000 51.000 cm
/Im2 Do
Q
endstream
I will not post all the samples but they work as follow:
- Simplify all 3 paths (the way it shows above) - Works
- Simplify only 1 path the same way - Doesn't Work
- Simplify (first and second) / (second and third) / (first and third) the same way - Works
- Also it worked when I just removed some of the (x,y) l lines from all 3 blocks randomly.
Note: The last case makes me think that maybe there is a problem with the number of (x,y) lines. Like a max number of them allowed.
It you need the sample files: PDF Samples