diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2022-08-26 14:30:56 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2022-08-26 14:32:06 +0100 |
commit | 1f56d7736465c45a2785d6bb3db1c37289599b40 (patch) | |
tree | 6577aae647e73dae62bf812577eef04d890339cc /psi | |
parent | aa6b1865f902a05d88590a8e4bdf5896ef6938f9 (diff) | |
download | ghostpdl-1f56d7736465c45a2785d6bb3db1c37289599b40.tar.gz |
GhostPDF + GS - improve error handling
Arising from Bug #705784, if we hadn't built the PDF interpreter we
would get typecheck errors which were somewhat misleading as to the
source of the problem.
This commit tidies up the error handling in the area of .PDFInit so
that we not only detect the problem there but give a warning that it
occurred.
In addition, add a means to detect if the PDF interpreter is built in
before we stat trying to process a PDF file and, if it is not, give
a sensible error message.
Tested with BUILD_PDF 0 and with NEWPDF true and false.
Diffstat (limited to 'psi')
-rw-r--r-- | psi/zpdfops.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/psi/zpdfops.c b/psi/zpdfops.c index c20921d3f..e55267729 100644 --- a/psi/zpdfops.c +++ b/psi/zpdfops.c @@ -1601,6 +1601,11 @@ static int zPDFpageinfo(i_ctx_t *i_ctx_p) return_error(gs_error_undefined); } +static int zPDFpageinfoExt(i_ctx_t *i_ctx_p) +{ + return_error(gs_error_undefined); +} + static int zPDFmetadata(i_ctx_t *i_ctx_p) { return_error(gs_error_undefined); @@ -1627,6 +1632,19 @@ static int zPDFparsePageList(i_ctx_t *i_ctx_p) } #endif +static int zPDFAvailable(i_ctx_t *i_ctx_p) +{ + os_ptr op = osp; + + push(1); +#if defined(BUILD_PDF) && BUILD_PDF == 1 + make_bool(op, true); +#else + make_bool(op, false); +#endif + return 0; +} + /* ------ Initialization procedure ------ */ const op_def zpdfops_op_defs[] = @@ -1645,6 +1663,7 @@ const op_def zpdfops_op_defs[] = {"1.PDFDrawAnnots", zPDFdrawannots}, {"1.PDFInit", zPDFInit}, {"1.PDFparsePageList", zPDFparsePageList}, + {"0.PDFAvailable", zPDFAvailable}, #ifdef HAVE_LIBIDN {"1.saslprep", zsaslprep}, #endif |