Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150

    MS Access - PDF thumbnail solution ??

    Hi,

    Trying to implement a thumbnail preview window (say 1" x 1" box) that will preview the full
    image in the box, regardless of its dimensions. JPEGs / PDFs. A TURNKEY solution that is robust and needs no support.

    Web browser control doesn't work because they did not implement a STRETCH property.

    Adobe Acrobat's ActiveX control might work but that means installing this on every single client that would use this DB, right? (or would it remain with the DB?). Even
    if the control was embedded in the DB file, this is still lousy on Adobe's part. The control itself is version specific to Adobe Reader, which makes this a PITA to support.

    Ideas?

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,421
    Only way I can suggest is use a picture control which has the stretch/zoom features you require. However if you are talking about images of the first page say of a pdf file, create an image of the first page

    with regards the latter this link may be of interest and also has links for ways that might work for you

    https://stackoverflow.com/questions/...ccess-with-vba
    Also investigate WIA, but that might have been deprecated

    I suspect the VBA actions will be

    open required file if not already open
    move to top of document (if was already open)
    take screenshot of file window and copy to clipboard (will only do what is in window)
    restore scrollbar position (if file was already open)
    close file - if not previously open

    convert clipboard to BMP file
    convert BMP file to PNG file
    save PNG file in a directory
    save path to PNG file to database

  3. #3
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150
    AJAX,

    Thanks for your help with this. Your solution looks like it might work. I hadn't thought about that.

    Yes, my goal is to just have the first apge of the PDF/image be displayed. I will see what I can work up and report any solution back to the forum!

    Thanks so much

  4. #4
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    IIRC, the bound object control will display an image of a document with the added benefit of being able to open it in the native app via double-clicking. Maybe that's of no use, but hey...
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,918
    AFAIK, BoundObjectFrame control must be bound to OLEObject field. This means documents are embedded in db using up Access 2GB file size limit. Apparently, OLEObject results in even larger file size than Attachment field.

    Users might not find the OLEObject dialog intuitive.

    Tested and it does work to display first page of PDF.
    Last edited by June7; 07-22-2019 at 07:40 PM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    you're correct so I didn't recall correctly. It's unbound frame, not bound. Object does not have to be embedded or in a table.
    Last edited by Micron; 07-22-2019 at 05:48 PM. Reason: added info

  7. #7
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150
    Hi,

    So, i am still researching... I must admit, this is a tough one to find a "quick solution", let alone one with a free license.

    To define my situation:

    The user would scroll through some PDF files (or JPEG) on the form and a thumbnail would display for each file they scroll through. If they required to open it, they could but the main point here is just convenience, which is the purpose of a thumbnail i suppose.

    The files in question would be external to the DB. I would want to write a sub that takes in a path argument and generates the thumbnail.

    The screen-shot method from what I understand requires an assumption that the client has a specific .PDF reader, right? I could perhaps force the code to open the PDF in native windows photo viewer so that the code was consistent and worked. But this solution would also require all this to be hidden, of course. I'm just questioning this approach and whether it is consistent over the life of the application.

    However, the second method Micron mentioned (Bound Object Control)... I never used this control. I am reading... Is there a way to set a source object to just a path? This will accept PDFs and JPEGs?


    Thanks for your help everyone
    Regards

  8. #8
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,421
    the client has a specific .PDF reader, right?
    I would think most machines come with a pdf reader as standard - using 'followhyperlink' should obviate the need for a specific application. If using 2013? then word will open the doc.

    But this solution would also require all this to be hidden
    I don't believe you can screenshot a hidden window, but could be wrong - however would only expect it to be a fraction of a second so perhaps would appear as a flicker to the user or perhaps turning off screen updates for the process might work. I was assuming this was being done as part of a record save/update process.

  9. #9
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    Is there a way to set a source object to just a path? This will accept PDFs and JPEGs?
    You click the "Link" option when setting to set only a path. I don't believe it will display pictures at all. Have to say I've hardly (if ever) used this control so don't read too much into my suggestion. I just knew of how it displays an image of a document and how you can activate the native app by double clicking. It seems that you cannot insert one without the wizard and you would need to be able to alter the source doc property in vba if navigating among records. I don't recall if you posted what kind of form you had in mind but suspect it's best suited for single record. Would be interesting to know what happens in a continuous form but I suspect it wouldn't work.
    EDIT: Don't forget. I was corrected; I'm now referring to an unbound control.

  10. #10
    ironfelix717 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Oct 2018
    Posts
    150
    Quote Originally Posted by Ajax View Post
    I don't believe you can screenshot a hidden window, but could be wrong - however would only expect it to be a fraction of a second so perhaps would appear as a flicker to the user or perhaps turning off screen updates for the process might work. I was assuming this was being done as part of a record save/update process.
    Ajax, this is strictly for viewing the content as they scroll through it. The flicker would unfortunately be undesirable.


    Micron:
    The form would be unbound. I don't build bound applications. VBA is no limitation, the limitation here is getting the actual functionality to either...

    1.) Display a preview of a PDF file
    2.) Convert a PDF file cover page to image

    Either are a solution. If the OLE object control will display the preview of a file, then that is the solution. If it will not display the preview of a JPEG, then that can easily be fixed by replacing/hiding that control on the fly with an image control in the event that the user select a non-pdf file.

    I will play around with this and see if it works.


    The last resort approach will unfortunately have to be writing a Python or Java 'middle man' to do this and call it from Shell in VBA and pass the arguments I need into it. No idea how this will perform in terms of speed.


    Regards

  11. #11
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,421
    your comments

    The user would scroll through some PDF files (or JPEG) on the form and a thumbnail would display for each file they scroll through.


    and

    this is strictly for viewing the content as they scroll through it.


    seem at odds with each other - are you expecting a user to scroll through a thnumbnal?

  12. #12
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    The user would scroll through some PDF files (or JPEG) on the form and a thumbnail would display for each file they scroll through.
    Ajax, I think I was looking for clarification on that too in post 9. Didn't get it...
    I don't recall if you posted what kind of form you had in mind but suspect it's best suited for single record. Would be interesting to know what happens in a continuous form but I suspect it wouldn't work.

  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,918
    I tested using an external path as ControlSource of BoundObjectFrame and it fails.

    I could not see any way to use UnboundObjectFrame to dynamically display external files. If there is VBA to accomplish this, I have not found it. Loading a PDF file into control sets following properties:

    OLEClass: Adobe Acrobat 8.0
    Class: AcroExch.Document.11

    Nowhere do I see name of file loaded.

    I have seen code to load and extract files from OLEObject field but it is very complicated. I have had only partial success with code. www.lebans.com/oletodisk.htm

    An Image control cannot display PDF file, hence suggestion by Ajax for other image type.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  14. #14
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,799
    I tested using an external path as ControlSource of BoundObjectFrame and it fails.
    I have managed to find a sample db for what you tried and it seems to work using string paths in table.

    I wasn't able to get an unbound frame to update (at least on a click event), at one point getting an error that said I could not do this in the event I was using, or some such thing. What I've read points to this being possible in the current event though. I also found that the unbound OLEclass property cannot be changed, not even in design. So this comes down to whether or not OP can use Bound frame with table paths and maybe whether or not all doc types are the same. I have no idea if it will accept word for 1 record and pdf for another at this point and there wouldn't be much use in attempting that if it's not a requirement.

    Also just noticed that the bound frame Class property isn't there in this test db, so that might be a good sign. It would seem that this point from post 5 is not quite correct after all
    AFAIK, BoundObjectFrame control must be bound to OLEObject field

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,918
    Interesting, I tried setting BoundObjectFrame ControlSource to field with string path, also tried static text. Neither method displays object. So how is this accomplished in the sample db?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 07-05-2018, 06:42 AM
  2. Show thumbnail for video on MS Access form
    By gem1204 in forum Forms
    Replies: 10
    Last Post: 09-19-2016, 10:30 AM
  3. Access Solution Inquiry
    By JeRz in forum Access
    Replies: 5
    Last Post: 09-06-2016, 07:01 AM
  4. Converting an Excel Solution to Access
    By rockym567 in forum Database Design
    Replies: 3
    Last Post: 05-13-2016, 05:17 AM
  5. Replies: 8
    Last Post: 11-10-2014, 01:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums