linuxserver/docker-nextcloud

[FEAT] Please add PDF support with ImageMagick

carsten-re opened this issue · 6 comments

Is this a new feature request?

  • I have searched the existing issues

Wanted change

I'm running a Netxcloud container with version 28.0.4. Preview Generator is already added and it's wotking fine for pictures and movie files. I'm missing PDF support in ImageMagick.

These features are actual supported in that container:
ImageMagick supported formats => 3G2, 3GP, AAI, APNG, ART, ASHLAR, AVI, AVIF, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CUBE, CUR, CUT, DATA, DCM, DCX, DDS, DFONT, DOT, DPX, DXT1, DXT5, EPS2, EPS3, EPT, EPT2, EPT3, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, JXL, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MPO, MSL, MSVG, MTV, MVG, NULL, ORA, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, PPM, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAS, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RSVG, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, XBM, XC, XCF, XPM, XPS, XV, XWD, YAML, YCbCr, YCbCrA, YUV

The config.php file already contains the preview config for PDF files
'enable_previews' => true, 'enabledPreviewProviders' => array ( 'OC\Preview\PNG', 'OC\Preview\JPEG', 'OC\Preview\GIF', 'OC\Preview\BMP', 'OC\Preview\XBitmap', 'OC\Preview\MP3', 'OC\Preview\TXT', 'OC\Preview\MarkDown', 'OC\Preview\OpenDocument', 'OC\Preview\Krita', 'OC\Preview\HEIC', 'OC\Preview\PDF', 'OC\Preview\Movie', 'OC\Preview\MP4', 'OC\Preview\MOV', ),

Reason for change

Missing thumbnails / preview for PDF files in Nextcloud.

Proposed code change

no

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

Not seeing this I'm afraid, can you provide more information please on how you've created the container

Image

Just followed the documentation and used this docker-compose file:

version: "3"
services:
  db:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: nextcloud-db
    networks:
      - database
    dns:
      - 10.1.254.254
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
      - MYSQL_DATABASE=$MYSQL_DATABASE
      - MYSQL_USER=$MYSQL_USER
      - MYSQL_PASSWORD=$MYSQL_PASSWORD
    volumes:
      - /opt/docker/mariadb/config:/config
    restart: unless-stopped
    labels:
      traefik.enable: false

  nextcloud:
    image: lscr.io/linuxserver/nextcloud:latest
    container_name: nextcloud
    environment:
      - PUID=$PUID
      - PGID=$PGID
      - TZ=$TZ
      - DOCKER_MODS=$DOCKER_MODS
      - COLLABORA_DOMAINS=$COLLABORA_DOMAINS
      - COLLABORA_FQDN=$COLLABORA_FQDN
    networks:
      - proxy
      - database
    dns:
      - 10.1.254.254
    group_add:
      - "106"
    devices:
      - /dev/dri/renderD128:/dev/dri/renderD128
    volumes:
      - /home/serveradmin/docker/nextcloud/config:/config
      - /home/serveradmin/docker/nextcloud/data:/data
      - /opt/docker/maxmind/geoipupdate_data/GeoLite2-Country.mmdb:/var/lib/GeoIP/GeoLite2-Country.mmdb:ro
    restart: unless-stopped
    labels:
      traefik.enable: true
      traefik.http.routers.nextcloud.rule: Host(`${COLLABORA_DOMAINS}`)
      traefik.http.routers.nextcloud.entrypoints: http
      traefik.http.routers.nextcloud-secure.entrypoints: https
      traefik.http.routers.nextcloud-secure.rule: 'Host(`${COLLABORA_DOMAINS}`)'
      traefik.http.routers.nextcloud-secure.tls: true
      traefik.http.routers.nextcloud-secure.service: nextcloud
      traefik.http.services.nextcloud.loadbalancer.server.port: 80
      traefik.http.middlewares.nextcloud-https-redirect.redirectscheme.scheme: https
      traefik.http.middlewares.nextcloud-https-redirect.redirectscheme.permanent: true
      traefik.http.middlewares.nextcloud-headers.headers.customFrameOptionsValue: SAMEORIGIN
      traefik.http.middlewares.nextcloud-headers.headers.stsSeconds: 315360000
      traefik.http.middlewares.nextcloud-headers.headers.browserXssFilter: true
      traefik.http.middlewares.nextcloud-regex.redirectregex.permanent: true
      traefik.http.middlewares.nextcloud-regex.redirectregex.regex: 'https://(.*)/.well-known/(?:card|cal)dav'
      traefik.http.middlewares.nextcloud-regex.redirectregex.replacement: 'https://$$1/remote.php/dav/'
      traefik.docker.network: proxy
    depends_on:
      - db

  office:
    image: collabora/code:latest
    container_name: office
    restart: unless-stopped
    networks:
      - proxy
    dns:
      - 10.1.254.254
    environment:
      - domain=${COLLABORA_DOMAINS}
      - 'dictionaries=en_US,de_DE'
      - VIRTUAL_PROTO=https
      - VIRTUAL_PORT=9980
      - VIRTUAL_HOST=${COLLABORA_FQDN}
      - "extra_params=--o:ssl.enable=false --o:ssl.termination=true"
    env_file:
      - stack.env
    cap_add:
      - MKNOD
    labels:
      traefik.enable: true
      traefik.http.routers.office.rule: Host(`${COLLABORA_FQDN}`)
      traefik.http.routers.office.entrypoints: http
      traefik.http.routers.office-secure.entrypoints: https
      traefik.http.routers.office-secure.rule: 'Host(`${COLLABORA_FQDN}`)'
      traefik.http.routers.office-secure.tls: true
      traefik.http.routers.office-secure.service: office
      traefik.http.services.office.loadbalancer.server.port: 9980
      traefik.http.middlewares.office-https-redirect.redirectscheme.scheme: https
      traefik.http.middlewares.office-https-redirect.redirectscheme.permanent: true
      traefik.docker.network: proxy

