Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf size #3

Open
jaan143 opened this issue Dec 19, 2022 · 8 comments
Open

pdf size #3

jaan143 opened this issue Dec 19, 2022 · 8 comments
Labels
enhancement New feature or request

Comments

@jaan143
Copy link

jaan143 commented Dec 19, 2022

hello
can i add code for pdf size A4 or letter size of pages ?
if it is possible then can you explain me code and line where i can add
also need margin from top and bottom in pages
Thanks

@evmer
Copy link
Owner

evmer commented Dec 19, 2022

Hello, at the moment there's no option to set the page height/width or margins. The script downloads the books as they are displayed in the Scribd web reader. You can only edit the ZOOM variable to increase/decrease the size.

@evmer evmer added the enhancement New feature or request label Dec 19, 2022
@sfoot13
Copy link

sfoot13 commented Dec 20, 2022

@jaan143 @evmer For margins, I edited line109, margin: 0, replace "0" with 65 maybe, check if the margins are right for you or change the number.
LINE109:
style = f'@page {{ size: {widthZOOM}px {heightZOOM}px; margin: 0; }} @media print {{ html, body {{ height: {heightZOOM}px; width: {widthZOOM}px;}}}}'

@jaan143
Copy link
Author

jaan143 commented Dec 21, 2022

@sfoot13
can you explain me about add pdf page size if you can do code in this file ?
i mean A4 size or latter size of pdf pages ?
Thank you very much for your previous help. :)

@sfoot13
Copy link

sfoot13 commented Dec 27, 2022

@sfoot13 can you explain me about add pdf page size if you can do code in this file ? i mean A4 size or latter size of pdf pages ? Thank you very much for your previous help. :)

Is possible to set pdf size, you just need to edit line

Line 43: viewport={'width': 1200, 'height': 1600},

Line 83: render_page.set_viewport_size({"width": 1200, "height": 1600})

Replace width and height with a different value (in pixels), for letter size or A4, you need to convert the dimensions to pixels, example:
A4 size (210X297mm): width: 793 ; height: 1122.
Save the changes and check the output.
:D Have a good day!

@jaan143
Copy link
Author

jaan143 commented Dec 29, 2022

@sfoot13
thank you very much for help me
can you please help me on this other script also
https://github.com/evmer/perlego-downloader

book cover is too big than normal pages in pdf and also please can you help me to set page size of pdf in this script ?

@sfoot13
Copy link

sfoot13 commented Dec 31, 2022

@jaan143 Can't see an option to change page size, but maybe it can be added.
I was thinking about adding line 81-83 and see if it works, just an idea :)

to render the chapter pages and save them as pdf

render_page = context.new_page()
render_page.set_viewport_size({"width": 1200, "height": 1600})

Also, I talked you on telegram...

@jaan143
Copy link
Author

jaan143 commented Dec 31, 2022

@sfoot13
File "C:\Users\Hp\Downloads\Compressed\perlego-downloader-main_13\perlego-downloader-main\downloader.py", line 81
render_page = context.new_page()
^
IndentationError: unindent does not match any outer indentation level
PS C:\Users\Hp\Downloads\Compressed\perlego-downloader-main_13\perlego-downloader-main> python downloader.py
File "C:\Users\Hp\Downloads\Compressed\perlego-downloader-main_13\perlego-downloader-main\downloader.py", line 82
render_page = context.new_page()
^
IndentationError: unindent does not match any outer indentation level
PS C:\Users\Hp\Downloads\Compressed\perlego-downloader-main_13\perlego-downloader-main>

@sfoot13
Copy link

sfoot13 commented Dec 31, 2022

@jaan143 Then it needs more work.
Maybe @evmer could add the option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants