Reputation: 6816
I need to be able to generate a png thumbnail of a specific page of a PDF document in OS X.
I can use 'qlmanage -p MyFile.pdf -o outputDir -s1000' to get a 1000-pixel wide PNG of the first page. This works perfectly, and is almost exactly what I need. The only missing piece is being able to specify a certain page number of the PDF.
Can this be done with qlmanage, or some other command-line utility?
Upvotes: 2
Views: 2698
Reputation: 113956
You can use Aspose.Pdf
to generate a thumbnail (or image) of any page. Very reliable and generates a perfect image (as good as Acrobat). Only downside is it takes ~20 SECONDS to generate a single thumbnail. And that sucks. Code is as follows:
Document document = new Document(pdfPath);
Page page = document.Pages[pageNum];
document.RemoveMetadata();
page.Flatten();
page.SendTo(new PngDevice(page.PageInfo.Width, page.PageInfo.Height), pngPath);
document.Dispose();
Upvotes: 0
Reputation: 19071
ImageMagick ought to be able to help:
convert -resize 10000x10000 MyFile.pdf[2] MyOutput.png
Where 2
is the page number. Enjoy!
Upvotes: 3