mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix delete_pages()
This commit is contained in:
parent
696afc4410
commit
bea63dc6c4
@ -239,12 +239,11 @@ PDFDoc_image_count(PDFDoc *self, PyObject *args) {
|
|||||||
// delete_page() {{{
|
// delete_page() {{{
|
||||||
static PyObject *
|
static PyObject *
|
||||||
PDFDoc_delete_pages(PDFDoc *self, PyObject *args) {
|
PDFDoc_delete_pages(PDFDoc *self, PyObject *args) {
|
||||||
int page = 0, count = 1;
|
unsigned int page, count = 1;
|
||||||
if (PyArg_ParseTuple(args, "i|i", &page, &count)) {
|
if (PyArg_ParseTuple(args, "I|I", &page, &count)) {
|
||||||
try {
|
try {
|
||||||
while (count > 0) {
|
auto &pages = self->doc->GetPages();
|
||||||
self->doc->GetPages().RemovePageAt(page - 1);
|
while (count-- > 0) pages.RemovePageAt(page - 1);
|
||||||
}
|
|
||||||
} catch(const PdfError & err) {
|
} catch(const PdfError & err) {
|
||||||
podofo_set_exception(err);
|
podofo_set_exception(err);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user