iclems / iOS-htmltopdf

MIT License
305 stars 79 forks source link

Content is cropped if too wide #24

Closed koloritcm closed 10 years ago

koloritcm commented 10 years ago

If the content is too wide, the content is cropped. It works with the height as it will then span multiple pages.

A solution would be to scale the content to fit the available width. I've tried but I can't seem to succeed with this.

Do you know how to do it?

iclems commented 10 years ago

Hi there,

Any update? Do you have a viewport on the page? We could sizeToFit the page, but I'm not sure that's what everyone wants -- and you can do it through the viewport.

Would anyone else want that? We could make it an option

koloritcm commented 10 years ago

I haven't used viewport before. After a quick search it seems to be a meta-tag in the HTML, but I can't find a setting to make it size to fit?

What do you mean with sizeToFit? On which object can you do that? I've tried multiple combinations of settings to make it auto adjust, but without any success.

Any suggestions would be appreciated!

koloritcm commented 10 years ago

@iclems do you know if it is possible to find a way to adjust the pdf size to the content? or even better adjust the zoom of the content to fit on the current page size? I guess the latter should be the default as no one should want to crop the content in any way? thanks!

iclems commented 10 years ago

The following viewport tag should do exactly that: <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">

I can understand that a sizeToFit property would be useful for people who can't change the HTML, but this should be pretty rare. Tell me how this works for you!

koloritcm commented 10 years ago

@iclems I've tried the meta-tag you provided but there is no difference at all, the content is still cropped. how does the meta tag correlate with the PDF page size I write when initializing the htmltopdf object? I've also tried different page sizes with no success. it's annoying that I can't find a solution to this, probably because I don't have a deep understanding enough of the underlying mechanics when printing. do you have any other idea how to do it?