Page 1 of 4

Pdf preview in media fields

PostPosted: Wed Sep 22, 2004 9:17 am
by Riccardino
Since Dev Team is doing such a great job with image files management, I'd like to add a request to the wish list:

it would be great to to able to see a thumbnail of the first page of a pdf document, when this one is stored in a blob field.

As an alternative, also a function that creates a thumbnail in jpeg or png format would be fine.

What do you think?

PostPosted: Wed Sep 22, 2004 9:33 am
by automazione
I also REALLY need this feature!. THANK YOU IN ADVANCE DEV DREAM TEAM!!!

....and what about an easy way to display the blob-pdf directly on a form?

PostPosted: Fri Sep 24, 2004 3:15 pm
by jcompagner
here is a pdf bean that you can drop in the beans folder.

loading of a pdf:

Code: Select all
globals.page = 1;
globals.zoomfactor = 0.2;
var file = plugins.file.showFileOpenDialog(1);
if(file)
{
   elements.bean_185.openPdfFile(file);
   elements.bean_185.decodePage(globals.page);
   elements.bean_185.setPageParameters(globals.zoomfactor, globals.page);
   elements.bean_185.repaint();
}


next page:

Code: Select all
globals.page++;
elements.bean_185.decodePage(globals.page);
elements.bean_185.setPageParameters(globals.zoomfactor, globals.page);
elements.bean_185.repaint();

PostPosted: Fri Sep 24, 2004 7:33 pm
by Riccardino
jcompagner wrote:here is a pdf bean that you can drop in the beans folder.


Guys, you're really great! :-D

Thanks: it's a precious tool and I can't wait to use it :-)

PostPosted: Sat Sep 25, 2004 12:10 am
by automazione
THANKS JOHAN. that was a really quick response!! IT WORKS!!! it is exactly what I was looking for. WONDERFUL !!!

TO all members of this forum
    TAKE NOTE: Our was not an easy request ... but SERVOY dev DREAM team found and tested the right solution for us in less than 3 days!!!!

I owe you a big box of Torino's GIANDUJOTTI.

GRAZIE

PostPosted: Sat Sep 25, 2004 12:15 am
by automazione
For loading a pdf from a blob field:

Code: Select all
elements.bean_185.openPdfArray(blob_pdf)


where blob_pdf is the media/blob field.

WONDERFUL

thanks again

PostPosted: Sat Sep 25, 2004 10:04 am
by Harjo
VERY COOL STUFF! :D

PostPosted: Sun Sep 26, 2004 11:59 am
by Ron
Sorry, I can't get it working :oops:
Installed the bean, placed the bean on a form, created a mediafield and pasted a PDF in it, and the two globals.
Finally I made a method and pasted the code in it.
What do I put into the methods (pdf from a blobfield as well as from outside the db)?

TIA

Ron

PostPosted: Sun Sep 26, 2004 12:41 pm
by pbakker
The methods work with the element name of the beanelement you dropped on your form. Did you name the element and synced the element name used in the methods to it?

Paul

PostPosted: Sun Sep 26, 2004 2:12 pm
by Ron
Hi Paul,

Yep, I did rename the beannames in my method, that was not the problem.
I did set the zoomfactor 2 and enlarged the bean size, and now
the pdf from my HD shows up fine.
However I am still struggling with de pdf stored in the mediafield.
This is the code I use:

globals.page = 1;
globals.zoomfactor = 2;
var file = elements.bean_185.openPdfArray(pdf_in_mediafield);
if(file)
{
elements.bean_185.openPdfFile(file);
elements.bean_185.decodePage(globals.page);
elements.bean_185.setPageParameters(globals.zoomfactor, globals.page);
elements.bean_185.repaint();
}


Any suggestions?

PostPosted: Sun Sep 26, 2004 2:28 pm
by jcompagner
you are using BOTH pdf from file and pdf from array!!
you shouldn't ofcourse use both!

var file = elements.bean_185.openPdfArray(pdf_in_mediafield);

elements.bean_185.openPdfFile(file);

if you debugged this then you should see that file after the first call is undefined.. Is nothing. Because openPdfArray doesn't return a file.. It shows the pdf that is defined in the array. Just as openPdfFile shows the pdf defined in the file object...


Code: Select all
elements.bean_185.openPdfArray(pdf_in_mediafield);
elements.bean_185.decodePage(globals.page);
elements.bean_185.setPageParameters(globals.zoomfactor, globals.page);
elements.bean_185.repaint(); 

PostPosted: Sun Sep 26, 2004 3:14 pm
by Ron
You're right.
Thanks Johan.

PostPosted: Tue Nov 30, 2004 12:36 am
by idoctor
Is thier a way to use this bean to add and position text. ie) For instance to programatically fill out a form?

John McCann

PostPosted: Tue Nov 30, 2004 12:37 am
by idoctor
Is thier a way to use this bean to add and position text. ie) For instance to programatically fill out a form?

John McCann

PostPosted: Wed Dec 01, 2004 6:36 pm
by Jan Blok
No not possible but maybe we could build a merge function for PDF forms based on the lib used by the pdf printer plugin