rebook icon indicating copy to clipboard operation
rebook copied to clipboard

-cbox definition

Open R-e-d-J opened this issue 3 years ago • 2 comments

When I'm choosing the margins in "Crop Margins (in)" like

Left : 1.00
Right : 1.50
Top : 3.0
Bottom : 0.1

the generated command line looks like (let's say the problem with the space is not there - https://github.com/pwang7/rebook/issues/5)

-mode def -ws 0.200 -wrap+ -rt 0 -cbox 1.00in,3.00in,1.50in,0.10in -dev k2 -a- -ui- -x

But, the result is not what I expect… So I check the K2pdfopt documentation about the crobox and I see that the author use the notion of "width" and "height", not "top" and "bottom" (https://willus.com/k2pdfopt/help/options.shtml). May be I misunderstand something, may be in your python code you subtract the top and the bottom from the with and height respectively or may be I misuse the top and bottom parameters, but until now it doesn't work for me...

Can you help me ?

R-e-d-J avatar Jul 27 '21 12:07 R-e-d-J

To be in accordance with the documentation of k2pdfopt, can I suggest you to modify the labels and the order of the fields "Crop Margins (in)" :

leftMarginTextLabel = Label(paraFrame, text='Left Margin')
leftMarginTextLabel.grid(
    column=0,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

leftMarginSpinBox = Spinbox(
    paraFrame,
    from_=0,
    to=100,
    increment=0.01,
    state='readonly',
    textvariable=strvarLeftMargin,
    command=on_command_and_validate_crop_margin_cb,
)
leftMarginSpinBox.grid(
    column=1,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

para_frame_row_num += 1

topMarginTextLabel = Label(paraFrame, text='Top Margin')
topMarginTextLabel.grid(
    column=0,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)
topMarginSpinBox = Spinbox(
    paraFrame,
    from_=0,
    to=100,
    increment=0.01,
    state='readonly',
    textvariable=strvarTopMargin,
    command=on_command_and_validate_crop_margin_cb,
)
topMarginSpinBox.grid(
    column=1,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

para_frame_row_num += 1

rightMarginTextLabel = Label(
    paraFrame,
    text='Width',
)
rightMarginTextLabel.grid(
    column=0,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)
rightMarginSpinBox = Spinbox(
    paraFrame,
    from_=0,
    to=100,
    increment=0.01,
    state='readonly',
    textvariable=strvarRightMargin,
    command=on_command_and_validate_crop_margin_cb,
)
rightMarginSpinBox.grid(
    column=1,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

para_frame_row_num += 1

bottomMarginTextLabel = Label(paraFrame, text='Height')
bottomMarginTextLabel.grid(
    column=0,
    row=para_frame_row_num,
    sticky=N+W,
    pady=0,
    padx=5,
)

bottomMarginSpinBox = Spinbox(
    paraFrame,
    from_=0,
    to=100,
    increment=0.01,
    state='readonly',
    textvariable=strvarBottomMargin,
    command=on_command_and_validate_crop_margin_cb,
)

R-e-d-J avatar Jul 27 '21 18:07 R-e-d-J

I investigate more on this topic and it seems that you are confusing between cropbox and margin:

  • margin: https://willus.com/k2pdfopt/help/borders.shtml
  • cropbox: https://willus.com/k2pdfopt/help/options.shtml (looking for <cropbox>)

Cropbox using left, top, width and height param and generating "-cbox …" command line option. Margin using left, top, right and bottom param and generating -ml, -mr, -mb, and -mt command line option.

R-e-d-J avatar Aug 24 '21 09:08 R-e-d-J