Improving thumbnail creation on the fly for PDF

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: helmut, XnTriq, xnview

Post Reply
davidarnoult
Posts: 4
Joined: Mon Mar 22, 2004 6:42 pm

Improving thumbnail creation on the fly for PDF

Post by davidarnoult »

Hi everyone,

I am happy with Gflax 2.40 and I am managing a online library with thousands of documents. I use Gflax to generate thumbnail on the fly of all images including PDF (only Office document can not be displayed...).

I try to improve the speed to create a thumbnail on the fly for big PDF's.
It seems that even with .page=1 parameter GFlax loads the whole PDF and generate all the thumbnails to display just one at the end.

Another question: Is there also a way to add buttons on the web page like Next Page/Previous Page to navigate in the document?

Thanks for your help!

I have this code to create a thumbnail on the fly:

Code: Select all

On Error Resume Next
Response.Clear
Response.Buffer = True
Dim File, Px, newWidth, newHeight

File = request.QueryString("Path")
Px = Request.QueryString("px")

if Px = "" then
	Px = 300
end if

Set ThumbNail = server.createobject("GflAx.GflAx")

const AX_JPEG = 3
const AX_To16Colors = 16


With ThumbNail
	.EpsDpi = 72
	.EpsWidth = Px
	.EnableLzw = True
	.Page = 1


	.LoadBitmap File
	.SaveJPEGQuality = 10 'Quality of 70%
	.Saveformat = AX_JPEG
	
	if Thumbnail.Width > Thumbnail.Height then
		newWidth = Px 'Get the height according to the width (keep the ratio)
    	newHeight = (newWidth * .Height) / .Width
	else
		newHeight = Px
		newWidth = (newHeight * .Width) / .Height
	end if
	
    .Resize newWidth, newHeight 'Resize the picture
	
	response.contenttype = "image/jpeg"
	response.binarywrite .SendBinary
	
end with

set ThumbNail=nothing
%>
Rgds

David
User avatar
xnview
Author of XnView
Posts: 46235
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Improving thumbnail creation on the fly for PDF

Post by xnview »

davidarnoult wrote:Hi everyone,

I am happy with Gflax 2.40 and I am managing a online library with thousands of documents. I use Gflax to generate thumbnail on the fly of all images including PDF (only Office document can not be displayed...).

I try to improve the speed to create a thumbnail on the fly for big PDF's.
It seems that even with .page=1 parameter GFlax loads the whole PDF and generate all the thumbnails to display just one at the end.

Another question: Is there also a way to add buttons on the web page like Next Page/Previous Page to navigate in the document?

Thanks for your help!
Yes, the next release will improve that...
Pierre.
davidarnoult
Posts: 4
Joined: Mon Mar 22, 2004 6:42 pm

Post by davidarnoult »

Thanks Pierre for your answer.

Looking forward getting next release then!
Don't forget to announce it via your mailing list.

Just to tell you that you're doing a great job with this software! It is a shame we don't have any new version since 2.54.

Best Regards

David
Post Reply