Copy Image from PDF

54

Solution 1

There are several methods to extract the images from a pdf.

I suggest you try any of the online tools as they are cross platform and do not require installation of any software

http://extract.smallpdf.com/

If you use Linux, try pdfimages http://ubuntugenius.wordpress.com/2012/02/04/how-to-extract-images-from-pdf-documents-in-ubuntulinux/

Windows try http://www.somepdf.com/some-pdf-image-extract.html

OSX has a free trial software here : http://www.iskysoft.com/pdf-converter-mac.html

Solution 2

Try to find a virtual printer that might help you print something as a PNG or a JPEG and then crop the result as required. Something like this: http://sourceforge.net/projects/imageprinter/

Which emulates a printer that might help you print stuff as some image format

Share:
54

Related videos on Youtube

Saan Classes
Author by

Saan Classes

Updated on September 18, 2022

Comments

  • Saan Classes
    Saan Classes over 1 year

    I'm getting issue while running docker compose up , You can see my docker-compose.yaml file that I wrote for running the web API with MySQL db. I've also attached the error I'm facing currently. It'll be a great help if you can help me in this regard. thanks.

        version: '3'
    services:
      app:
        container_name: web_api
        build: .
        ports: 
          - 8080:5000
        restart: on-failure
        volumes:
          - api:/usr/src/app/
        depends_on:
          - webapi-mysql          
        networks:
          - webapi
    
    
      webapi-mysql:
        image: mysql:8.0.26
        container_name: db_mysql
        ports: 
          - 3308:3306
        environment: 
          - MYSQL_ROOT_HOST=${DB_HOST} 
          - MYSQL_USER=${DB_USER}
          - MYSQL_PASSWORD=${DB_PASSWORD}
          - MYSQL_DATABASE=${DB_NAME}
          - MYSQL_ROOT_PASSWORD=${DB_PASSWORD}
        volumes:
          - database_mysql:/var/lib/mysql
        networks:
          - webapi
    
    volumes:
      api:
      database_mysql:                  
    
    # Networks to be created to facilitate communication between containers
    networks:
      webapi:
        driver: bridge
    

    Error is coming up in my CLI, as follows

    Attaching to db_mysql, web_api
    db_mysql        | 2021-11-08 13:20:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
    db_mysql        | 2021-11-08 13:20:28+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
    db_mysql        | 2021-11-08 13:20:28+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started.
    db_mysql        | 2021-11-08 13:20:28+00:00 [ERROR] [Entrypoint]: MYSQL_USER="root", MYSQL_USER and MYSQL_PASSWORD are for configuring a regular user and cannot be used for the root user
    db_mysql        |     Remove MYSQL_USER="root" and use one of the following to control the root user password:
    db_mysql        |     - MYSQL_ROOT_PASSWORD
    db_mysql        |     - MYSQL_ALLOW_EMPTY_PASSWORD
    db_mysql        |     - MYSQL_RANDOM_ROOT_PASSWORD
    web_api         | 2021/11/08 13:20:31 dial tcp 127.0.0.1:3306: connect: connection refused
    db_mysql exited with code 1
    web_api exited with code 1
    
    • user55325
      user55325 over 10 years
      Do you have any reason to believe the rest of the image actually exists in the PDF? I would be surprised if the document retained information that would not be visible under any circumstances.
    • JabberwockyDecompiler
      JabberwockyDecompiler over 10 years
      @user55325 There is a border that goes off to the right when I click on the image. Based on that I am assuming the image is still complete in the PDF. The black paste size is also larger than the width of a PDF document.
    • henry700
      henry700 over 10 years
      it is unclear if this is the case with your image, but it is possible that the image is black with an alpha channel or transparency applied. I have seen SVG files (graphs, charts) which wrap a raster image in an SVG container and use that image as a mask on a black rectangle. (this defeats the purpose of using SVG vector files, but there it is)
    • Shadow
      Shadow over 2 years
      Have you tried updating your config file according to the detailed suggestions in the error message?
    • Jinna Balu
      Jinna Balu over 2 years
      You are trying to connect to tcp 127.0.0.1:3306, but you have opened 3308 port in the MySQL container. Either you modify the port or update the port configuration
    • Saan Classes
      Saan Classes over 2 years
      Thanks @Shadow! Yes, I did that, It fixes one of my errors but still getting connection issues. Could you plz take a look at my .yaml file again if I need to refactor? After the fix/changes, error comes up as follows: Attaching to db_mysql, web_api db_mysql | 2021-11-09 06:42:58+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started. web_api | 2021/11/09 06:41:36 dial tcp 127.0.0.1:3306: connect: connection refused
    • Saan Classes
      Saan Classes over 2 years
      Plz, find my repo as well for your reference link. thanks.
  • JabberwockyDecompiler
    JabberwockyDecompiler over 10 years
    Good idea, I gave that a try, it still just cut off the image. I also tried to send it to XPF. Same thing.
  • JabberwockyDecompiler
    JabberwockyDecompiler over 10 years
    extract.smallpdf.com did the trick. P.S. 90 Seconds Johnny, that's all I ask for.
  • Panther
    Panther over 10 years
    Great, hope it is a nice picture =)
  • JabberwockyDecompiler
    JabberwockyDecompiler over 10 years
    For anyone else studying the 70-480 HTML5 CSS3 JS for question 66 here is the full list of answer options. Question 66 Uncut Answer Selection
  • pabouk - Ukraine stay strong
    pabouk - Ukraine stay strong over 10 years
    pdfimages is a great tool from the Xpdf package which is available both for Unix-like systems and Windows: foolabs.com/xpdf/download.html
  • JabberwockyDecompiler
    JabberwockyDecompiler over 10 years
    @bodhi.zazen This saved me again, same file different spot. I did not even need to go to the site since it downloaded everything. Would upvote twice if I could.
  • Saan Classes
    Saan Classes over 2 years
    thanks @caveman for pointing out, I couldn't get where to change. Could you look here again on my repo itself i.e. github.com/afzal442/go_prac/tree/main/GO_Exercise/T1
  • Dylan Reimerink
    Dylan Reimerink over 2 years
    Here you define your database connection string, I think that is it: github.com/afzal442/go_prac/blob/…
  • Saan Classes
    Saan Classes over 2 years
    after workaround, I discovered the same issue. something like below; Attaching to db_mysql, web_api db_mysql | 2021-11-09 11:39:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started. db_mysql | 2021-11-09 11:39:05+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql' db_mysql | 2021-11-09 11:39:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.26-1debian10 started. db_mysql | 2021-11-09T11:39:08.118776Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.26) starting as process 1
  • Saan Classes
    Saan Classes over 2 years
    db_mysql | 2021-11-09T11:39:08.240601Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. web_api | 2021/11/09 11:39:08 dial tcp 127.0.0.1:3306: connect: connection refused web_api exited with code 1 db_mysql | 2021-11-09T11:39:09.501674Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
  • Saan Classes
    Saan Classes over 2 years
    db_mysql | 2021-11-09T11:39:10.354847Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/run/mysqld/mysqlx.sock db_mysql | 2021-11-09T11:39:10.355065Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.26' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server - GPL. web_api | 2021/11/09 11:39:12 dial tcp 127.0.0.1:3306: connect: connection refused web_api exited with code 0
  • Saan Classes
    Saan Classes over 2 years
    Could you @caveman plz also take a look again? thanks github.com/afzal442/go_prac/blob/…
  • Dylan Reimerink
    Dylan Reimerink over 2 years
    github.com/afzal442/go_prac/blob/… you are still trying to connect to 127.0.0.1, your db is in a separate container you need to change it to db_mysql or webapi-mysql (I am not sure if the container_name option also applies to the generated DNS name)