View Single Post
Old 02-02-2024, 06:53 AM   #2048
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,092
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Hi, I developed a calibre K2pdfopt plugin that uses k2pdfopt to optimize PDFs inside calibre. It can also be used as standalone—It still need calibre to be installed—GUI for Linux and OSX. It can work on Windows too, but the main program already has a GUI there. For more details you can see this post.

I have some questions to I hope you can provide the answers for:
  • 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?
  • 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.
  • 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?
  • 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.
  • 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 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:
    Code:
    Segmentation fault (core dumped)
    The error code for the error is 139. Here is a link for a book if you are interested in examining what happens.
    Note to moderators: The book linked to is legally available from hindawy.org based on an agreement with copyright holders.
  • I am having problems with the preview option, when I run the following command on the book linked above:
    Code:
    k2pdfopt -x -ui- -bmp 31 harafeesh.pdf
    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.
  • 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.

Last but not least, thanks for the efforts and the great program.
Attached Thumbnails
Click image for larger version

Name:	calibre_linux.png
Views:	61
Size:	98.8 KB
ID:	206162   Click image for larger version

Name:	no_calibre.png
Views:	63
Size:	106.9 KB
ID:	206163   Click image for larger version

Name:	no_calibre_progress.png
Views:	66
Size:	123.7 KB
ID:	206164   Click image for larger version

Name:	no_calibre_details.png
Views:	69
Size:	135.2 KB
ID:	206165  

Last edited by capink; 02-05-2024 at 09:31 AM.
capink is offline   Reply With Quote