summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--devices/vector/gdevpdfv.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/devices/vector/gdevpdfv.c b/devices/vector/gdevpdfv.c
index 5abdf7bc5..8a274b262 100644
--- a/devices/vector/gdevpdfv.c
+++ b/devices/vector/gdevpdfv.c
@@ -953,6 +953,7 @@ pdf_put_pattern2(gx_device_pdf *pdev, const gs_gstate * pgs, const gx_drawing_co
953 int code = pdf_cs_Pattern_colored(pdev, &v); 953 int code = pdf_cs_Pattern_colored(pdev, &v);
954 int code1 = 0; 954 int code1 = 0;
955 gs_matrix smat; 955 gs_matrix smat;
956 gs_point dist;
956 957
957 if (code < 0) 958 if (code < 0)
958 return code; 959 return code;
@@ -1010,6 +1011,21 @@ pdf_put_pattern2(gx_device_pdf *pdev, const gs_gstate * pgs, const gx_drawing_co
1010 smat.xx *= xscale, smat.yx *= xscale, smat.tx *= xscale; 1011 smat.xx *= xscale, smat.yx *= xscale, smat.tx *= xscale;
1011 smat.xy *= yscale, smat.yy *= yscale, smat.ty *= yscale; 1012 smat.xy *= yscale, smat.yy *= yscale, smat.ty *= yscale;
1012 } 1013 }
1014
1015 /* Bug #697451, if we emit a PDF with a type 2 Pattern where the
1016 * Matrix is degenerate, Acrobat throws an error and aborts the
1017 * page content stream. Distiller refuses to embed the shfill,
1018 * it silently (!) ignores the problem. So here we test to see
1019 * if the CTM is degenerate, if it is, replace it with the
1020 * smallest Matrix we can.
1021 */
1022 code = gs_distance_transform_inverse(1, 1, &smat, &dist);
1023 if (code == gs_error_undefinedresult) {
1024 smat.xx = smat.yy = 0.00000001;
1025 smat.xy = smat.yx = smat.tx = smat.ty = 0;
1026 code = 0;
1027 }
1028
1013 if (code < 0 || 1029 if (code < 0 ||
1014 (code = cos_dict_put_c_key_int(pcd, "/PatternType", 2)) < 0 || 1030 (code = cos_dict_put_c_key_int(pcd, "/PatternType", 2)) < 0 ||
1015 (code = cos_dict_put_c_key_object(pcd, "/Shading", psco)) < 0 || 1031 (code = cos_dict_put_c_key_object(pcd, "/Shading", psco)) < 0 ||