How to go about with PDF regression

J

Jon Reyes

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. Iwill 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 theproper 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 turnsout this couldn't be done and is not possible with PDFs. Too bad, if I hadthis 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 butI have zero experience with GUI programming let alone TKinter.
 
J

Jon Reyes

Update: Found out with the Picture Manager by Windows I could view an image100%, use a tool that measures the windows and get a probably not accuratebut still serviceable coordinate to use. I compared with the coordinates Icurrently have and tried to get it by the above method and the coordinatesare surprisingly close.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top