* emacs 30.5.0 editing epub @ 2023-03-15 18:35 H.-J. Heitländer 2023-03-16 5:05 ` Michael Heerdegen 2023-03-16 9:22 ` emacs 30.5.0 editing epub Stephen Berman 0 siblings, 2 replies; 37+ messages in thread From: H.-J. Heitländer @ 2023-03-15 18:35 UTC (permalink / raw) To: gnu emacs Hi there, trying to get my feet wet with emacs and lisp. ... well it seems I am drowning... The problem: I am editing epub archives and any saves that I am doing result in <snip> ***backtrace*** Debugger entered--Lisp error: (wrong-type-argument stringp nil) doc-view--revert-buffer(#f(compiled-function (&rest args) #<bytecode -0x1d096aa50772e2b6>) t t) apply(doc-view--revert-buffer #f(compiled-function (&rest args) #<bytecode -0x1d096aa50772e2b6>) (t t)) #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d096aa50772e2b6>))(t t) archive--mode-revert(#f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d096aa50772e2b6>)) nil nil) apply(archive--mode-revert #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d096aa50772e2b6>)) (nil nil)) #f(advice archive--mode-revert :around #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d096aa50772e2b6>)))(nil nil) revert-buffer() archive-write-file-member() run-hook-with-args-until-success(archive-write-file-member) basic-save-buffer(t) save-buffer(1) funcall-interactively(save-buffer 1) command-execute(save-buffer) </snip> For the moment I can live with that as in reality the epub is being saved. My problem is that from that moment on the display of the epub subfile (<name>.html) loses the utf-8 display. (oh, and every other file is being displayed in the same - wrong - way.) The content is shown as (example) <snip> \342\200\234Nicely done. Now let\342\200\231s get that equipment on board.\342\200\234 </p> </snip> It should have been shown as <snip> "Nicely done. Now let's get that equipment on board." </p> </snip> I searched the internet without any result. Don't know which part of documentation to read. Question: How do I switch the display back to show the contents in the expected way??? TX Heiner ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-15 18:35 emacs 30.5.0 editing epub H.-J. Heitländer @ 2023-03-16 5:05 ` Michael Heerdegen 2023-03-16 6:57 ` H.-J. Heitländer 2023-03-16 9:22 ` emacs 30.5.0 editing epub Stephen Berman 1 sibling, 1 reply; 37+ messages in thread From: Michael Heerdegen @ 2023-03-16 5:05 UTC (permalink / raw) To: help-gnu-emacs H.-J. Heitländer <Heiner.Heitlaender@posteo.de> writes: > The problem: > > I am editing epub archives and any saves that I am doing result in > > <snip> > > ***backtrace*** > > Debugger entered--Lisp error: (wrong-type-argument stringp nil) > > doc-view--revert-buffer(#f(compiled-function (&rest args) #<bytecode > -0x1d096aa50772e2b6>) t t) No idea why this is happening... but your backtrace is not very informative because it was created using compiled Elisp code. Could you please try to recreate a backtrace using interpreted Elisp? The only thing you need to do is to load the .el files of the according libraries ("doc-view.el" and "files.el" should suffice) and then do the same as before. TIA, Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 5:05 ` Michael Heerdegen @ 2023-03-16 6:57 ` H.-J. Heitländer 2023-03-17 0:44 ` Michael Heerdegen 2023-03-17 1:13 ` Michael Heerdegen 0 siblings, 2 replies; 37+ messages in thread From: H.-J. Heitländer @ 2023-03-16 6:57 UTC (permalink / raw) To: Michael Heerdegen; +Cc: gnu emacs Hi Michael, thanks for getting involved. Nevertheless I would be quite content with a temporary solution by being able to get emacs to redisplay in the correct form. Thank you Heiner Appended backtrace: load-file: arc-mode.el, doc-view.el, files.el here we go: <snip> Debugger entered--Lisp error: (wrong-type-argument stringp nil) write-region(nil nil nil) (if (equal buffer-file-name doc-view--buffer-file-name) nil (doc-view-make-safe-dir doc-view-cache-directory) (write-region nil nil doc-view--buffer-file-name)) (let ((revert-buffer-preserve-modes t)) (apply orig-fun args) (if (equal buffer-file-name doc-view--buffer-file-name) nil (doc-view-make-safe-dir doc-view-cache-directory) (write-region nil nil doc-view--buffer-file-name))) (closure ((args t t) (orig-fun . #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)) revert-buffer-preserve-modes) nil (let ((revert-buffer-preserve-modes t)) (apply orig-fun args) (if (equal buffer-file-name doc-view--buffer-file-name) nil (doc-view-make-safe-dir doc-view-cache-directory) (write-region nil nil doc-view--buffer-file-name))))() funcall((closure ((args t t) (orig-fun . #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)) revert-buffer-preserve-modes) nil (let ((revert-buffer-preserve-modes t)) (apply orig-fun args) (if (equal buffer-file-name doc-view--buffer-file-name) nil (doc-view-make-safe-dir doc-view-cache-directory) (write-region nil nil doc-view--buffer-file-name))))) (if (and (eq 'pdf doc-view-doc-type) (executable-find "pdfinfo")) (if (= 0 (call-process "pdfinfo" nil nil nil doc-view--buffer-file-name)) (funcall --cl-revert--) (if (called-interactively-p 'interactive) (progn (message "Can't revert right now because the file is corrupt...")))) (funcall --cl-revert--)) (let* ((--cl-revert-- #'(lambda nil (let ((revert-buffer-preserve-modes t)) (apply orig-fun args) (if (equal buffer-file-name doc-view--buffer-file-name) nil (doc-view-make-safe-dir doc-view-cache-directory) (write-region nil nil doc-view--buffer-file-name)))))) (if (and (eq 'pdf doc-view-doc-type) (executable-find "pdfinfo")) (if (= 0 (call-process "pdfinfo" nil nil nil doc-view--buffer-file-name)) (funcall --cl-revert--) (if (called-interactively-p 'interactive) (progn (message "Can't revert right now because the file is corrupt...")))) (funcall --cl-revert--))) doc-view--revert-buffer(#f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>) t t) apply(doc-view--revert-buffer #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>) (t t)) #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>))(t t) apply(#f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)) t t nil) (let ((coding-system-for-read 'no-conversion)) (apply orig-fun t t (cdr (cdr args)))) (let ((no (archive-get-lineno))) (setq archive-files nil) (let ((coding-system-for-read 'no-conversion)) (apply orig-fun t t (cdr (cdr args)))) (archive-mode) (goto-char archive-file-list-start) (archive-next-line no)) archive--mode-revert(#f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)) nil nil) apply(archive--mode-revert #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)) (nil nil)) #f(advice archive--mode-revert :around #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)))(nil nil) funcall(#f(advice archive--mode-revert :around #f(advice doc-view--revert-buffer :around #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>))) nil nil) (let ((revert-buffer-in-progress-p t) (revert-buffer-preserve-modes preserve-modes) (state (and (boundp 'read-only-mode--state) (list read-only-mode--state)))) (funcall (or revert-buffer-function #'revert-buffer--default) ignore-auto noconfirm) (if state (progn (setq buffer-read-only (car state)) (set (make-local-variable 'read-only-mode--state) (car state))))) revert-buffer() (if (not archive-remote) (revert-buffer) (archive-maybe-update nil)) (save-restriction (message "Updating archive...") (widen) (let ((writer (save-current-buffer (set-buffer archive-superior-buffer) (archive-name "write-file-member"))) (archive (save-current-buffer (set-buffer archive-superior-buffer) (archive-maybe-copy (buffer-file-name))))) (if (fboundp writer) (funcall writer archive archive-subfile-mode) (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer))) (set-buffer-modified-p nil) (message "Updating archive...done")) (set-buffer archive-superior-buffer) (if (not archive-remote) (revert-buffer) (archive-maybe-update nil))) (save-excursion (save-restriction (message "Updating archive...") (widen) (let ((writer (save-current-buffer (set-buffer archive-superior-buffer) (archive-name "write-file-member"))) (archive (save-current-buffer (set-buffer archive-superior-buffer) (archive-maybe-copy (buffer-file-name))))) (if (fboundp writer) (funcall writer archive archive-subfile-mode) (archive-*-write-file-member archive archive-subfile-mode (symbol-value writer))) (set-buffer-modified-p nil) (message "Updating archive...done")) (set-buffer archive-superior-buffer) (if (not archive-remote) (revert-buffer) (archive-maybe-update nil)))) archive-write-file-member() run-hook-with-args-until-success(archive-write-file-member) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) (let ((dir (file-name-directory (expand-file-name buffer-file-name)))) (if (file-exists-p dir) nil (if (y-or-n-p (format-message "Directory `%s' does not exist; create? " dir)) (make-directory dir t) (error "Canceled"))) (setq setmodes (basic-save-buffer-1)))) (if (run-hook-with-args-until-success 'write-contents-functions) nil (or buffer-file-name (let ((filename (expand-file-name (read-file-name "File to save in: " nil (expand-file-name ...))))) (if (file-exists-p filename) (if (file-directory-p filename) (error "%s is a directory" filename) (if (y-or-n-p (format-message "File `%s' exists; overwrite? " filename)) nil (error "Canceled")))) (set-visited-file-name filename))) (vc-before-save) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) (let ((dir (file-name-directory (expand-file-name buffer-file-name)))) (if (file-exists-p dir) nil (if (y-or-n-p (format-message "Directory `%s' does not exist; create? " dir)) (make-directory dir t) (error "Canceled"))) (setq setmodes (basic-save-buffer-1))))) (save-restriction (widen) (save-excursion (and (> (point-max) (point-min)) (not find-file-literally) (null buffer-read-only) (/= (char-after (1- (point-max))) 10) (not (and (eq selective-display t) (= (char-after (1- ...)) 13))) (or (eq require-final-newline t) (eq require-final-newline 'visit-save) (and require-final-newline (y-or-n-p (format "Buffer %s does not end in newline. Add one? " (buffer-name))))) (save-excursion (goto-char (point-max)) (insert 10)))) (condition-case err (run-hooks 'before-save-hook) ((debug error) (message "Before-save hook error: %S" err) nil)) (if (run-hook-with-args-until-success 'write-contents-functions) nil (or buffer-file-name (let ((filename (expand-file-name (read-file-name "File to save in: " nil ...)))) (if (file-exists-p filename) (if (file-directory-p filename) (error "%s is a directory" filename) (if (y-or-n-p ...) nil (error "Canceled")))) (set-visited-file-name filename))) (vc-before-save) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) (let ((dir (file-name-directory (expand-file-name buffer-file-name)))) (if (file-exists-p dir) nil (if (y-or-n-p (format-message "Directory `%s' does not exist; create? " dir)) (make-directory dir t) (error "Canceled"))) (setq setmodes (basic-save-buffer-1))))) (if buffer-file-name (progn (if save-buffer-coding-system (setq save-buffer-coding-system last-coding-system-used) (setq buffer-file-coding-system last-coding-system-used)) (setq buffer-file-number (file-attribute-file-identifier (file-attributes buffer-file-name))) (if setmodes (condition-case nil (progn (if (condition-case err ... ...) nil (set-file-extended-attributes buffer-file-name ...))) (error nil))) (vc-after-save))) (delete-auto-save-file-if-necessary recent-save)) (let ((recent-save (recent-auto-save-p)) setmodes) (or (null buffer-file-name) (verify-visited-file-modtime (current-buffer)) (not (file-exists-p buffer-file-name)) (yes-or-no-p (format "%s has changed since visited or saved. Save anywa..." (file-name-nondirectory buffer-file-name))) (user-error "Save not confirmed")) (save-restriction (widen) (save-excursion (and (> (point-max) (point-min)) (not find-file-literally) (null buffer-read-only) (/= (char-after (1- (point-max))) 10) (not (and (eq selective-display t) (= (char-after ...) 13))) (or (eq require-final-newline t) (eq require-final-newline 'visit-save) (and require-final-newline (y-or-n-p (format "Buffer %s does not end in newline. Add one? " ...)))) (save-excursion (goto-char (point-max)) (insert 10)))) (condition-case err (run-hooks 'before-save-hook) ((debug error) (message "Before-save hook error: %S" err) nil)) (if (run-hook-with-args-until-success 'write-contents-functions) nil (or buffer-file-name (let ((filename (expand-file-name ...))) (if (file-exists-p filename) (if (file-directory-p filename) (error "%s is a directory" filename) (if ... nil ...))) (set-visited-file-name filename))) (vc-before-save) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) (let ((dir (file-name-directory ...))) (if (file-exists-p dir) nil (if (y-or-n-p ...) (make-directory dir t) (error "Canceled"))) (setq setmodes (basic-save-buffer-1))))) (if buffer-file-name (progn (if save-buffer-coding-system (setq save-buffer-coding-system last-coding-system-used) (setq buffer-file-coding-system last-coding-system-used)) (setq buffer-file-number (file-attribute-file-identifier (file-attributes buffer-file-name))) (if setmodes (condition-case nil (progn (if ... nil ...)) (error nil))) (vc-after-save))) (delete-auto-save-file-if-necessary recent-save)) (run-hooks 'after-save-hook)) (if (or (buffer-modified-p) (and buffer-file-name (not (file-exists-p buffer-file-name)))) (let ((recent-save (recent-auto-save-p)) setmodes) (or (null buffer-file-name) (verify-visited-file-modtime (current-buffer)) (not (file-exists-p buffer-file-name)) (yes-or-no-p (format "%s has changed since visited or saved. Save anywa..." (file-name-nondirectory buffer-file-name))) (user-error "Save not confirmed")) (save-restriction (widen) (save-excursion (and (> (point-max) (point-min)) (not find-file-literally) (null buffer-read-only) (/= (char-after (1- ...)) 10) (not (and (eq selective-display t) (= ... 13))) (or (eq require-final-newline t) (eq require-final-newline 'visit-save) (and require-final-newline (y-or-n-p ...))) (save-excursion (goto-char (point-max)) (insert 10)))) (condition-case err (run-hooks 'before-save-hook) ((debug error) (message "Before-save hook error: %S" err) nil)) (if (run-hook-with-args-until-success 'write-contents-functions) nil (or buffer-file-name (let ((filename ...)) (if (file-exists-p filename) (if ... ... ...)) (set-visited-file-name filename))) (vc-before-save) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) (let ((dir ...)) (if (file-exists-p dir) nil (if ... ... ...)) (setq setmodes (basic-save-buffer-1))))) (if buffer-file-name (progn (if save-buffer-coding-system (setq save-buffer-coding-system last-coding-system-used) (setq buffer-file-coding-system last-coding-system-used)) (setq buffer-file-number (file-attribute-file-identifier (file-attributes buffer-file-name))) (if setmodes (condition-case nil (progn ...) (error nil))) (vc-after-save))) (delete-auto-save-file-if-necessary recent-save)) (run-hooks 'after-save-hook)) (or noninteractive (not called-interactively) (files--message "(No changes need to be saved)"))) (save-current-buffer (if (buffer-base-buffer) (set-buffer (buffer-base-buffer))) (if (or (buffer-modified-p) (and buffer-file-name (not (file-exists-p buffer-file-name)))) (let ((recent-save (recent-auto-save-p)) setmodes) (or (null buffer-file-name) (verify-visited-file-modtime (current-buffer)) (not (file-exists-p buffer-file-name)) (yes-or-no-p (format "%s has changed since visited or saved. Save anywa..." (file-name-nondirectory buffer-file-name))) (user-error "Save not confirmed")) (save-restriction (widen) (save-excursion (and (> (point-max) (point-min)) (not find-file-literally) (null buffer-read-only) (/= (char-after ...) 10) (not (and ... ...)) (or (eq require-final-newline t) (eq require-final-newline ...) (and require-final-newline ...)) (save-excursion (goto-char ...) (insert 10)))) (condition-case err (run-hooks 'before-save-hook) ((debug error) (message "Before-save hook error: %S" err) nil)) (if (run-hook-with-args-until-success 'write-contents-functions) nil (or buffer-file-name (let (...) (if ... ...) (set-visited-file-name filename))) (vc-before-save) (or (run-hook-with-args-until-success 'local-write-file-hooks) (run-hook-with-args-until-success 'write-file-functions) (let (...) (if ... nil ...) (setq setmodes ...)))) (if buffer-file-name (progn (if save-buffer-coding-system (setq save-buffer-coding-system last-coding-system-used) (setq buffer-file-coding-system last-coding-system-used)) (setq buffer-file-number (file-attribute-file-identifier ...)) (if setmodes (condition-case nil ... ...)) (vc-after-save))) (delete-auto-save-file-if-necessary recent-save)) (run-hooks 'after-save-hook)) (or noninteractive (not called-interactively) (files--message "(No changes need to be saved)")))) basic-save-buffer(t) (let ((modp (buffer-modified-p)) (make-backup-files (or (and make-backup-files (not (eq arg 0))) (memq arg '(16 64))))) (and modp (memq arg '(16 64)) (setq buffer-backed-up nil)) (if (and modp (buffer-file-name) (not noninteractive) (not save-silently)) (message "Saving file %s..." (buffer-file-name))) (basic-save-buffer (called-interactively-p 'any)) (and modp (memq arg '(4 64)) (setq buffer-backed-up nil))) save-buffer(1) funcall-interactively(save-buffer 1) command-execute(save-buffer) </snip> Am 16.03.23 um 06:05 schrieb Michael Heerdegen: > H.-J. Heitländer<Heiner.Heitlaender@posteo.de> writes: > >> The problem: >> >> I am editing epub archives and any saves that I am doing result in >> >> <snip> >> >> ***backtrace*** >> >> Debugger entered--Lisp error: (wrong-type-argument stringp nil) >> >> doc-view--revert-buffer(#f(compiled-function (&rest args) #<bytecode >> -0x1d096aa50772e2b6>) t t) > No idea why this is happening... but your backtrace is not very > informative because it was created using compiled Elisp code. > > Could you please try to recreate a backtrace using interpreted Elisp? > The only thing you need to do is to load the .el files of the according > libraries ("doc-view.el" and "files.el" should suffice) and then do the > same as before. > > TIA, > > Michael. > > ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 6:57 ` H.-J. Heitländer @ 2023-03-17 0:44 ` Michael Heerdegen 2023-03-17 1:13 ` Michael Heerdegen 1 sibling, 0 replies; 37+ messages in thread From: Michael Heerdegen @ 2023-03-17 0:44 UTC (permalink / raw) To: help-gnu-emacs H.-J. Heitländer <Heiner.Heitlaender@posteo.de> writes: > Nevertheless I would be quite content with a temporary solution by > being able to get emacs to redisplay in the correct form. Please report this as a bug. Finding a temporary solution might not be easier than finding out what happens. All you need to do is either use M-x report-emacs-bug as described in (info "(emacs) Checklist") (a subnode of the info page that Stefan's suggested menu item leads to), or, if you don't yet have/ don't want to set up sending mails from inside Emacs, just write a mail like this to bug-gnu-emacs@gnu.org and include your backtrace (thanks for it) and a short description of what you did (most importantly, a short recipe: in particular, what buffer was current when you tried to save). A few lines suffice. > archive--mode-revert(#f(advice doc-view--revert-buffer :around > #f(compiled-function (&rest args) #<bytecode -0x1d33bbea90aba2b6>)) > nil nil) This looks odd: the two advices `archive--mode-revert' and `doc-view--revert-buffer' should not both be installed in a buffer at the same time. Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 6:57 ` H.-J. Heitländer 2023-03-17 0:44 ` Michael Heerdegen @ 2023-03-17 1:13 ` Michael Heerdegen 2023-03-19 21:23 ` editing a PDF [Re: emacs 30.5.0 editing epub] gebser 1 sibling, 1 reply; 37+ messages in thread From: Michael Heerdegen @ 2023-03-17 1:13 UTC (permalink / raw) To: help-gnu-emacs H.-J. Heitländer <Heiner.Heitlaender@posteo.de> writes: > Hi Michael, > > thanks for getting involved. > > Nevertheless I would be quite content with a temporary solution by > being able to get emacs to redisplay in the correct form. BTW, I managed to copy an pdf-File into an epub Archive. Opened the archive and opened the pdf using doc-view. I was not able to provoke an error. Saving worked successfully however I tried. Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-17 1:13 ` Michael Heerdegen @ 2023-03-19 21:23 ` gebser 2023-03-19 23:59 ` Michael Heerdegen 0 siblings, 1 reply; 37+ messages in thread From: gebser @ 2023-03-19 21:23 UTC (permalink / raw) To: help-gnu-emacs On 3/16/23 9:13 PM, Michael Heerdegen wrote: > I managed to copy an pdf-File into an epub Archive. Opened the > archive and opened the pdf using doc-view. I was not able to provoke an > error. Saving worked successfully however I tried. > > Michael. How does one edit a PDF file in emacs? When I downloaded https://www.gnu.org.ua/software/direvent/manual/direvent.pdf, loaded it into emacs, and tried to edit it, I could see it it and read it, but I couldn't even highlight a part of the text so I could copy it... nor could I make any changes to it. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-19 21:23 ` editing a PDF [Re: emacs 30.5.0 editing epub] gebser @ 2023-03-19 23:59 ` Michael Heerdegen 2023-03-20 7:15 ` gebser 0 siblings, 1 reply; 37+ messages in thread From: Michael Heerdegen @ 2023-03-19 23:59 UTC (permalink / raw) To: help-gnu-emacs "gebser@mousecar.com" <gebser@mousecar.com> writes: > How does one edit a PDF file in emacs? When I downloaded > https://www.gnu.org.ua/software/direvent/manual/direvent.pdf, loaded > it into emacs, and tried to edit it, I could see it it and read it, > but I couldn't even highlight a part of the text so I could copy > it... nor could I make any changes to it. I don't think you want to edit pdf in Emacs: the file contents are not human readable, and Emacs doesn't provide features to allow graphical editing like those pdf editors (at least not built in). epub files can contain human readable parts like html, however. What I had written: >> I managed to copy an pdf-File into an epub Archive. Opened the >> archive and opened the pdf using doc-view. I was not able to provoke an >> error. Saving worked successfully however I tried. was only happening because I was trying around how to provoke the reported error. Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-19 23:59 ` Michael Heerdegen @ 2023-03-20 7:15 ` gebser 2023-03-21 0:31 ` Michael Heerdegen 2023-03-21 6:28 ` Yuri Khan 0 siblings, 2 replies; 37+ messages in thread From: gebser @ 2023-03-20 7:15 UTC (permalink / raw) To: help-gnu-emacs On 3/19/23 7:59 PM, Michael Heerdegen wrote: > "gebser@mousecar.com" <gebser@mousecar.com> writes: > >> How does one edit a PDF file in emacs? When I downloaded >> https://www.gnu.org.ua/software/direvent/manual/direvent.pdf, loaded >> it into emacs, and tried to edit it, I could see it it and read it, >> but I couldn't even highlight a part of the text so I could copy >> it... nor could I make any changes to it. > > I don't think you want to edit pdf in Emacs: the file contents are not > human readable, and Emacs doesn't provide features to allow graphical > editing like those pdf editors (at least not built in). > > epub files can contain human readable parts like html, however. > > What I had written: > >>> I managed to copy an pdf-File into an epub Archive. Opened the >>> archive and opened the pdf using doc-view. I was not able to provoke an >>> error. Saving worked successfully however I tried. > > was only happening because I was trying around how to provoke the > reported error. > > Michael. Yep, of course that was the paragraph I was reading too. It is kinda weird that, with all the many things that emacs can do, it can't take the info from doc-view (which obviously understands all the pieces of a pdf-- down to its bits-- and how they all go together to make a document) and edit it... it's pretty much implausible to believe emacs *can't* do that. But then, I've always thought reality was completely implausible. :^/ ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-20 7:15 ` gebser @ 2023-03-21 0:31 ` Michael Heerdegen 2023-03-21 6:28 ` Yuri Khan 1 sibling, 0 replies; 37+ messages in thread From: Michael Heerdegen @ 2023-03-21 0:31 UTC (permalink / raw) To: help-gnu-emacs "gebser@mousecar.com" <gebser@mousecar.com> writes: > It is kinda weird that, with all the many things that emacs can do, it > can't take the info from doc-view (which obviously understands all the > pieces of a pdf-- down to its bits-- and how they all go together to > make a document) and edit it... AFAIU it understands nothing at all - it just calls an external converter to generate a set of png images it then displays. > it's pretty much implausible to believe emacs *can't* do that. I think if someone wants to work on something like that the result would be welcome. But this probably would have to be done from scratch, more or less, and not be the smallest effort. Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-20 7:15 ` gebser 2023-03-21 0:31 ` Michael Heerdegen @ 2023-03-21 6:28 ` Yuri Khan 2023-03-21 6:38 ` Emanuel Berg 2023-03-21 11:51 ` Ulrich Deiters 1 sibling, 2 replies; 37+ messages in thread From: Yuri Khan @ 2023-03-21 6:28 UTC (permalink / raw) To: gebser; +Cc: help-gnu-emacs On Mon, 20 Mar 2023 at 14:16, gebser@mousecar.com <gebser@mousecar.com> wrote: > It is kinda weird that, with all the many things that emacs can do, it > can't take the info from doc-view (which obviously understands all the > pieces of a pdf-- down to its bits-- and how they all go together to > make a document) and edit it... it's pretty much implausible to believe > emacs *can't* do that. But then, I've always thought reality was > completely implausible. :^/ PDF is not really meant for editing. It’s not even a data format. Rather, it’s an executable program that has instructions like “select this font” and “display this word in the selected font at this position on the page” and “make a new page”. You don’t normally edit executable programs, you compile them from source. In the same vein, to get a modified PDF, you find the source document from which it was produced, modify that, and re-export. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 6:28 ` Yuri Khan @ 2023-03-21 6:38 ` Emanuel Berg 2023-03-22 16:32 ` Yuri Khan 2023-03-21 11:51 ` Ulrich Deiters 1 sibling, 1 reply; 37+ messages in thread From: Emanuel Berg @ 2023-03-21 6:38 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan wrote: >> It is kinda weird that, with all the many things that emacs >> can do, it can't take the info from doc-view (which >> obviously understands all the pieces of a pdf-- down to its >> bits-- and how they all go together to make a document) and >> edit it... it's pretty much implausible to believe emacs >> *can't* do that. But then, I've always thought reality was >> completely implausible. :^/ > > PDF is not really meant for editing. It’s not even a data > format. Rather, it’s an executable program that has > instructions like “select this font” and “display this word > in the selected font at this position on the page” and “make > a new page”. > > You don’t normally edit executable programs, you compile > them from source. In the same vein, to get a modified PDF, > you find the source document from which it was produced, > modify that, and re-export. Still, they are editable at/from the PDF level as well, for example with xournal. This is used for signing documents, for example. It should not be confused or compared with editing the source, that's another thing. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 6:38 ` Emanuel Berg @ 2023-03-22 16:32 ` Yuri Khan 2023-03-22 18:48 ` Bob Newell ` (3 more replies) 0 siblings, 4 replies; 37+ messages in thread From: Yuri Khan @ 2023-03-22 16:32 UTC (permalink / raw) To: help-gnu-emacs On Wed, 22 Mar 2023 at 22:46, Emanuel Berg <incal@dataswamp.org> wrote: > > You don’t normally edit executable programs, you compile > > them from source. In the same vein, to get a modified PDF, > > you find the source document from which it was produced, > > modify that, and re-export. > > Still, they are editable at/from the PDF level as well, for > example with xournal. That’s not really editing. You can scrawl over the existing text, you can carefully overpaint existing text with your own, but you cannot replace one word with a different word and hope the rest of the text is repositioned to accommodate the change. (To stretch the executable program analogy, you can append new instructions to an existing program. They will be executed and may, in limited cases, have your desired effect.) Xournal doesn’t even claim it supports editing — the menu item is called Annotate PDF. Commercial, proprietary Acrobat (not the Reader variety, the full suite) can, in limited ways, modify individual runs of text. But if you overflow a line, it won’t do anything to help you, you just get an overfull line. > This is used for signing documents, > for example. I’d be very wary of putting my handwritten signature as an annotation in a PDF document and giving that to another person. For all I know, it would enable them to extract the annotation containing my signature and apply it to a different document. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-22 16:32 ` Yuri Khan @ 2023-03-22 18:48 ` Bob Newell 2023-03-23 9:36 ` Jean Louis 2023-03-23 9:13 ` Jean Louis ` (2 subsequent siblings) 3 siblings, 1 reply; 37+ messages in thread From: Bob Newell @ 2023-03-22 18:48 UTC (permalink / raw) To: help-gnu-emacs I get sent PDFs all the time and it's often frustrating. However most of the time I need the text, not necessarily the formatting. For that, there are various PDF to text converters which work to some degree (not so great with multi-column text for the most part). I also found a PDF to spreadsheet converter which isn't especially great but better than nothing. Well, at least a little better. I realize this doesn't at all address the original question about editing PDFs in the true sense of editing. But in a lot of cases text extraction may be good enough, depending on your purpose. Copy/paste works in many cases as well. For instance I just got sent a PDF of a budget spreadsheet, and with not so much effort was able to make it into an org-mode table. All bets are off if the PDF is an /image/ of some text. Then you've got to get out your friendly OCR software. In such cases I write back to the sender and politely ask for something easier to use. -- Bob Newell Honolulu, Hawai`i - Via GNU/Linux/Emacs/Gnus/BBDB ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-22 18:48 ` Bob Newell @ 2023-03-23 9:36 ` Jean Louis 2023-03-23 23:00 ` Bob Newell 0 siblings, 1 reply; 37+ messages in thread From: Jean Louis @ 2023-03-23 9:36 UTC (permalink / raw) To: Bob Newell; +Cc: help-gnu-emacs * Bob Newell <bobnewell@bobnewell.net> [2023-03-22 21:49]: > I get sent PDFs all the time and it's often frustrating. > However most of the time I need the text, not necessarily the > formatting. For that, there are various PDF to text > converters which work to some degree (not so great with > multi-column text for the most part). Following references may be helpful to some people thinking to use multi-column text in Emacs: There is (info "(emacs) Two-Column") in Emacs manual. Example output produced by using RCD Paps packag for Emacs: https://gnu.support/files/emacs/packages/rcd-paps/2023/03/2023-03-23/2023-03-23-12:27:05.pdf GNU Emacs package: rcd-paps.el: https://gnu.support/gnu-emacs/packages/GNU-Emacs-package-rcd-paps-el-76862.html Any Emacs printing can produce such pages. > I realize this doesn't at all address the original question > about editing PDFs in the true sense of editing. But in a lot > of cases text extraction may be good enough, depending on your > purpose. LibreaOffice Draw -- open PDF file and you will see you can edit many things. Okular -- you can annotate and insert text Scribus and Xournal -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-23 9:36 ` Jean Louis @ 2023-03-23 23:00 ` Bob Newell 0 siblings, 0 replies; 37+ messages in thread From: Bob Newell @ 2023-03-23 23:00 UTC (permalink / raw) To: help-gnu-emacs > Following references may be helpful to some people thinking to use > multi-column text in Emacs: > > There is (info "(emacs) Two-Column") in Emacs manual. Right, although I was referring to a different problem, namely that if you do a PDF to text conversion of a PDF with multi-column text, you typically don't get great results. Or at least I don't. I do better with OCR software that allows me to select a column at a time. But then we're getting into multiple manual steps, introducing OCR error, and in the end we are working with the text, not directly editing the PDF. (However extracting text is often enough for me.) > Example output produced by using RCD Paps packag for Emacs: > https://gnu.support/files/emacs/packages/rcd-paps/2023/03/2023-03-23/2023-03-23-12:27:05.pdf I didn't know about the RCD package. Looks useful and thank you for the pointer. > LibreaOffice Draw -- open PDF file and you will see you can edit many > things. > > Okular -- you can annotate and insert text > > Scribus and Xournal Yes, I use Xournal very often and sometimes Gimp in this manner for signing or annotating business documents received as PDFs. It is still not the same as directly editing. However if the reproduction is faithfully enough it is indeed possible to make significant changes and export back out as PDF. -- Bob Newell Honolulu, Hawai`i Via Linux/Emacs/Gnus/BBDB. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-22 16:32 ` Yuri Khan 2023-03-22 18:48 ` Bob Newell @ 2023-03-23 9:13 ` Jean Louis 2023-03-23 10:37 ` Michael Heerdegen 2023-03-23 20:07 ` Emanuel Berg 3 siblings, 0 replies; 37+ messages in thread From: Jean Louis @ 2023-03-23 9:13 UTC (permalink / raw) To: Yuri Khan; +Cc: help-gnu-emacs * Yuri Khan <yuri.v.khan@gmail.com> [2023-03-22 19:34]: > > This is used for signing documents, > > for example. > > I’d be very wary of putting my handwritten signature as an > annotation in a PDF document and giving that to another person. For > all I know, it would enable them to extract the annotation > containing my signature and apply it to a different document. It is false sense of safety. Any of your signature anywhere ever given to anybody, from paper or anywhere, could be taken, then made picture of it and easily placed in any kind of documents. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-22 16:32 ` Yuri Khan 2023-03-22 18:48 ` Bob Newell 2023-03-23 9:13 ` Jean Louis @ 2023-03-23 10:37 ` Michael Heerdegen 2023-03-23 20:13 ` Emanuel Berg 2023-03-23 20:07 ` Emanuel Berg 3 siblings, 1 reply; 37+ messages in thread From: Michael Heerdegen @ 2023-03-23 10:37 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan <yuri.v.khan@gmail.com> writes: > I’d be very wary of putting my handwritten signature as an annotation > in a PDF document and giving that to another person. For all I know, > it would enable them to extract the annotation containing my signature > and apply it to a different document. Anybody can do that with a scan of my signature anyway (that's how I got my version). I do have to sign stuff. I can't prevent criminals from doing criminal things with my signature in this case I think. I don't even expect that such pdfs are valid documents btw (as a lot of such things are actually, like photos of identity cards). Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-23 10:37 ` Michael Heerdegen @ 2023-03-23 20:13 ` Emanuel Berg 0 siblings, 0 replies; 37+ messages in thread From: Emanuel Berg @ 2023-03-23 20:13 UTC (permalink / raw) To: help-gnu-emacs Michael Heerdegen wrote: >> I’d be very wary of putting my handwritten signature as an >> annotation in a PDF document and giving that to another >> person. For all I know, it would enable them to extract the >> annotation containing my signature and apply it to >> a different document. > > Anybody can do that with a scan of my signature anyway > (that's how I got my version). I do have to sign stuff. > I can't prevent criminals from doing criminal things with my > signature in this case I think. Indeed, as the major of Limbo City, I do that all the time! But it's my impression these documents don't contain that much, most of the time, so maybe there is no harm to it. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-22 16:32 ` Yuri Khan ` (2 preceding siblings ...) 2023-03-23 10:37 ` Michael Heerdegen @ 2023-03-23 20:07 ` Emanuel Berg 3 siblings, 0 replies; 37+ messages in thread From: Emanuel Berg @ 2023-03-23 20:07 UTC (permalink / raw) To: help-gnu-emacs Yuri Khan wrote: >>> You don’t normally edit executable programs, you compile >>> them from source. In the same vein, to get a modified PDF, >>> you find the source document from which it was produced, >>> modify that, and re-export. >> >> Still, they are editable at/from the PDF level as well, for >> example with xournal. > > That’s not really editing. You can scrawl over the existing > text, you can carefully overpaint existing text with your > own, but you cannot replace one word with a different word > and hope the rest of the text is repositioned to accommodate > the change. Well, obviously it's not the same as editing the LaTeX source and compiling the original document. Actually not only is it "not the same", it's completely different. -- underground experts united https://dataswamp.org/~incal ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 6:28 ` Yuri Khan 2023-03-21 6:38 ` Emanuel Berg @ 2023-03-21 11:51 ` Ulrich Deiters 2023-03-21 21:57 ` gebser 1 sibling, 1 reply; 37+ messages in thread From: Ulrich Deiters @ 2023-03-21 11:51 UTC (permalink / raw) To: help-gnu-emacs You can try to convert PDF to PostScript, e.g., with pdf2ps, pdftops, … PostScript is human-readable and can be edited with emacs. Depending how the PDF code was created, however, the PostScript code may be difficult to interpret, or even contain blocks of binary code. Unless you recognize some strings like … (some text) show … which can eventually be modified, it is risky to make changes. As Yuri stated, PDF (or PostScript) code is meant to be executed. Changes might result in a buggy code, and then the interpreter or the printer will balk. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 11:51 ` Ulrich Deiters @ 2023-03-21 21:57 ` gebser 2023-03-21 22:55 ` Ulrich Deiters 2023-03-22 7:03 ` Jean Louis 0 siblings, 2 replies; 37+ messages in thread From: gebser @ 2023-03-21 21:57 UTC (permalink / raw) To: help-gnu-emacs On 3/21/23 7:51 AM, Ulrich Deiters wrote: > You can try to convert PDF to PostScript, e.g., with pdf2ps, pdftops, … > PostScript is human-readable and can be edited with emacs. > > Depending how the PDF code was created, however, the PostScript code > may be difficult to interpret, or even contain blocks of binary code. > Unless you recognize some strings like > > … (some text) show … > > which can eventually be modified, it is risky to make changes. As Yuri > stated, PDF (or PostScript) code is meant to be executed. Changes might > result in a buggy code, and then the interpreter or the printer will balk. > > Ugghhh. You and Yuri have made me dislike PDFs even more than before. Yet still those executable(s) could be reverse-engineered. Better than that, what FOSS app(s) would be happy replacement for the Acrobat-Industrial Complex? ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 21:57 ` gebser @ 2023-03-21 22:55 ` Ulrich Deiters 2023-03-22 1:56 ` Michael Heerdegen ` (2 more replies) 2023-03-22 7:03 ` Jean Louis 1 sibling, 3 replies; 37+ messages in thread From: Ulrich Deiters @ 2023-03-21 22:55 UTC (permalink / raw) To: help-gnu-emacs Am 21.03.23 um 22:57 schrieb gebser@mousecar.com: > Better than that, what FOSS app(s) would be happy replacement for the > Acrobat-Industrial Complex? This depends on what you want. Printing a document takes (at least) three stages: (1) One composes the text using a language that contains formatting commands. The best open-source choice is LaTeX. LaTeX code is human- readable and can be edited with emacs; in fact, emacs has a LaTeX mode. There are also free programs that assist writing LaTeX code, or which let one compose XML code, which is then translated into LaTeX. (2) One processes the LaTeX code; the results are DVI, PostScript, or PDF files. Such files basically consist of instructions of the type "choose font F, go to location (X, Y), and print character C". Therefore these files are long and, if converted to a human-readable format, very boring. You do not want to edit these. (3) The intermediate code is processed to produce a bitmap, which is then transferred to the paper. So you see, the stage at which editing makes sense is Stage (1). Exceptions are graphics designers and artists, who work with PostScript or similar languages directly in order to achieve special effects. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 22:55 ` Ulrich Deiters @ 2023-03-22 1:56 ` Michael Heerdegen 2023-03-22 8:26 ` FOSS replacement for PDF [Re: editing a PDF] gebser 2023-03-28 11:28 ` editing a PDF [Re: emacs 30.5.0 editing epub] Michael Heerdegen 2 siblings, 0 replies; 37+ messages in thread From: Michael Heerdegen @ 2023-03-22 1:56 UTC (permalink / raw) To: help-gnu-emacs Ulrich Deiters <ulrich.deiters@uni-koeln.de> writes: > So you see, the stage at which editing makes sense is Stage (1). Apart from that, the few useful things that you can do with existing pdf's is stuff like reordering pages, changing page sizes or adding page numbers or merge several files (e.g. pdfsam, pdfchain, page-crunch). And there is for example Xournal that allows some very simple and limited editing of pdf files, like adding annotations or inserting your signature as an image. Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* FOSS replacement for PDF [Re: editing a PDF] 2023-03-21 22:55 ` Ulrich Deiters 2023-03-22 1:56 ` Michael Heerdegen @ 2023-03-22 8:26 ` gebser 2023-03-22 9:18 ` Yuri Khan 2023-03-28 11:28 ` editing a PDF [Re: emacs 30.5.0 editing epub] Michael Heerdegen 2 siblings, 1 reply; 37+ messages in thread From: gebser @ 2023-03-22 8:26 UTC (permalink / raw) To: help-gnu-emacs On 3/21/23 6:55 PM, Ulrich Deiters wrote: > Am 21.03.23 um 22:57 schrieb gebser@mousecar.com: >> Better than that, what FOSS app(s) would be happy replacement for the >> Acrobat-Industrial Complex? > > This depends on what you want. Printing a document takes > (at least) three stages: > > (1) One composes the text using a language that contains formatting > commands. The best open-source choice is LaTeX. LaTeX code is human- > readable and can be edited with emacs; in fact, emacs has a LaTeX > mode. There are also free programs that assist writing LaTeX code, > or which let one compose XML code, which is then translated into LaTeX. > > (2) One processes the LaTeX code; the results are DVI, PostScript, > or PDF files. Such files basically consist of instructions of the > type "choose font F, go to location (X, Y), and print character C". > Therefore these files are long and, if converted to a human-readable > format, very boring. You do not want to edit these. > > (3) The intermediate code is processed to produce a bitmap, which is > then transferred to the paper. > > So you see, the stage at which editing makes sense is Stage (1). > > Exceptions are graphics designers and artists, who work with PostScript > or similar languages directly in order to achieve special effects. > > Thanks for the very thorough reply. This question really wasn't for me, but rather for people I know and meet who write pdf docs, who take pdf as a "standard". I'm afraid that latex would be far too technological for them... and for most people. Even something like Libreoffice's Write would have a more familiar UI-- for that reason alone they'd be more like likely to try it. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: FOSS replacement for PDF [Re: editing a PDF] 2023-03-22 8:26 ` FOSS replacement for PDF [Re: editing a PDF] gebser @ 2023-03-22 9:18 ` Yuri Khan 2023-03-23 9:21 ` Jean Louis 0 siblings, 1 reply; 37+ messages in thread From: Yuri Khan @ 2023-03-22 9:18 UTC (permalink / raw) To: gebser; +Cc: help-gnu-emacs On Wed, 22 Mar 2023 at 15:26, gebser@mousecar.com <gebser@mousecar.com> wrote: > Even something like Libreoffice's > Write would have a more familiar UI-- for that reason alone they'd be > more like likely to try it. LibreOffice is okay. And it can export to PDF in case that’s needed as the final format. Of course, exporting to PDF is a one-way street, therefore, all actual editing needs to be done on the source LibreOffice document. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: FOSS replacement for PDF [Re: editing a PDF] 2023-03-22 9:18 ` Yuri Khan @ 2023-03-23 9:21 ` Jean Louis 2023-03-23 9:49 ` Yuri Khan 0 siblings, 1 reply; 37+ messages in thread From: Jean Louis @ 2023-03-23 9:21 UTC (permalink / raw) To: Yuri Khan; +Cc: gebser, help-gnu-emacs * Yuri Khan <yuri.v.khan@gmail.com> [2023-03-22 12:20]: > Of course, exporting to PDF is a one-way street, therefore, all actual > editing needs to be done on the source LibreOffice document. Okay, though, look at these nice example how it can be converted to HTML: pdf2htmlEX by coolwanglu: https://pdf2htmlex.github.io/pdf2htmlEX/ pdf2htmlex.github.io/pdf2htmlEX/demo/geneve.html: https://pdf2htmlex.github.io/pdf2htmlEX/demo/geneve.html pdf2htmlex.github.io/pdf2htmlEX/demo/cheat.html: https://pdf2htmlex.github.io/pdf2htmlEX/demo/cheat.html pdf2htmlex.github.io/pdf2htmlEX/demo/issue65_en.html: https://pdf2htmlex.github.io/pdf2htmlEX/demo/issue65_en.html pdf2htmlex.github.io/pdf2htmlEX/demo/demo.html: https://pdf2htmlex.github.io/pdf2htmlEX/demo/demo.html So far it is possible to convert PDF to plain text provided there was some text inside, and to HTML. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: FOSS replacement for PDF [Re: editing a PDF] 2023-03-23 9:21 ` Jean Louis @ 2023-03-23 9:49 ` Yuri Khan 2023-03-23 10:53 ` Gregory Heytings 0 siblings, 1 reply; 37+ messages in thread From: Yuri Khan @ 2023-03-23 9:49 UTC (permalink / raw) To: Yuri Khan, gebser, help-gnu-emacs On Thu, 23 Mar 2023 at 16:24, Jean Louis <bugs@gnu.support> wrote: > Okay, though, look at these nice example how it can be converted to > HTML: > > pdf2htmlEX by coolwanglu: > https://pdf2htmlex.github.io/pdf2htmlEX/ Yeah that’s somewhat impressive. You will notice there are stray spaces in some words, possibly due to kerning. > pdf2htmlex.github.io/pdf2htmlEX/demo/geneve.html: > https://pdf2htmlex.github.io/pdf2htmlEX/demo/geneve.html This one is literally unreadable. (If you allow web fonts, it renders in a hard-to-read font, if you don’t, you get two pages of tofu; copying to clipboard does not work in any case.) ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: FOSS replacement for PDF [Re: editing a PDF] 2023-03-23 9:49 ` Yuri Khan @ 2023-03-23 10:53 ` Gregory Heytings 0 siblings, 0 replies; 37+ messages in thread From: Gregory Heytings @ 2023-03-23 10:53 UTC (permalink / raw) To: Yuri Khan; +Cc: gebser, help-gnu-emacs >> Okay, though, look at these nice example how it can be converted to >> HTML: >> >> pdf2htmlEX by coolwanglu: https://pdf2htmlex.github.io/pdf2htmlEX/ > > Yeah that’s somewhat impressive. > It's impressive, but not for what the OP wanted to do, namely edit the text. The resulting HTML page has the same structure as the PDF: it's a sequence of "put this character in that font at that position" instructions. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 22:55 ` Ulrich Deiters 2023-03-22 1:56 ` Michael Heerdegen 2023-03-22 8:26 ` FOSS replacement for PDF [Re: editing a PDF] gebser @ 2023-03-28 11:28 ` Michael Heerdegen 2 siblings, 0 replies; 37+ messages in thread From: Michael Heerdegen @ 2023-03-28 11:28 UTC (permalink / raw) To: Ulrich Deiters; +Cc: help-gnu-emacs Ulrich Deiters <ulrich.deiters@uni-koeln.de> writes: > (1) One composes the text using a language that contains formatting > commands. The best open-source choice is LaTeX. LaTeX code is human- > readable and can be edited with emacs; in fact, emacs has a LaTeX > mode. There are also free programs that assist writing LaTeX code, > or which let one compose XML code, which is then translated into LaTeX. Let me add: also org-mode can export to pdf. If it should be LaTex and you don't want to write code yourself, even not in Emacs with the really good AUCtex package, there are things like lyx: https://www.lyx.org/ - hybrid latex "editors" that mostly feel like using text processing in LibreOffice (mostly WYSIWYG). It's a good compromise. Org is even simpler. It's not LaTex but still allows to use LaTeX snippets (e.g. for mathematical stuff) that will be integrated in the exported document (be it ps, pdf or html). Michael. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-21 21:57 ` gebser 2023-03-21 22:55 ` Ulrich Deiters @ 2023-03-22 7:03 ` Jean Louis 2023-03-22 15:20 ` gebser 1 sibling, 1 reply; 37+ messages in thread From: Jean Louis @ 2023-03-22 7:03 UTC (permalink / raw) To: gebser@mousecar.com; +Cc: help-gnu-emacs * gebser@mousecar.com <gebser@mousecar.com> [2023-03-22 00:58]: > Ugghhh. You and Yuri have made me dislike PDFs even more than before. Yet > still those executable(s) could be reverse-engineered. Better than that, > what FOSS app(s) would be happy replacement for the Acrobat-Industrial > Complex? As I do not use proprietary applications, I cannot know what does that propriety non-free software Acrobat Industrial Complex does. I may recommend some software here. Name: flpsed 0.7.3-1 Description : A WYSIWYG PostScript annotator URL : http://flpsed.org/flpsed.html This software has very simple feature to edit text in PDF documents or save PS pdocuments to PDF. In general when I want to change PDF, I sometimes convert it to picture and change the picture by using ImageMagick tools. And often I may import PDF into Gimp software and then edit it as pictures. That is often for reasons to insert signature in contracts. -- Jean Take action in Free Software Foundation campaigns: https://www.fsf.org/campaigns In support of Richard M. Stallman https://stallmansupport.org/ ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: editing a PDF [Re: emacs 30.5.0 editing epub] 2023-03-22 7:03 ` Jean Louis @ 2023-03-22 15:20 ` gebser 0 siblings, 0 replies; 37+ messages in thread From: gebser @ 2023-03-22 15:20 UTC (permalink / raw) To: help-gnu-emacs On 3/22/23 3:03 AM, Jean Louis wrote: > Name: flpsed 0.7.3-1 > Description : A WYSIWYG PostScript annotator > URL :http://flpsed.org/flpsed.html Unfortunately it isn't found by gnome's "Activities" search. People would need to write a menu on their hand and not take baths. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-15 18:35 emacs 30.5.0 editing epub H.-J. Heitländer 2023-03-16 5:05 ` Michael Heerdegen @ 2023-03-16 9:22 ` Stephen Berman 2023-03-16 13:16 ` H.-J. Heitländer 1 sibling, 1 reply; 37+ messages in thread From: Stephen Berman @ 2023-03-16 9:22 UTC (permalink / raw) To: H.-J. Heitländer; +Cc: gnu emacs On Wed, 15 Mar 2023 18:35:55 +0000 H.-J. Heitländer <Heiner.Heitlaender@posteo.de> wrote: > Hi there, > > trying to get my feet wet with emacs and lisp. ... well it seems I am > drowning... > > The problem: > > I am editing epub archives and any saves that I am doing result in > > <snip> > > ***backtrace*** [...] > For the moment I can live with that as in reality the epub is being saved. > > My problem is that from that moment on the display of the epub subfile > (<name>.html) loses the utf-8 display. (oh, and every other file is being > displayed in the same - wrong - way.) > > The content is shown as (example) > > <snip> > > \342\200\234Nicely done. Now let\342\200\231s get that equipment on > board.\342\200\234 </p> > > </snip> > > It should have been shown as > > <snip> > > "Nicely done. Now let's get that equipment on board." </p> > > </snip> > > I searched the internet without any result. Don't know which part of > documentation to read. > > Question: How do I switch the display back to show the contents in the > expected way??? It looks like the buffer is being displayed in the raw-text coding system (is the first character in the mode line "t"?). \342\200\234 is the raw-byte sequence of the unicode character LEFT DOUBLE QUOTATION MARK (#x201c) and \342\200\231 of RIGHT SINGLE QUOTATION MARK (#x2019). Does typing `C-x RET r' and at the prompt entering `utf-8' and at the next prompt `yes' fix the display? Steve Berman ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 9:22 ` emacs 30.5.0 editing epub Stephen Berman @ 2023-03-16 13:16 ` H.-J. Heitländer 2023-03-16 15:23 ` Yuri Khan 0 siblings, 1 reply; 37+ messages in thread From: H.-J. Heitländer @ 2023-03-16 13:16 UTC (permalink / raw) To: Stephen Berman; +Cc: gnu emacs Hi Stephen, mode line displays <snip> =:**- </snip> When entering the command C-x RET r ... utf-8 the "answer" is "wrong type argument: strongp, nil". Testcase 2) kill buffer up to the top epub reopen epub open epub subfile (...html) C-x RET r ... utf-8 in minibufer: Revert buffer from file xxx.html? (y or n) Answer: y Minibuffer: Cannot revert noexistent file xxx.html Other directory buffers display with "coding system (default nil)" as soon as I perform a refresh of the directory display with "g". To cure this phenomen I have to kill / restart emacs. So no easy solution / workaround at the moment. TX Heiner Am 16.03.23 um 10:22 schrieb Stephen Berman: > On Wed, 15 Mar 2023 18:35:55 +0000 H.-J. Heitländer<Heiner.Heitlaender@posteo.de> wrote: > >> Hi there, >> >> trying to get my feet wet with emacs and lisp. ... well it seems I am >> drowning... >> >> The problem: >> >> I am editing epub archives and any saves that I am doing result in >> >> <snip> >> >> ***backtrace*** > [...] >> For the moment I can live with that as in reality the epub is being saved. >> >> My problem is that from that moment on the display of the epub subfile >> (<name>.html) loses the utf-8 display. (oh, and every other file is being >> displayed in the same - wrong - way.) >> >> The content is shown as (example) >> >> <snip> >> >> \342\200\234Nicely done. Now let\342\200\231s get that equipment on >> board.\342\200\234 </p> >> >> </snip> >> >> It should have been shown as >> >> <snip> >> >> "Nicely done. Now let's get that equipment on board." </p> >> >> </snip> >> >> I searched the internet without any result. Don't know which part of >> documentation to read. >> >> Question: How do I switch the display back to show the contents in the >> expected way??? > It looks like the buffer is being displayed in the raw-text coding > system (is the first character in the mode line "t"?). \342\200\234 is > the raw-byte sequence of the unicode character LEFT DOUBLE QUOTATION > MARK (#x201c) and \342\200\231 of RIGHT SINGLE QUOTATION MARK (#x2019). > Does typing `C-x RET r' and at the prompt entering `utf-8' and at the > next prompt `yes' fix the display? > > Steve Berman ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 13:16 ` H.-J. Heitländer @ 2023-03-16 15:23 ` Yuri Khan 2023-03-16 16:54 ` H.-J. Heitländer 0 siblings, 1 reply; 37+ messages in thread From: Yuri Khan @ 2023-03-16 15:23 UTC (permalink / raw) To: H.-J. Heitländer; +Cc: Stephen Berman, gnu emacs On Thu, 16 Mar 2023 at 20:17, H.-J. Heitländer <Heiner.Heitlaender@posteo.de> wrote: > kill buffer up to the top epub > > reopen epub > > open epub subfile (...html) > > C-x RET r ... utf-8 > > in minibufer: Revert buffer from file xxx.html? (y or n) > > Answer: y > > Minibuffer: Cannot revert noexistent file xxx.html You keep mentioning “editing epub”. Are you even sure it’s supposed to work? An EPUB file is a zip archive, typically containing XHTML pages and some metadata. Emacs covers some basic scenarios where you can browse the archive, visit files inside, even edit and save them (and they get re-compressed and updated in the archive). Reverting, on the other hand, does not work, probably because of the way archive-mode is implemented. So when it picks the wrong encoding, you cannot fix it by reverting. You could probably achieve better results if you first extract the contents of the EPUB archive into a real directory on your file system, then edit files there. If necessary, re-pack the modified files. I see ‘archive--extract-file’ initially sets the coding system to ‘no-conversion’, possibly because it needs that for decompression. It is supposed to re-decide on a coding system later in ‘archive-set-buffer-as-visiting-file’, but for some reason it keeps ‘no-conversion’ in your case. ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 15:23 ` Yuri Khan @ 2023-03-16 16:54 ` H.-J. Heitländer 2023-03-16 18:58 ` Stefan Monnier via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 37+ messages in thread From: H.-J. Heitländer @ 2023-03-16 16:54 UTC (permalink / raw) To: Yuri Khan; +Cc: gnu emacs Hi Yuri, yes I keep mentioning "editing EPUB" because a) that's my primary use case at the moment (in combination with "calibre") and b) it worked some time ago. (emacs 29.5 and earlier as far as I remember) Even in this buggy scenario it is much more comfortable for me to handle EPUBs this way than doing it by extracting the zip file and rezipping it. Especially as I lack an "idiot-safe" workflow for unzipping / rezipping. So I shall live with this situation because I can't correct it. | I see ‘archive--extract-file’ initially sets the coding system to | ‘no-conversion’, possibly because it needs that for decompression. It | is supposed to re-decide on a coding system later in | ‘archive-set-buffer-as-visiting-file’, but for some reason it keeps | ‘no-conversion’ in your case. There seems to exist a bug in the migration path somewhere from version 29 to 30. Where do I address the bug report; as I am definetely too dumb for debugging it myself? Cheers and thanks for your patience Heiner Am 16.03.23 um 16:23 schrieb Yuri Khan: > On Thu, 16 Mar 2023 at 20:17, H.-J. Heitländer > <Heiner.Heitlaender@posteo.de> wrote: > >> kill buffer up to the top epub >> >> reopen epub >> >> open epub subfile (...html) >> >> C-x RET r ... utf-8 >> >> in minibufer: Revert buffer from file xxx.html? (y or n) >> >> Answer: y >> >> Minibuffer: Cannot revert noexistent file xxx.html > You keep mentioning “editing epub”. Are you even sure it’s supposed to work? > > An EPUB file is a zip archive, typically containing XHTML pages and > some metadata. Emacs covers some basic scenarios where you can browse > the archive, visit files inside, even edit and save them (and they get > re-compressed and updated in the archive). > > Reverting, on the other hand, does not work, probably because of the > way archive-mode is implemented. So when it picks the wrong encoding, > you cannot fix it by reverting. > > You could probably achieve better results if you first extract the > contents of the EPUB archive into a real directory on your file > system, then edit files there. If necessary, re-pack the modified > files. > > I see ‘archive--extract-file’ initially sets the coding system to > ‘no-conversion’, possibly because it needs that for decompression. It > is supposed to re-decide on a coding system later in > ‘archive-set-buffer-as-visiting-file’, but for some reason it keeps > ‘no-conversion’ in your case. > ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub 2023-03-16 16:54 ` H.-J. Heitländer @ 2023-03-16 18:58 ` Stefan Monnier via Users list for the GNU Emacs text editor 2023-03-20 21:50 ` emacs 30.5.0 editing epub - finishing remark H.-J. Heitländer 0 siblings, 1 reply; 37+ messages in thread From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2023-03-16 18:58 UTC (permalink / raw) To: help-gnu-emacs H.-J. Heitländer [2023-03-16 16:54:03] wrote: > Where do I address the bug report; Help => How to Report a Bug Stefan ^ permalink raw reply [flat|nested] 37+ messages in thread
* Re: emacs 30.5.0 editing epub - finishing remark 2023-03-16 18:58 ` Stefan Monnier via Users list for the GNU Emacs text editor @ 2023-03-20 21:50 ` H.-J. Heitländer 0 siblings, 0 replies; 37+ messages in thread From: H.-J. Heitländer @ 2023-03-20 21:50 UTC (permalink / raw) To: help-gnu-emacs 1) debug report has been sent 2) Michael has developed a patch which was near to perfection. With minor change it fitted (doc-view version with different LOC) 3) Problem fixed Thanks to everyone Heiner Am 16.03.23 um 19:58 schrieb Stefan Monnier via Users list for the GNU Emacs text editor: > H.-J. Heitländer [2023-03-16 16:54:03] wrote: >> Where do I address the bug report; > Help => How to Report a Bug > > > Stefan > > ^ permalink raw reply [flat|nested] 37+ messages in thread
end of thread, other threads:[~2023-03-28 11:28 UTC | newest] Thread overview: 37+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-03-15 18:35 emacs 30.5.0 editing epub H.-J. Heitländer 2023-03-16 5:05 ` Michael Heerdegen 2023-03-16 6:57 ` H.-J. Heitländer 2023-03-17 0:44 ` Michael Heerdegen 2023-03-17 1:13 ` Michael Heerdegen 2023-03-19 21:23 ` editing a PDF [Re: emacs 30.5.0 editing epub] gebser 2023-03-19 23:59 ` Michael Heerdegen 2023-03-20 7:15 ` gebser 2023-03-21 0:31 ` Michael Heerdegen 2023-03-21 6:28 ` Yuri Khan 2023-03-21 6:38 ` Emanuel Berg 2023-03-22 16:32 ` Yuri Khan 2023-03-22 18:48 ` Bob Newell 2023-03-23 9:36 ` Jean Louis 2023-03-23 23:00 ` Bob Newell 2023-03-23 9:13 ` Jean Louis 2023-03-23 10:37 ` Michael Heerdegen 2023-03-23 20:13 ` Emanuel Berg 2023-03-23 20:07 ` Emanuel Berg 2023-03-21 11:51 ` Ulrich Deiters 2023-03-21 21:57 ` gebser 2023-03-21 22:55 ` Ulrich Deiters 2023-03-22 1:56 ` Michael Heerdegen 2023-03-22 8:26 ` FOSS replacement for PDF [Re: editing a PDF] gebser 2023-03-22 9:18 ` Yuri Khan 2023-03-23 9:21 ` Jean Louis 2023-03-23 9:49 ` Yuri Khan 2023-03-23 10:53 ` Gregory Heytings 2023-03-28 11:28 ` editing a PDF [Re: emacs 30.5.0 editing epub] Michael Heerdegen 2023-03-22 7:03 ` Jean Louis 2023-03-22 15:20 ` gebser 2023-03-16 9:22 ` emacs 30.5.0 editing epub Stephen Berman 2023-03-16 13:16 ` H.-J. Heitländer 2023-03-16 15:23 ` Yuri Khan 2023-03-16 16:54 ` H.-J. Heitländer 2023-03-16 18:58 ` Stefan Monnier via Users list for the GNU Emacs text editor 2023-03-20 21:50 ` emacs 30.5.0 editing epub - finishing remark H.-J. Heitländer
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.