How to go about with PDF regression

Discussion in 'Python' started by Jon Reyes, Feb 18, 2013.

  1. Jon Reyes

    Jon Reyes Guest

    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.
    Jon Reyes, Feb 18, 2013
    1. Advertisements

  2. Jon Reyes

    Jon Reyes Guest

    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.
    Jon Reyes, Feb 18, 2013
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jackson marshmallow

    exp regression?

    jackson marshmallow, Jul 17, 2003, in forum: Java
    Jos A. Horsmeier
    Jul 19, 2003
  2. Craig Matthews

    Latent class regression in Java?

    Craig Matthews, Jul 23, 2003, in forum: Java
    Shashank Tripathi
    Jul 26, 2003
  3. BODIN
    Dec 8, 2003
  4. Ricardo Pog
    Austin Ziegler
    Mar 26, 2008
  5. Sean Nakasone
    Farrel Lifson
    Apr 14, 2008

Share This Page