I have a parent file type that is folderish, and I would like to include a thumbnail of the first page of a child pdf in the template. Can someone roughly outline the tools and process you can imagine would achieve this, so that I can investigate further?
Asked
Active
Viewed 175 times
1 Answers
2
Getting out the first page of pdf can be achieved by using ghostscript. This is an example script which forms an gostscript command and stores the images. I took this from collective.pdfpeek. Which by the way could solve your problem right away :-)
Until few days ago I would have recommended you not to use it, since it was a little bit buggy, but they recently shipped a new version, so give it a try! I'm not sure whether they now support DX or not.
So the workflow for you should be.
- Uploading a PDF
- Subscribe modified/creation events.
- create image of first page using ghostscript (check my command, or collective.pdfpeek)
- store it as blob (NamedBlobImage) on your uploaded pdf.
- Also implement some queueing like collective.pdfpeek to not block all your threads with ghostscript commands.
OR
Give collective.pdfpeek a shot!
BTW: imho on a large scale the preview generation for pdfs needs to be implemented as a service, which stores/manages the images for you.

Mathias
- 6,777
- 2
- 20
- 32