I just started to experiment with the above and I see that an image
which is shown in Adobe Reader does not show when viewing with
wx.lib.pdfviewer.
Is this a know limitation?
wx.lib.pdfviewer uses the 3rd party package pyPdf. It's not feature
complete, so there may be some things that aren't supported. What kind
of image was it?
···
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
I just started to experiment with the above and I see that an image
which is shown in Adobe Reader does not show when viewing with
wx.lib.pdfviewer.
Is this a know limitation?
Would it be better if I had Cairo installed?
BTW, the PDF is generated using PythonReports which in turn uses reportlab.
Werner
Yes there are limitations to pyPdf but as far as I recall, it should handle jpg images. I have downloaded your sample file and will check over the weekend.
Cairo only affects the rendering of the PDF so should not make any difference.
Regards,
David Hughes
···
On Thursday, 14 March 2013 16:00:08 UTC, werner wrote:
On Thursday, 14 March 2013 16:00:08 UTC, werner wrote:
Hi,
I just started to experiment with the above and I see that an image
which is shown in Adobe Reader does not show when viewing with
wx.lib.pdfviewer.
Is this a know limitation?
Would it be better if I had Cairo installed?
BTW, the PDF is generated using PythonReports which in turn uses reportlab.
Yes there are limitations to pyPdf but as far as I recall, it should handle jpg images. I have downloaded your sample file and will check over the weekend.
Just a friendly check - did you find a moment to look at this?
I would like to use wx.lib.pdfviewer to preview reports generated with PythonReports.
Yes there are limitations to pyPdf but as far as I recall, it should handle jpg images. I have downloaded your sample file and will check over the weekend.
Just a friendly check - did you find a moment to look at this?
I would like to use wx.lib.pdfviewer to preview reports generated with PythonReports.
if not fpypdf:
print "You either need pyPdf or pyPDF2 to use this."
elif fpypdf == 2:
from PyPDF2 import PdfFileReader
from PyPDF2.pdf import ContentStream, PageObject
from PyPDF2.filters import ASCII85Decode, FlateDecode
elif fpypdf == 1:
from pyPdf import PdfFileReader
from pyPdf.pdf import ContentStream, PageObject
from pyPdf.filters import ASCII85Decode, FlateDecode
Tried this with wxPython 2.9.5 preview build, can provide a patch if there is interest of supporting this in wx.
I spent some time looking into this. Most of it was deciphering what
the heck I wrote nearly four years ago The images there and pdfviewer is trying to get
wx.GraphicsContext/Cairo to display them, but they are not
responding in the way expected. The attached patch works around
this and seems to solve the problem.
Two other points came up:
Hi David,
On 15/03/2013 16:34, David Hughes wrote:
...
Yes there are
limitations to pyPdf but as far as I recall, it should handle
jpg images. I have downloaded your sample file and will check
over the weekend.
Just a friendly check - did you find a moment to look at this?
;-)
are
Are you embedding any fonts in your generated PDF? In verbose
mode, it is reporting fonts aaaaaa+arialmt and
aaaaaa+arial-boldmt. At the moment pdfviewer doesn’t know (or
rather I don’t know) how to extract embedded fonts from
a PDF and can only use the 14 standard fonts.
Are you planning to print these labels? If so you may need to
switch USE_PRINTDIRECT = False in the program. When True the
labels are written directly to a wx.PrintDC and your bar codes
are not rendered very well (I’m looking into this). Otherwise
what you see on screen is buffered out, which takes longer but
is reproduced properly.
I have the same problem but after about 4 minutes
Patch works like a charm, thanks you very much.
Don’t really want to. I am still learning PythonReports etc, and
just based use Arial with some attributes like bold and different
point sizes.
Can you please point me to the standard font list and I’ll use them.
Yes, they will be printed onto cards 10 by 15 cm large, will set
USE_PRINTDIRECT.
Best regards
Werner
···
Hi David,
On 18/03/2013 17:13, David Hughes wrote:
Hi Werner
I spent some time looking into this. Most of it was deciphering
what the heck I wrote nearly four years ago
The images **are** there and pdfviewer is trying to get
wx.GraphicsContext/Cairo to display them, but they are not
responding in the way expected. The attached patch works around
this and seems to solve the problem.
Two other points came up:
Are you embedding any fonts in your generated PDF? In
verbose mode, it is reporting fonts aaaaaa+arialmt and
aaaaaa+arial-boldmt. At the moment pdfviewer doesn’t know (or
rather I don’t know) how to extract embedded fonts
from a PDF and can only use the 14 standard fonts.
Are you planning to print these labels? If so you may need
to switch USE_PRINTDIRECT = False in the program. When True
the labels are written directly to a wx.PrintDC and your bar
codes are not rendered very well (I’m looking into this).
Otherwise what you see on screen is buffered out, which takes
longer but is reproduced properly.
On 18/03/2013 14:24, Werner wrote:
On
18/03/2013 14:45, Werner wrote:
Hi David,
On 15/03/2013 16:34, David Hughes wrote:
...
Yes there are
limitations to pyPdf but as far as I recall, it should
handle jpg images. I have downloaded your sample file and
will check over the weekend.
Just a friendly check - did you find a moment to look at this?
Are you embedding any fonts in your generated PDF? In
verbose mode, it is reporting fonts aaaaaa+arialmt and
aaaaaa+arial-boldmt. At the moment pdfviewer doesn’t know
(or rather I don’t know) how to extract embedded
fonts from a PDF and can only use the 14 standard fonts.
Don’t really want to. I am still learning PythonReports etc, and
just based use Arial with some attributes like bold and different
point sizes.
Can you please point me to the standard font list and I'll use
The Adobe Reader standard fonts are listed in - page 29/30
On 18/03/2013 16:41, Werner wrote:
Are you embedding any fonts in your generated PDF? In
verbose mode, it is reporting fonts aaaaaa+arialmt and
aaaaaa+arial-boldmt. At the moment pdfviewer doesn’t know
(or rather I don’t know) how to extract embedded
fonts from a PDF and can only use the 14 standard fonts.
Don’t really want to. I am still learning PythonReports etc,
and just based use Arial with some attributes like bold and
different point sizes.
Can you please point me to the standard font list and I'll use
Are you working on the Phoenix port for wx.lib.pdfviewer? If not I might start on it by adapting doc strings and generally checking if other things need to be changed to make it run.
What do you think about supporting both pyPdf and pyPDF2?
I don't seem to be able to reproduce that here. The footer is displayed in the viewer at all the different frame sizes and zoom settings I tried.
Using wxPython demo 2.9.4.0 wxMSW, unicode with Python 2.7.2 on 64 bit Windows 8 (wx.GraphicsContext) also with wxPython demo 2.9.4.0 wxMSW, unicode with Python 2.7.2 on 64 bit Windows 7 (Cairo) both containing the pdfviewer patch I sent recently.
···
On 20/03/2013 08:41, Werner wrote:
I noticed another small issue with another report.
In preview the footer "Date printed etc etc" is not shown, however it does print.
Are you working on the Phoenix port for wx.lib.pdfviewer? If not I might start on it by adapting doc strings and generally checking if other things need to be changed to make it run.
I am aware that there is a terrific amount of effort being put into this which, unfortunately for both work and personal reasons, I have not had the time to make any sort of contribution. Please feel free to do whatever you think is necessary.
What do you think about supporting both pyPdf and pyPDF2?
I wasn't aware of pyPDF2 until you mentioned it and haven't tried using it yet. Its Home page says it is an actively maintained fork and super-set of the moribund pyPDF so I think it would be a good idea to migrate - supporting both for the time being - if it doesn't involve much code change. Both modules, as well as the non-Python PDFtk toolkit that pyPDF2 is aspiring to emulate, are PDF document manipulation tools. They don't provide any content-viewing functionality, but just supply access to the PDF content that pdfviewer is then able to extract.
I noticed another small issue with another report.
In preview the footer "Date printed etc etc" is not shown, however it does print.
I don't seem to be able to reproduce that here. The footer is displayed in the viewer at all the different frame sizes and zoom settings I tried.
Using wxPython demo 2.9.4.0 wxMSW, unicode with Python 2.7.2 on 64 bit Windows 8 (wx.GraphicsContext) also with wxPython demo 2.9.4.0 wxMSW, unicode with Python 2.7.2 on 64 bit Windows 7 (Cairo) both containing the pdfviewer patch I sent recently.
I am on Python 2.7.2 32 bit, Windows 7 and wxPython 2.9.5.0.b20121231 with your patch applied. Haven't had time to get the latest preview for 2.9.5.
Hhm, just did a little test with the demo using wxPython 2.9.4 without your patch and the footer shows, then switched to 2.9.5 in the demo and the footer still shows - so it must be something I am doing in my application that the footer does not show up.
Are you working on the Phoenix port for wx.lib.pdfviewer? If not I might start on it by adapting doc strings and generally checking if other things need to be changed to make it run.
I am aware that there is a terrific amount of effort being put into this which, unfortunately for both work and personal reasons, I have not had the time to make any sort of contribution. Please feel free to do whatever you think is necessary.
Will have a go at it, probably over the weekend.
Are you following the wxPython-dev list? I will send the patch to there, if you don't follow it I will copy you, so you can comment the patch. Most of the work will probably be just doc strings.
What do you think about supporting both pyPdf and pyPDF2?
I wasn't aware of pyPDF2 until you mentioned it and haven't tried using it yet. Its Home page says it is an actively maintained fork and super-set of the moribund pyPDF so I think it would be a good idea to migrate - supporting both for the time being - if it doesn't involve much code change. Both modules, as well as the non-Python PDFtk toolkit that pyPDF2 is aspiring to emulate, are PDF document manipulation tools. They don't provide any content-viewing functionality, but just supply access to the PDF content that pdfviewer is then able to extract.
I got both working just with some import changes.
Would also like to change "USE_PRINTDIRECT", i.e. allow to set it at run time. Would that be o.k. with you?
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?
If the PDF is multiple pages I actually see the footer but it overlaps the top of the following page.
I also tried changing the above to use wx.Frame and the code used in the demo (lines 16 to 30) but see the same issue.
David and/or Robin, can you see why my usage would cause a problem?
Werner
···
On 21/03/2013 12:29, Werner wrote:
Hi David,
On 21/03/2013 11:39, David Hughes wrote:
On 20/03/2013 08:41, Werner wrote:
I noticed another small issue with another report.
In preview the footer "Date printed etc etc" is not shown, however it does print.
I don't seem to be able to reproduce that here. The footer is displayed in the viewer at all the different frame sizes and zoom settings I tried.
Using wxPython demo 2.9.4.0 wxMSW, unicode with Python 2.7.2 on 64 bit Windows 8 (wx.GraphicsContext) also with wxPython demo 2.9.4.0 wxMSW, unicode with Python 2.7.2 on 64 bit Windows 7 (Cairo) both containing the pdfviewer patch I sent recently.
I am on Python 2.7.2 32 bit, Windows 7 and wxPython 2.9.5.0.b20121231 with your patch applied. Haven't had time to get the latest preview for 2.9.5.
Hhm, just did a little test with the demo using wxPython 2.9.4 without your patch and the footer shows, then switched to 2.9.5 in the demo and the footer still shows - so it must be something I am doing in my application that the footer does not show up.
Hhm, just did a little test with the demo using wxPython 2.9.4 without
your patch and the footer shows, then switched to 2.9.5 in the demo and the
footer still shows - so it must be something I am doing in my application
that the footer does not show up.
Will investigate and let you know my findings.
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.
[...]
If the PDF is multiple pages I actually see the footer but it overlaps the
top of the following page.
Could it be an A4 vs Letter paper size issue? I assume the viewer is
assuming a default paper size in constructing the view.
Just a thought. HTH.
Cheers,
Scott.
···
On Fri, Mar 22, 2013 at 4:28 AM, Werner <werner.bruhin@sfr.fr> wrote: