Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39062 > unrolled thread

How to go about with PDF regression

Started byJon Reyes <everystepsayes@gmail.com>
First post2013-02-17 18:55 -0800
Last post2013-02-17 19:05 -0800
Articles 2 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  How to go about with PDF regression Jon Reyes <everystepsayes@gmail.com> - 2013-02-17 18:55 -0800
    Re: How to go about with PDF regression Jon Reyes <everystepsayes@gmail.com> - 2013-02-17 19:05 -0800

#39062 — How to go about with PDF regression

FromJon Reyes <everystepsayes@gmail.com>
Date2013-02-17 18:55 -0800
SubjectHow to go about with PDF regression
Message-ID<05271780-da70-46fc-a587-8d1a70cafdeb@googlegroups.com>
Hey there, so I'm trying to create automated regression for PDFs that will use Selenium RC for the generation and Python for the comparison of PDFs. I will be using pyPdf to rename the files according to their content, ImageMagick to convert the PDFs to images and PIL to actually compare the PDFs page by page. Here's a big pain in the neck though: not all elements in the PDF will be the same. This means that with the dynamic parts of the PDF I should not compare them. Right now what I do is find the region that will be removed, paint over a white box on the element and then compare. The problem is I have to do this for any PDF that will deviate with some of the coordinates I've already gotten and this will probably take lots of time. Worse, I will have to setup a config file, xml or probably overload a class with variables as constants and bunch up a lot of ifs so that I could remove the proper elements in a PDF. 

Has anyone done PDF regression for Python like this before and have you found a better way to do it?

I was thinking if there was a tool where I could open up the image and I could create boxes with the mouse and it will automatically generate the correct box coordinates then my life would be a tad easier but nope, I don't think there is one. 

Also, I thought that I could get the content of the PDF using pyPdf with the PageObject's extractText() method then just remove the parts but it turns out this couldn't be done and is not possible with PDFs. Too bad, if I had this in place I wouldn't need to worry about elements moving and getting the coordinates for all the PDFs.

Any ideas will be appreciated.

PS: I'm thinking of just creating the coordinates generator tool myself but I have zero experience with GUI programming let alone TKinter. 

[toc] | [next] | [standalone]


#39063

FromJon Reyes <everystepsayes@gmail.com>
Date2013-02-17 19:05 -0800
Message-ID<833d670d-d717-4b92-b570-f2f210255e08@googlegroups.com>
In reply to#39062
Update: Found out with the Picture Manager by Windows I could view an image 100%, use a tool that measures the windows and get a probably not accurate but still serviceable coordinate to use. I compared with the coordinates I currently have and tried to get it by the above method and the coordinates are surprisingly close.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web