| <<<Back 1 day (to 2020/04/28) | Fwd 1 day (to 2020/04/30)>>> | 20200429 |
kiwi_86 | Hello, I'd like to use mutool to spit a PDF file into pages, where one page = one PDF file. The following don't work: | 09:28.22 |
| mutool draw -o %d.pdf input.pdf | 09:28.24 |
| mutool draw -F pdf -o %d.pdf input.pdf | 09:28.33 |
| Is there to get mutool to do this? Thank you. | 09:28.42 |
kens | In what way 'deosn't work' ? | 09:28.53 |
kiwi_86 | It only creates a single, bigger PDF with every other page black | 09:29.12 |
kens | OK so what version of MuPDF, on what operating system, is there somewhere someone can download the file to try it out ? | 09:29.45 |
kiwi_86 | 1.16.0 on Windows 7 32 bits | 09:30.00 |
| I'm uploading the file | 09:30.15 |
kens | OK then we cna look | 09:30.23 |
kiwi_86 | https://we.tl/t-g2jCkK0UX0 | 09:31.49 |
kens | Righto one moment | 09:31.55 |
| Good grief 449 pages | 09:32.48 |
kiwi_86 | Sorry | 09:33.33 |
kens | Well its more than I expected :-) Give me a minute, I just built fresh from source | 09:33.52 |
| Hmm, yes, I get a file with %d in the filename, that's less than ideal | 09:34.48 |
kiwi_86 | It's the file I'm experimenting with, so it's better I send that one instead of another that might not show the problem. | 09:34.49 |
kens | Absolutely the right thing to do yes | 09:35.00 |
| Let me see if I can summon someone better equipped for this | 09:35.39 |
ator | kiwi_86: for N in $(seq $(mutool show input.pdf Root.Pages.Count); do mutool clean -g input.pdf page$N.pdf $N; done | 09:39.02 |
| kiwi_86: for N in $(seq $(mutool show input.pdf Root.Pages.Count)); do mutool clean -g input.pdf page$N.pdf $N; done | 09:39.13 |
kens | ator thaniks :-) | 09:39.16 |
ator | you want to use mutool clean to split out pages, not mutool draw | 09:39.29 |
kens | Umm is that bash ? | 09:39.32 |
| Ah | 09:39.39 |
ator | mutool draw reinterprets the page (like pdfwrite in ghostscript), mutool clean just copies the actual page data untouched | 09:40.03 |
| oh yeah, but you've got bash with msys/cygwin on windows :) | 09:40.37 |
kens | Should be possible in Windows scripting though | 09:40.55 |
kiwi_86 | Thanks much. I have MSYS instead so I can give it a try. Thanks much for the infos on draw/clean. | 09:41.08 |
kens | for %s in (....) do mutool.... | 09:41.15 |
ator | mutool draw -o pdf isn't set up to do multiple files, it always just outputs to one file | 09:41.34 |
kiwi_86 | Good to know. You might want to update the doc. | 09:41.53 |
kens | Hmm, that's not what the usage message implies | 09:41.54 |
ator | mutool draw is robin's baby, the code is too hairy for me to straighten out :) | 09:42.17 |
kens | LOL | 09:42.22 |
ator | I've gotten myself into trouble with the %d handling in there before... not going there again voluntarily :) | 09:42.43 |
kens | Fair enough, it was surprising to me though, so I bet it is to other people too, I was going by the usage meessage | 09:43.15 |
ator | yes. I've been wanting it to be able to handle multiple pages too, but the need hasn't been pressing enough to push me into doing something about it. | 09:43.47 |
kens | Fair enough, thanks for answering anyway :-) | 09:44.02 |
kiwi_86 | Thanks again. | 09:44.09 |
ator | I'll stick a note in my TODO file | 09:45.05 |
kiwi_86 | Hello, I'm back :-) | 13:21.18 |
| mutool builds a superb HTML file from a PDF file, but 1) the file is way too big for my e-reader to read in one chunk, and 2) pictures are | 13:21.21 |
| embedded as base64. FWIW, I used this: "mutool draw -F html -o out.html in.pdf" | 13:21.21 |
| Questions: | 13:21.24 |
| 1. Should I use clean/convert/draw to turn a big PDF into one page=one HTML file? | 13:21.26 |
| 2. As a way to build lighter HTML files, is there a way for mutool to extract the pictures as PNG/JPG with links within the HTML files? | 13:21.28 |
| 3. Can mutool include Previous/Next links at the bottom of each HTML file, as poor man's navigation tool? | 13:21.30 |
| Thank you. | 13:21.34 |
kens | kiwi_86: we've had the question about external images and embedded links before. Currently there is no way to do that. Clerly the code could be extended | 13:22.07 |
| The other questions I can't answer I'm afraid :-( | 13:22.26 |
| Maybe ator could help | 13:22.30 |
ator | kiwi_86: you can ask it to not create images, but not save them externally (as that gets into a whole other dimension of complexities with paths and possibly over-writing files, etc) | 13:24.33 |
| and the same issue with mutool draw to split pdfs, there is currently no way to ask it to create one file per page. you'll have to manually loop and call mutool for each page you want to convert. | 13:25.34 |
kiwi_86 | What is the right tool to split a big PDF into one page/one file HTML? Convert, draw, or clean? | 13:26.14 |
ator | you could do most of these things by writing javascript scripts for use with 'mutool run' | 13:26.21 |
| mutool clean reads and writes PDF files | 13:26.45 |
| mutool draw reads any file we can read, and writes out in most formats, but it does it by interpreting the graphics and creating the output file from scratch | 13:27.15 |
| any extra PDF information like bookmarks and links are lost in the process | 13:27.27 |
| mutool convert has a simpler interface than "mutool draw", and also provides more detailed options to many of the output formats. mutool draw is primarily intended for bitmap output. | 13:28.05 |
| so both mutool draw and mutool convert do the same thing, but the interfaces are different | 13:28.46 |
kiwi_86 | I'll see what I can do with HTML files as output by mutool. Thank you. | 13:30.32 |
ator | kiwi_86: "mutool convert -O preserve-images=no -o out.html input.pdf 1" to convert page 1 to an HTML file without images | 13:35.19 |
kiwi_86 | Thanks! | 13:38.05 |
paulgardiner | It looks like appearance stream generation for combed text within text widgets is broken. | 15:45.14 |
kiwi_86 | Hello again, | 15:48.10 |
| When reading a PDF, my e-reader has a hard time displaying tables. | 15:48.13 |
| I'm thinking of 1) extracting those pages, 2) convert them from "text PDF" to "image PDF" (like taking a screenshot), and 3) remerging all | 15:48.16 |
| the pages into a single PDF. | 15:48.17 |
| It looks like both convert and draw can turn text into pictures. | 15:48.20 |
| 1. Which command do you recommend? | 15:48.22 |
| 2. For convenience, can mutool convert some pages directly without having to perform a a extract > convert > merge cycle? | 15:48.24 |
| Thank you. | 15:48.27 |
| My browser disconnected, and I can't see if there were any reply to my questions :-/ | 16:09.28 |
ator | kiwi_86: (for the logs) mutool convert -o temp.cbz input.pdf; mutool convert -o output.pdf temp.cbz | 16:34.35 |
vtorri | hello | 19:47.17 |
mubot | Welcome to #mupdf, the channel for MuPDF. If you have a question, please ask it, don't ask to ask it. Do be prepared to wait for a reply as devs will check the logs and reply when they come on line. | 19:47.17 |
vtorri | ator are there differences of compilation command of mupdf 1.17 compared to 1.16.1 ? | 19:48.19 |
ator | vtorri: that that I know, why? | 21:57.43 |
malc_ | this made no sense | 21:59.23 |
| one of the thats ought to be not | 21:59.43 |
ator | malc_: eh, yes. I'm obviously too tired to type coherent sentences :) | 22:09.53 |
malc_ | ator: :) | 22:10.27 |
| <<<Back 1 day (to 2020/04/28) | Forward 1 day (to 2020/04/30)>>> | |