Domanda

I'm using django-xhtml2pdf to generate a report. I'm using the first page as a cover sheet, followed by the table of contents, using the <pdf:toc /> tag.

I would like to discount the first page, so the page-numbering in the Table of Contents starts at 1 instead of 2.

Is this possible?

È stato utile?

Soluzione

Reading through the xhtml2pdf code, there isn't support for offsetting the page numbering. There's an old discussion about a pisa fork trying to implement support for this, but I'm not sure how far it got.

An awkward but straight-forward solution is to generate your cover sheet and the rest of the document as separate PDFs and then merge them. That way the page numbering will exclude the cover sheet. pyPDF merging and displaying as httpresponse through django has an accepted answer that will let you do just that.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top