i want to extract PDF files content without margins..here is example

Content is only half of Pdf page, i want only the content ..
With Adobe İllustrator i can easily extract whole content .
Step 1: Open Pdf file with Adobe illustrator , right click on content and select extract to outside and

and here is the result ..i get only the content i want..

Are there any avaible api for this process ? if so how can i do it ?
Thanks