View Single Post
Old 02-11-2024, 04:50 PM   #2050
willus
Fuzzball, the purple cat
willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.willus ought to be getting tired of karma fortunes by now.
 
willus's Avatar
 
Posts: 1,273
Karma: 11087488
Join Date: Jun 2011
Location: California
Device: iPad
Bummer--I had responded to all of your questions and hit "Submit Reply" and mobileread decided to log me out and lose all my changes. Ugh. I'll start again...

Quote:
Originally Posted by capink View Post
I implemented a additional options box similar to the one in k2pdfopt Windows GUI. I want to give the options there precedence over any GUI setting, as this box supports calibre template language, which means users can customize the options per book inside calibre. In my testing it seems that whenever two options are in conflict, the last one wins. Is that reliable way to go about things? or are there situations where this assumption might not hold?
Yes, that should work. K2pdfopt processes command-line options left to right so the ones at the end should over-write the ones from before.

Quote:
Originally Posted by capink View Post
In the Windows GUI, there is an option called "Fast Preview". On examination I saw it associated with the -rt option. The help page mentions that this option controls the degrees of rotation of the source page. I can't see how this can make a "Fast Preview", so I opted to leave it out until I understand more about it.
When k2pdfopt first processes a source PDF, it tries to figure out how it is generally oriented, so it looks at 10 pages within the document (evenly spaced throughout) and for each page does analysis to see if it should rotate the page 90 degrees to get the text oriented horizontally. This takes some time, so using the -rt option in the right way tells it not to do this, hence speeding up the preview.

Quote:
Originally Posted by capink View Post
I cannot see an option to control where to put the output for the -bmp option. Since the plugin also works inside the calibre, it is imperative to not give any binary direct access to files instead the library. It is not a big deal as I circumvented this by copying the source file to temporary location before previewing. Just wondering if I missed something here?
You did not miss anything, and you came up with a good solution, but it would be easy to add an option to specify the file name of the -bmp output.

Quote:
Originally Posted by capink View Post
Is there a way to validate any supplied args inside the optional arguments. Like running the command on a simulation basis to make it spit out error codes and messages without actually doing the conversion.
No. I'm not even sure how I would do that.

Quote:
Originally Posted by capink View Post
I opted for now to leave out the OCR option (users can still it manually in the additional options box). The reason is that it has many languages and I am not sure if they are going to be available on every system where k2pdfopt is installed, and what kind of verification I might do to ensure the user settings can be honored. My question is does output of -ocrlang ? differ for system to system? or does the fact that k2pdfopt is installed ensures all these languages are available on all systems?
The output from -ocrlang will vary depending on the environment, e.g. what language training files have been downloaded. Note that k2pdfopt will try to download any needed training file per my command-line option help on -ocrlang.

Quote:
Originally Posted by capink View Post
The one option I wanted to include in the GUI and couldn't is the -ci option to reinsert the cover of the source pdf into the optimized version. Problem is it always returns the following error:
I was able to reproduce this issue. I'll look into it. I have not used that option in a long time.

Quote:
Originally Posted by capink View Post
I am having problems with the preview option, when I run the following command on the book linked above. Instead of previewing page 31 it actually previews page 19. How to rectify this? Edit: I am currently getting around this by extracting the target preview page to a separate pdf file using the -mode copy and then running -bmp 1 on the extracted pdf.
The page number specifies the output file page number, not the source file page number. But it looks like you've come up with a good work-around.

Quote:
Originally Posted by capink View Post
Also would like to know if possible to use k2pdfopt to get information about pdf and djvu files. I am specially interested in page count. I can see an info button in the Windows screenshots and I suppose that's what they do.
Use the -i option.
willus is offline   Reply With Quote