cleanPDFtest.cpp 538 B

12345678910111213141516171819202122232425
  1. #include "hpdf.h"
  2. #include <cstdio>
  3. #include <setjmp.h>
  4. jmp_buf env;
  5. void __stdcall error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void *user_data)
  6. {
  7. printf ("ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no,
  8. (HPDF_UINT)detail_no);
  9. longjmp(env, 1);
  10. }
  11. int main (){
  12. HPDF_Doc pdf = HPDF_New (error_handler, NULL);
  13. if (!pdf) {
  14. printf ("ERROR: cannot create pdf object.\n");
  15. return 1;
  16. }
  17. if (setjmp(env)) {
  18. HPDF_Free (pdf);
  19. return 1;
  20. }
  21. }