wx.lib.pdfviewer - limitation with images?

Hi Werner,

···

On 22/03/2013 08:28, Werner wrote:

I can't figure out why in my app which is using wxPython 2.9.5.0.b20121231 this has an issue with showing the footer correctly.

I use it like this:

I am trying to reproduce your problem with the code you posted but having problems making a runnable example.

For example, what are sc.SizedFrame, self.GetContentsPane() and self.view?

--
Regards

David Hughes
Forestfield Software

Hi David,

pdfviewerissue.py (1.49 KB)

Cellarbook listing - portrait.pdf (67.1 KB)

···

On 22/03/2013 13:23, David Hughes wrote:

Hi Werner,

On 22/03/2013 08:28, Werner wrote:

I can't figure out why in my app which is using wxPython 2.9.5.0.b20121231 this has an issue with showing the footer correctly.

I use it like this:

I am trying to reproduce your problem with the code you posted but having problems making a runnable example.

For example, what are sc.SizedFrame, self.GetContentsPane() and self.view?

Attached is a running sample, similar to my code and it shows the problem. I am attaching also a sample pdf which I used for testing, just change the line 39 according to where you placed the pdf file.

Thanks for looking at this whenever you find a moment.

Werner

Thanks, that's helped me nail it down. Like most bugs, its obvious after you have found it :wink:

When calculating all the dimensions of the page images to be rendered, I adjust the inter-page gap so the top-of-page to top-of-next page distance is an integral number of scroll increments of the display window and the displayed page number changes cleanly. One of the basic elements of this calculation is the client size of the scrolling window. When the window is inside a sized control, the first time is is asked, it is reporting a size of 16 x 16, presumably because it hasn't been sized properly yet. This results in an inter-page gap of minus 90. Unfortunately I wasn't resetting the gap at the start of each new calculation so this value persisted even after the window was correctly sized.

As you have already submitted a patch to wx.lib.pdfviewer.viewer.py in wxPython-dev, I'm not sure what version it would be best to create another patch against, so could I ask you to alter the following two lines in your own set of changes, please:

in pdfviewer.__init__

change
         self.page_gap = 20 # nominal inter-page gap (points)
to
         self.nom_page_gap = 20 # nominal inter-page gap (points)

and in CalculateDimensions, near line 252

change
         self.Ypage = self.pageheight + self._page_gap
to
         self.Ypage = self.pageheight + self.nom_page_gap

···

On 22/03/2013 16:58, Werner wrote:

Attached is a running sample, similar to my code and it shows the problem. I am attaching also a sample pdf which I used for testing, just change the line 39 according to where you placed the pdf file.

--
Regards

David Hughes
Forestfield Software

Hi David,

···

On 23/03/2013 13:07, David Hughes wrote:

On 22/03/2013 16:58, Werner wrote:

Attached is a running sample, similar to my code and it shows the problem. I am attaching also a sample pdf which I used for testing, just change the line 39 according to where you placed the pdf file.

Thanks, that's helped me nail it down. Like most bugs, its obvious after you have found it :wink:

Works great - thanks.

I'll submit another patch to the dev list, so Robin only needs to apply one of them - if that is o.k. with you.

Werner

Hi Werner

···

On 23/03/2013 12:24, Werner wrote:

I'll submit another patch to the dev list, so Robin only needs to apply one of them - if that is o.k. with you.

That sounds the best idea.

David

Hi David and Robin,

Attached is the patch for pdfviewer.

- David's changes for the image not showing issue
- change USE_PRINTDIRECT to a Python property
- change SHOW_LOAD_PROGRESS to a Python property
- use pyPDF2 if present, otherwise pyPdf if neither is present raise

an import error

Will start to work on the Phoenix port over this weekend.

Werner

pdfviewer.patch (6.53 KB)

···

-------- Original Message --------

Subject:
Re: [wxPython-users] Re: wx.lib.pdfviewer - limitation
with images?
Date:
Thu, 21 Mar 2013 12:41:44 +0000
From:
David Hughes
Reply-To:
To:
dfh@forestfield.co.ukwxpython-users@googlegroups.comwxpython-users@googlegroups.com


On 21/03/2013 11:35, Werner wrote:
> Are you following the wxPython-dev list? I will send the patch to there,
Yes I follow it.
> Would also like to change "USE_PRINTDIRECT", i.e. allow to set it at > run time.
Sounds a sensible idea. I assume you would change the hard coded DIRECTIVE into an attribute and provide a getter/setter for it. Would any of the other directives benefit from being settable do you think? Could you consider providing a patch and include your conditional importing of pyPdf/pyPDF2 as well?
-- Regards
David Hughes
Forestfield Software
-- You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to .
For more options, visit .

wxpython-users+unsubscribe@googlegroups.comhttps://groups.google.com/groups/opt_out

Hi,

Updated patch, there was a spelling error in the progress property.

Werner

pdfviewer 2.patch (6.53 KB)

···

On 22/03/2013 09:18, Werner wrote:

Hi David and Robin,

Attached is the patch for pdfviewer.

- David's changes for the image not showing issue
- change USE_PRINTDIRECT to a Python property
- change SHOW_LOAD_PROGRESS to a Python property
- use pyPDF2 if present, otherwise pyPdf if neither is present raise an import error

Will start to work on the Phoenix port over this weekend.

Werner

-------- Original Message --------
Subject: Re: [wxPython-users] Re: wx.lib.pdfviewer - limitation with images?
Date: Thu, 21 Mar 2013 12:41:44 +0000
From: David Hughes <dfh@forestfield.co.uk>
Reply-To: wxpython-users@googlegroups.com
To: wxpython-users@googlegroups.com

On 21/03/2013 11:35, Werner wrote:
> Are you following the wxPython-dev list? I will send the patch to there,

Yes I follow it.

> Would also like to change "USE_PRINTDIRECT", i.e. allow to set it at
> run time.

Sounds a sensible idea. I assume you would change the hard coded
DIRECTIVE into an attribute and provide a getter/setter for it. Would
any of the other directives benefit from being settable do you think?
Could you consider providing a patch and include your conditional
importing of pyPdf/pyPDF2 as well?

--
Regards

David Hughes
Forestfield Software

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email towxpython-users+unsubscribe@googlegroups.com.
For more options, visithttps://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxPython-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hi,

This is hopefully the one.

It includes:
- David's changes for the image not showing issue
- change USE_PRINTDIRECT to a Python property
- change SHOW_LOAD_PROGRESS to a Python property
- use pyPDF2 if present, otherwise pyPdf if neither is present raise an import error

And David's latest change to ensure that footers show correctly.

Werner

pdfviewer 3.patch (7.37 KB)

Werner wrote:

Hi,

This is hopefully the one.

It includes:
- David's changes for the image not showing issue
- change USE_PRINTDIRECT to a Python property
- change SHOW_LOAD_PROGRESS to a Python property
- use pyPDF2 if present, otherwise pyPdf if neither is present raise an
import error

And David's latest change to ensure that footers show correctly.

Thanks. It has been committed to SVN.

···

--
Robin Dunn
Software Craftsman