• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: PDF to scaled JPEG (thumbnail)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PDF to scaled JPEG (thumbnail)


  • Subject: Re: PDF to scaled JPEG (thumbnail)
  • From: Sam Barnum <email@hidden>
  • Date: Sun, 3 Apr 2005 19:36:46 -0700

Or use imagemagick, but it's not java, you'd need to call an external program.

--
Sam Barnum
360 Works
http://www.360works.com
415.929.7318


On Apr 3, 2005, at 11:35 AM, Hugi Thordarson wrote:

There's a very nice library available called JPedal which is free if you adhere to conditions of the GPL license, see http://www.jpedal.org/ .
Here's some simple example code I used to create a thumbnail from the first page of a multi page PDF document. What this example does not show you how to do is crop and scale the image and encode it into some usable data. But there are plenty of examples of how to do that around the web, so you shouldn't have any problems doing that :-).



import org.jpedal.PDFDecoder; import java.awt.image.BufferedImage;

public BufferedImage bufferedImageFromPDFFilePath( String pdfFilePath ) {

		PdfDecoder decoder = new PdfDecoder();

try {
decoder.setExtractionMode( 0, 72, 1 );
decoder.openPdfFile( pdfFilePath );
decoder.decodePage( 1 );

// This returns the page in its actual size. If you want a thumbnail, you can also use getPageAsThumbnail( int, int )
BufferedImage image = decoder.getPageAsImage();


			return image;
		}
		catch( Exception e ) {
			System.out.println( e );
			return null;
		}
		finally {
			decoder.closePdfFile();
		}
}


Hope this helps, - Hugi


On 3.4.2005, at 16:07, Florijan Stamenkovic wrote:

Hi list...


I was looking for something that can:

Take data from NSData or a file that is a PDF and generate a jpg from it (data or direct to file). And scale it preferably. I need it for a context in which the user is uploading a pdf, and I need the thumbnails to display them on my listings... I found some 599$ solutions :( and some free stuff, but nothing usable.

Does anybody do this, or knows of a working solution???

Florijan

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
email@hidden


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >PDF to scaled JPEG (thumbnail) (From: Florijan Stamenkovic <email@hidden>)
 >Re: PDF to scaled JPEG (thumbnail) (From: Hugi Thordarson <email@hidden>)

  • Prev by Date: Re: WOA, Building a Login form
  • Next by Date: Re: Re(2): Javascript Error onBlur
  • Previous by thread: Re: PDF to scaled JPEG (thumbnail)
  • Next by thread: Re: PDF to scaled JPEG (thumbnail)
  • Index(es):
    • Date
    • Thread