Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > How to go about with PDF regression

Reply
Thread Tools

How to go about with PDF regression

 
 
Jon Reyes
Guest
Posts: n/a
 
      02-18-2013
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.
 
Reply With Quote
 
 
 
 
Jon Reyes
Guest
Posts: n/a
 
      02-18-2013
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Postscript to PDF with pdf-tools, pdf-writer, or other Sean Nakasone Ruby 1 04-14-2008 09:13 PM
PDF::Writer, create pdf and insert in other pdf file. Ricardo Pog Ruby 1 03-26-2008 08:24 PM
Latent class regression in Java? Craig Matthews Java 2 07-26-2003 12:41 AM
exp regression? jackson marshmallow Java 4 07-19-2003 10:20 AM



Advertisments