| <<<Back 1 day (to 2017/09/05) | 20170906 |
jj00 | Hi all! | 07:42.05 |
| I don't know if someone can help me with command line mutool. I would like to scale the contents of a page with a script .js using "mutool run script.js" (as seen here https://mupdf.com/docs/manual-mutool-run.html), I've tried it in many ways but I can't get it. Can someone help me? | 07:42.30 |
kens | I'm afraid you're a little early, the developer who can help with that isn't likely to be online for another hour or two. | 07:43.16 |
| Either stick around or read the logs later, I'm sure that he will reply. | 07:43.31 |
| It might help if you could post a URL to the file you are using, and the script you're trying to use, and a description of what you are trying to achieve. | 07:44.06 |
jj00 | Thank you very much. I'm going to make a basic example and put it here ;) | 07:45.43 |
| For the developer, I have upload what I want to get here: https://drive.google.com/open?id=0By7TkqYrX87USWRHc3cxTkFGTU0 | 08:22.10 |
| Thanks in advance | 08:22.16 |
kens | 8 | 09:07.39 |
| tor8 there's a question about Mutool in the logs | 09:08.09 |
| using js | 09:08.19 |
tor8 | jj00: so you essentially want to change the page size and have the content scaled to fit? | 09:10.57 |
kens | I guess maybe he's away | 09:11.55 |
jj00 | Sorry, I'm here now | 09:33.18 |
| I want only to scale the contents with the original page size | 09:33.55 |
tor8 | so that they extend outside the page? | 09:36.34 |
jj00 | No, in this case the content will be smaller tha page size | 09:37.49 |
| In my google drive I hace an example of what I want to get | 09:38.18 |
tor8 | jj00: https://pastebin.com/raw/akdE4pnr something like that maybe | 09:53.11 |
jj00 | Mmmm It's not exactly what I need, but very near ;). Because this solution change the dimensions of page from 210x297 to 105x148. But looking at the code I tried removing Mediabox scale and It is most what I whant to | 10:07.37 |
| I didn't know the property cropbox, I think this is the trick | 10:08.54 |
| I'm going to try with your code, It's perfect for me. Thank you very much!!! :)))) | 10:09.46 |
tor8 | the cropbox is an alternative fallback property, which is used if mediabox is not available | 10:10.10 |
| so if you don't want to change the page size, remove the code that changes both mediabox and cropbox | 10:10.30 |
jj00 | Yes, that make what I want. The only thing is that it make contents align to bottom left, I would like it to be centered in page | 10:16.45 |
| But I'm going to play with it and see if I can get it | 10:17.10 |
tor8 | j00: then you need to change the last two 0's before the 'cm' to be a translation offset | 10:17.20 |
| the difference in page width divided by two | 10:17.32 |
| "sx 0 0 sy tx ty cm" is the string you want to make, where sx and sy is the scaling and tx and ty is the translation to center | 10:18.06 |
jj00 | ok, in this sentence I suppose: buf.write(scale, 0, 0, scale, 0, 0, 'cm'); | 10:18.49 |
tor8 | yes. | 10:19.20 |
| you can use the page.MediaBox to get the page width | 10:19.39 |
jj00 | something like: buf.write(scale, 0, 0, scale, (originalWidth-scaledWidth)/2, (originalHeight-scaledHeight)/2, 'cm'); | 10:20.12 |
tor8 | page.MediaBox[2] - page.MediaBox[0] is the width | 10:20.16 |
| and [3] - [1] is the height | 10:20.21 |
| yup. you got it. | 10:20.45 |
jj00 | Yeah! Wow I come here looking for help and you make it all for me :) | 10:22.06 |
| Thank you very much again!!! | 10:22.18 |
| Forward 1 day (to 2017/09/07)>>> | |