Tricky? Open 2 PDF's Tiled Vertically....

themanof83

Registered User.
Local time
Today, 16:37
Joined
May 1, 2008
Messages
73
Hey guys,

Not sure where to start with this one. Basically, I want to open two pdf's on the click event of a button but have them appear in Adobe Reader side by side for comparison. This can be done manually when the PDF's are open by going through the various menu's in Adobe Reader or by pressing Alt - W, T, V.

I was wondering whether a Macro or something similar can be run in the code of the on-click event, but I have no experience with them.

Any help would be grateful.

Thanks.
 
What Code are you currently using to open a PDF file now?

Obviously, you will need to open two instances of Adobe (or some other PDF file reader) in order to view both files. You can use Windows API functions to size and position each PDF File but.....It's far easier to view both files within one instance of Adobe Reader itself and merely vertically Tile the two documents within the Reader application.

Here is some sample code which demonstrates how to pull PDF files stored within a Table (Paths and File Names) and display them vertically tiled within Acrobat Reader so that they can be visually inspected or compared:

Code:
[COLOR="DarkGreen"]'Declare Variables...[/COLOR]
Dim rst As Recordset
Dim StrgSQL As String
   
[COLOR="DarkGreen"]'Store our Query into the StrgSQL string variable.[/COLOR]
StrgSQL = "SELECT * FROM tblPDFs WHERE PDF_ID = 1 OR " & _
          "PDF_ID = 4 ORDER BY PDF_File ASC;"
[COLOR="DarkGreen"]   
'Open the Recordset based from our Query (above)[/COLOR]
Set rst = CurrentDb.OpenRecordset(StrgSQL, dbOpenSnapshot)
   
[COLOR="DarkGreen"]'Enumerate through the Found Records.[/COLOR]
Do Until rst.EOF
   [COLOR="DarkGreen"]'Open the Document within Acrobat Reader.[/COLOR]
   Application.FollowHyperlink rst!PDF_Path & rst!PDF_File, , True
   [COLOR="DarkGreen"]'Move to next record within the found Recordset.[/COLOR]
   rst.MoveNext
Loop
  
[COLOR="DarkGreen"]'Close the Recordset.[/COLOR]
rst.Close
[COLOR="DarkGreen"]'Free memory[/COLOR]
Set rst = Nothing
   
[COLOR="DarkGreen"]'Vertically Tile The opened Documents within Adobe Reader.[/COLOR]
SendKeys "+^(l)"  'Shift-Ctrl-L

.
 
Excellent, thanks for the response Cyberlynx. I didn't know about the SendKeys function very handy!!
 
Personally themanof83, I hate the function and basically never use it. I find it clunky and only good until a menu change happens with the application you are using it against. For certain things...fine...for this accessing the menus of another application...I don't care for it. If you check the Adobe SDK there may be a far more reliable method for getting the reader to do this through one of their API's.

This is just a fast solution and not one I am keenly happy about, and now you know why :D

.
 

Users who are viewing this thread

Back
Top Bottom