Feature request: fit-width-every, fit-height-every #55

Closed
Simanas opened this Issue Dec 7, 2012 · 16 comments

Comments

Projects
None yet
3 participants

Simanas commented Dec 7, 2012

Hello!
First of all, thank you for your efforts in developing this brilliant peace of software. You have done amazing work here! Therefore I am developing a web project based on this converter and will definitely donate you if it will turn out to be successful :)

But as for web project I need to be able to convert pdf documents to html while fitting every page of pdf to the same width eg. 960px. Could you please add such an option to your program?

Collaborator

iapain commented Dec 7, 2012

The obvious work around for this is to convert page by page and use --fit-width and --fit-height or you can crop your PDF file before doing conversion.

Simanas commented Dec 7, 2012

This is a very decent suggestion, but then if you want to compile 10 pages in to one layout you have to make conversion again to get css file for those 10 pages...

Owner

coolwanglu commented Dec 7, 2012

Can you please describe a proper use case for this?

Simanas commented Dec 8, 2012

Say we have a pdf document in which the first page is 30 cm wide, all other pages are only 15 cm wide. This is a common case when some of the pages in pdf documment are flipped in 90 degrees.
We want to convert this document in to one html document where every page is exactly 960px wide. Now if I we set --fit-width to 960 (typical web page width) only pages that are 30cm wide will be 960px and the rest ones will be 430px wide. So --fit-width-every feature should fit every page in pdf document to desired width when conversion performed.
I have looked a little bit to the code and noticed that you are calculating zoom factor for entire document. In this case zoom factor should be calculated for every page to fit desired width/height.

Owner

coolwanglu commented Dec 9, 2012

"Making every page exactly 960px wide, while they have different widths"
does not make sense to me. I don't see such features in other converters or
PDF viewers -- please tell me if there are any.

You can hack the code easily, because it's possible to set different zoom
factors for the pages.
Bit this is more like a UI feature, you can easily achieve this by
modifying the js scripts.

On Sun, Dec 9, 2012 at 3:57 AM, Simanas notifications@github.com wrote:

Say we have a pdf document in which the first page is 30 cm wide, all
other pages are only 15 cm wide. This is a common case when some of the
pages in pdf documment are flipped in 90 degrees.
We want to convert this document in to one html document where every page
is exactly 960px wide. Now if I we set --fit-width to 960 (typical web page
width) only pages that are 30cm wide will be 960px and the rest ones will
be 430px wide. So --fit-width-every feature should fit every page in pdf
document to desired width when conversion performed.
I have looked a little bit to the code and noticed that you are
calculating zoom factor for entire document. In this case zoom factor
should be calculated for every page to fit desired width/height.


Reply to this email directly or view it on GitHubhttps://github.com/coolwanglu/pdf2htmlEX/issues/55#issuecomment-11162816.

Simanas commented Dec 9, 2012

In my personal opinion not to do something, just because others don't do it, blocks you from developing better software. Although yet this best pdf 2 html converter in the WORLD! :)

Why to modify html with js on the fly if you are 100% sure that you want all pages to be 960px wide. It just overhead for the browsers.

Ok I will hack the code by my self.

Owner

coolwanglu commented Dec 9, 2012

What I meant was that it might not be a common feature which is worth to be
maintained.
If all pages are 960px wide, why it is not so in the PDF. This part is more
like from a PDF manipulating tool, but from not a converter.

On Sun, Dec 9, 2012 at 4:07 PM, Simanas notifications@github.com wrote:

In my personal opinion not to do something, just because others don't do
it, blocks you from developing better software. Although yet this best pdf
2 html converter in the WORLD! :)

Why to modify html with js on the fly if you are 100% sure that you want
all pages to be 960px wide. It just overhead for the browsers.

Ok I will hack the code by my self.


Reply to this email directly or view it on GitHubhttps://github.com/coolwanglu/pdf2htmlEX/issues/55#issuecomment-11168802.

Simanas commented Dec 9, 2012

Anyway you are the boss here! :) But I think this is a common situation, since output is html and input is a pdf. As we know pdf is for maintaining original look of the content in a fixed format/layout, while html is for the content it self to deliver it online. So here we have a conceptual collision. You have done a remarkable job by implementing precise conversion, but to make this converter even more sophisticated I would say it is about the time to start improving its abilities to convert from one concept to the other. Don't you think so? :)

Owner

coolwanglu commented Dec 9, 2012

@Simanas Thanks for your explanation, I'm aware of that, but the problem here is I'm trying to avoid too-many-parameters. PDF and HTML are all used in wide variant situations, people have different needs. Just thinking about recognizing and showing messages about the collision of --fit-width and --fit-width-every is quite annoying to me.

So here is what I do:

  • I've tagged this issue 'need vote', so hope that people support this parameter would leave comments here, to convince me that it is necessary. OR
  • You may hack it yourself and issue a pull request, and I will review the patch. Just make sure it won't confuse the users (with all other parameters)
Collaborator

iapain commented Dec 9, 2012

👎 I see a very easy workaround to this problem over new option in codebase.

Simanas commented Dec 9, 2012

I agree the name is annoying to me to ... how about just one parameter --zoom-every: [1/0] ?
And great idea to make a voting :) So my vote you alredy know 👍

Owner

coolwanglu commented Dec 9, 2012

It's not about the names of the parameters, but values. What should be done
when people specify both parameters, and even different values?

On Mon, Dec 10, 2012 at 4:31 AM, Simanas notifications@github.com wrote:

I agree the name is annoying to me to ... how about just one parameter
--zoom-every: [1/0] ?
And great idea to make a voting :) So my vote you alredy know [image:
👍]


Reply to this email directly or view it on GitHubhttps://github.com/coolwanglu/pdf2htmlEX/issues/55#issuecomment-11175516.

Simanas commented Dec 9, 2012

This is why I have suggested parameter --zoom-every. If set to 1 it would use --fit-width/height --zoom to zoom EVERY page to desired zoom level, if --zoom-every is not set or set to 0 it would perform as usual.

Owner

coolwanglu commented Dec 10, 2012

What's the difference of --zoom when --zoom-every is set to 0 and 1?

Anyway I'll need to make sure that this parameter is something worthy.

Simanas commented Dec 10, 2012

Hmmm... since it should affect only --fit-width/height parameters, we may name it --fit-every instead of --zoom-every and it would work only if --fit-width/height is presented.

Owner

coolwanglu commented Dec 16, 2012

Closing it as we have #57

coolwanglu closed this Dec 16, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment