Source of Nothingness - 2007-10-09 : pdftool

* 2007-10-09 : pdftool

http://homepage3.nifty.com/e-papy/pdftool/index.html
まだ要素のみ。
(defvar *pdftool-dll-path* nil)
(unless *pdftool-dll-path*
  (setq *pdftool-dll-path* (merge-pathnames "pdftool.dll" (si:system-root))))

(c:define-dll-entry c:int *get-pdf-text ((c:char *) (c:char *))
  *pdftool-dll-path* "GetPDFText")

(c:define-dll-entry c:int *write-pdf-txt ((c:char *) (c:char *))
  *pdftool-dll-path* "WritePDFText")

(defun get-pdf-text(pdf txt)
  (if (path-equal pdf txt)
      (error "入出力のファイルが一致")
    (case (*get-pdf-text (si:make-string-chunk pdf)
                         (si:make-string-chunk txt))
      (-1 (error "失敗"))
      (-2 (error "PDFファイルが暗号化されてる"))
      (t t))))

(defun write-pdf-txt(txt pdf)
  (if (path-equal txt pdf)
      (error "入出力のファイルが一致")
    (case (*write-pdf-txt (si:make-string-chunk txt)
                          (si:make-string-chunk pdf))
      (-1 (error "失敗"))
      (t t))))

update : 2007-10-09 (Tue) 12:58:05