PDF to Image/SVG in Golang

3,849 views
Skip to first unread message

waTR

unread,
May 16, 2016, 2:11:50 PM5/16/16
to golang-nuts
We are building a set of RESTful services, which all are based on taking a PDF and transforming it into an image. Is there any code out there showing an example of what mix of libraries to use to do this. It would be a set of blue prints in PDF that would need to be converted to a high resolution image or SVG. The blueprints consist of lines and text only.

Raffaele Sena

unread,
May 16, 2016, 2:53:44 PM5/16/16
to waTR, golang-nuts
This library https://github.com/yob/pdfreader has some support for exporting to PDF.
It doesn't seem to be maintained but I am doing some work on it here https://github.com/raff/pdfreader.

Not sure of how good the SVG support is and I am not working specifically on that, but you can give it a try and possibly submit issues and/or pull requests.

-- Raffaele


On Sun, May 15, 2016 at 11:31 PM, waTR <roman.g...@gmail.com> wrote:
We are building a set of RESTful services, which all are based on taking a PDF and transforming it into an image. Is there any code out there showing an example of what mix of libraries to use to do this. It would be a set of blue prints in PDF that would need to be converted to a high resolution image or SVG. The blueprints consist of lines and text only.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tamás Gulácsi

unread,
May 16, 2016, 3:25:05 PM5/16/16
to golang-nuts
GraphicsMagick?

waTR

unread,
May 16, 2016, 4:10:38 PM5/16/16
to golang-nuts
ImageMagick is looking like the way to go. However, there is also this: https://github.com/yob/pdfreader

Bogdan Bursuc

unread,
May 17, 2016, 1:37:28 AM5/17/16
to waTR, golang-nuts
Ghostscript is the way to go on this: is the fastest I know, and I've used it. All others are using ghostscript AFAIK.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Thanks,
Bogdan I. Bursuc

waTR

unread,
Nov 20, 2018, 8:20:08 PM11/20/18
to golang-nuts
Here is an article/tutorial for how to do this with ImageMagick: https://golangcode.com/convert-pdf-to-jpg/

waTR

unread,
Nov 20, 2018, 8:27:36 PM11/20/18
to golang-nuts
Here is some example code that converts PDFs (all pages) to JPG, and uploads to s3 for good measure!  Brilliant !

Reply all
Reply to author
Forward
0 new messages