cut area out of .pdf file using VBA RRS feed

  • Question

  • I'm using Access 2010 with VBA.

    I want to cut out a rectangle that's near the bottom right corner of a .pdf file, then save the resulting file (the document with white space where I cut out the rectangle). I don't need to view either the original or the new document. They are computer generated .pdf's, so the rectangle I want to cut out of each document is in exactly the same place every time. I need to create the new files one at a time, it's not a batch process.

    Anyone have any ideas how I could do this?

    Monday, December 14, 2015 10:12 PM

All replies

  • This is the forum to discuss questions and feedback for General Office Development, but this issue is related to VBA to edit PDF File. So I'll move your question to the MSDN forum for VBA


    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents,
    and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.

    Thanks for your understanding.

    Tuesday, December 15, 2015 8:34 AM
  • I don't know of a way to directly do it in VBA but there are tools you can call from VBA to do it.  I would use ghostscript to create either jpeg or png images of the pdf pages and Imagemajick to crop out the section you want.  Both are free and can be called from the command line.  I use this technique to crop out some charts produced by an old piece of hardware.
    • Proposed as answer by David_JunFeng Wednesday, December 23, 2015 2:30 PM
    • Unproposed as answer by David_JunFeng Wednesday, December 23, 2015 2:30 PM
    Tuesday, December 15, 2015 1:16 PM