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

Need a single PDF with three copies of same document with Copy 1, Copy 2 and Copy 3 #1132

Closed
POOJASAINIAQUEVIX opened this issue Jun 4, 2020 · 2 comments

Comments

@POOJASAINIAQUEVIX
Copy link

POOJASAINIAQUEVIX commented Jun 4, 2020

Hello,

Need a single PDF with three copies of same document with Copy 1, Copy 2 and Copy 3.

Please check the code for PDF:
applied counter-reset on page.

<style> @page { counter-reset:page 1; counter-reset:pages 1; } @page { @bottom-right{ content: "Page " counter(page) " of " counter(pages); } } </style>

currently i am getting "Page 1 of 3" instead of "page 1 of 1" for each copy
I need :
first copy having:
page 1 of 1

second copy having:
page 1 of 1

for third having:
page 1 of 1

When i applied "counter-reset:pages 1" for total pages, it is not working.
How would it possible to set counter-reset on Total Pages?

Thank You !!

@Tontyna
Copy link
Contributor

Tontyna commented Jun 10, 2020

The predefined pages counter cannot be modified. That's what the spec says:

Additionally, a counter named pages is automatically created by the UA. Its value is always the total number of pages in the document. (In continuous media this is always 1.) The value of pages cannot be manipulated: while counter-reset and counter-increment statements that set it are valid, they have no effect.

Something along the lines of

myhtml = HTML(filename=input_filename)
doc = myhtml.render()
three_copies_doc = doc.copy(doc.pages + doc.pages + doc.pages)
three_copies_doc.write_pdf(target=output_filename)

should produce a PDF with three exact copies. Same page of pages in each copy.

But there are issues with disappearing elements, see #1081 (comment) for a collection of things that will vanish.

Until the disappearance bug is solved you could try to counter-reset your own totalpages counter.

@liZe
Copy link
Member

liZe commented Jun 22, 2020

@POOJASAINIAQUEVIX Does the solution above fix your problem?

@liZe liZe closed this as completed Oct 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants