wrong render of get_page()

Bug #181886 reported by Pablo Rodríguez
4
Affects Status Importance Assigned to Milestone
Poppler Python Bindings
Invalid
Undecided
Unassigned

Bug Description

Hi there,

I think I hit a bug in pypoppler-0.6.2 by tinkering with the demo-poppler.py.

With the following code:

        self.document = poppler.document_new_from_file (uri, None)
        self.page_selector = self.document.get_page(0)

        ...

        cr.rectangle(add_x, add_y, self.page_width, self.page_height)
        cr.fill()
        self.page_selector.render(cr)

cairo draws the rectangle fine, whichever values add_x and add_y might have. But poppler renders the page as their values would be 0, 0 in all cases. And I guess this is wrong.

I attach the complete script (that works) and an screenshot showing the issue.

Thanks for your excellent work,

Pablo

Revision history for this message
Pablo Rodríguez (ousia) wrote :

The PDF file is rendered on 0,0 while the cairo surface is centered horizontally.

Revision history for this message
Pablo Rodríguez (ousia) wrote :
Revision history for this message
Pablo Rodríguez (ousia) wrote :

The previous attachment is not the one I had to include. Sorry for the inconveniences.

Revision history for this message
Pablo Rodríguez (ousia) wrote :

Just in case anyone will read this, the bug is much easily reproducable than I have described here.

Replace line 87 of demo-poppler.py included in pypoppler-0.6.2 with the following one:

        cr.rectangle(300, 300, self.width, self.height)

And I'm afraid that the bug is clear (although I'm not sure whether this belongs to the script itself or to (py)poppler).

Thanks,

Pablo

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

Hi Pablo, thanks for the report.

I'm finally around to have a look at this bug.
Please report any bug you may find.

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

Hi Pablo,

I finally could have a look at this, while I see what you mean, this is not a bug, it's just the white rectangle being moved 300 by 300 while the PDF renders at 0, 0.
Or I didn't get what you mean?

Revision history for this message
Pablo Rodríguez (ousia) wrote :

Hi Gian Mario,

I'm afraid that the bug is caused by pypoppler. gtk-cairo-test (from poppler) works fine when changing the cairo rectangle origin.

Something should be wrong in the render_to_pixbuf method (since it src_x and src_y seems always set to 0), but what this might be is beyond my knowledge.

I hope it helps,

Pablo

Revision history for this message
Pablo Rodríguez (ousia) wrote :

Hi Gian Mario,

and how can I get the PDF also rendered at 300, 300?

Thanks for your help,

Pablo

Revision history for this message
Gian Mario Tagliaretti (gianmt) wrote :

add cr.translate(300, 300) before the rectangle, e.g.

cr.translate(300, 300)
cr.rectangle(0, 0, self.width, self.height)

Revision history for this message
Pablo Rodríguez (ousia) wrote :

Thanks, that was exactly what I needed.

I'm closing the report as invalid.

Sorry for the inconveniences and many thanks for your help,

Pablo

Changed in poppler-python:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.