networks:
  proxy:
    external: true
  database:
    external: true


I suspect imagemagick-pdf is missing - could you test by running apk add --no-cache imagemagick-pdf inside the container?

looks promising:

serveradmin@extern:~$ docker exec -it nextcloud bash root@720ce0767006:/# apk add --no-cache imagemagick-pdf fetch http://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz (1/5) Installing avahi-libs (0.8-r16) (2/5) Installing cups-libs (2.4.7-r0) (3/5) Installing jbig2dec (0.20-r0) (4/5) Installing ghostscript (10.02.1-r0) (5/5) Installing imagemagick-pdf (7.1.1.26-r0) Executing busybox-1.36.1-r15.trigger Executing fontconfig-2.14.2-r4.trigger OK: 364 MiB in 294 packages root@720ce0767006:/#

And now I see PDF amd PDFA

serveradmin@extern:~$ docker exec -it nextcloud php -r 'phpinfo();'| grep PDF ImageMagick supported formats => 3G2, 3GP, AAI, AI, APNG, ART, ASHLAR, AVI, AVIF, AVS, BAYER, BAYERA, BGR, BGRA, BGRO, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CUBE, CUR, CUT, DATA, DCM, DCX, DDS, DFONT, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, FARBFELD, FAX, FF, FILE, FITS, FL32, FLV, FRACTAL, FTP, FTS, FTXT, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, HALD, HDR, HEIC, HEIF, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, INFO, INLINE, IPL, ISOBRL, ISOBRL6, JNG, JNX, JPE, JPEG, JPG, JPS, JSON, JXL, KERNEL, LABEL, M2V, M4V, MAC, MAP, MASK, MAT, MATTE, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MPO, MSL, MSVG, MTV, MVG, NULL, ORA, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PES, PFA, PFB, PFM, PGM, PGX, PHM, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PS, PS2, PS3, PSB, PSD, PTIF, PWP, QOI, RADIAL-GRADIENT, RAS, RGB, RGB565, RGBA, RGBO, RGF, RLA, RLE, RSVG, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, STEGANO, STRIMG, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TM2, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMV, WPG, X, XBM, XC, XCF, XPM, XPS, XV, XWD, YAML, YCbCr, YCbCrA, YUV serveradmin@extern:~$

And the preview works imediately
grafik

Would you be so kind and add this package to your build process? - Kind Regards!
Otherwise, I'd add this package as an extra DOCKER_MODS...

Thanks for doing what @j0nnymoe asked it really sped up fixing this. Bit weird it was OK for me but maybe I was doing something different. Either way, sorted.