Displaying a .PDF or a .DOCX file

I have an “instruction sheet” (.PDF and/or .DOCX file) that I’d like to display in when a user presses the “info” button.

Just getting back into Clarion and can’t figure out how to do this…any suggestions?

I’m in Clarion v12 if it makes a difference.

If you own ChromeExplorer from CapeSoft, displaying the PDF file would be very easy.
See “View PDF File Directly on Clarion Window View PDF File Directly on Clarion Window”
https://capesoft.com/accessories/chromeexplorersp.htm

Thanks Nardus…I was hoping for a “cheaper” way. I’m looking at just using a help file.

Do you want to open it in a Clarion Window or is opening it in an external app good enough?

use RUN to run the pdf. It should work by loading the default pdf program.

1 Like

All good suggestions here, if you want your own COM control that does exactly what you want (because you tell the AI what you want it to create). Stop by one of the ClarionAI Workshop Code-A-Thon sessions next week! We’re making COM controls for whoever stops by. For what you’re looking for, it will probably take less than 20 minutes from creation to implementation in your Clarion program.

Stop by www.clarionlive.com for more information about the Code-A-Thon! It’s five sessions over five days, with each session lasting two hours. We’ll be coding COM controls you can use in your Clarion apps, all free, and a great introduction to what AI can do to help you add value to your Clarion apps!

If you can’t make it to any of the sessions, email me at www.clarionlive.com and tell me what you need, and I’ll make the COM control for you, no charge!

– John Hickey
[email protected]
www.clarionlive.com

1 Like

Nardus, I was looking to open it in a window, but external, such as a web page would work also.

Now I feel foolish…
Previously I had my PDF editor open with the instructions displayed. When I used the RUN command, it didn’t appear to do anything because I already had the PDF open.

Just a minute ago, I again tried the RUN command, PDF editor closed, and like magic, the editor opened and displayed the sheet as intended!

I’ve signed up for the Code-A-Thon, but is there a way, without purchasing a $400 accessory to show this in a window in my app rather than opening the editor?

And thanks for the help with this.

I probably won’t be able to make it to the sessions but I would be very interested in seeing how to make a PDF viewer com control, so if you can make that session available off-line I would greatly appreciate it.

There is nothing you need to pay for at the Code-A-Thon. If after the Code-A-Thon you decide you want to make your own COM (Activex) controls, you can get started using Claude Code for $20 a month and that’s all you’d need. I’ve already created an HTML viewer as well as a Preview control that lets you preview pdf, word docs, jpg, etc. that would probably work for you as-is.

I’ll go over installing the UltimateCOM template and class, and show how to use the Clarion COM Exchange to retrieve COM controls that the community is sharing.

I look forward to seeing you at the Code-A-Thon!

– John

2 Likes

You bet, all sessions will be available on YouTube for viewing! Also on www.clarionlive.com, we take a transcript of the sessions and convert them to a nice summary and chapters, so you can read what happened in the session and jump right to the place in the recording that interests you!

– John

5 Likes

Besides Capesoft Chrome Explorer, you can display a pdf inside your Clarion app using the WPViewPDF Control Wrapper addon tool from Klarisoft.com without using Adobe or a browser PDF viewer.
I have a browse list that shows all the pdf reports the user has created (using DIRECTORY). With WPViewPDF next to the list, the user can quickly scroll through all their reports.

I do this via an OLE control in Clarion 10 .. Shell.Explorer.2
Load the file .. ?OLE{‘Navigate(“myFilename.pdf”)’}
I have Acrobat Reader installed, it uses this somehow to display the PDF in the window control.
Apart from needing Acrobat Reader, all is nice and neat, just one line of code to load the PDF into one of my application windows.

I see there’s a AcroPDF.PDF.1 as well, not tried that.

Julian, keep getting errors about not finding the file and illegal characters. Can you detail how you call the file in the OLE field?

Here’s some code ..

PDFTest  PROCEDURE
                                                                     
szFilename  CSTRING(256)

Window      WINDOW('Caption'),AT(,,395,444),GRAY,FONT('Segoe UI',10)
               OLE,AT(9,7,367,423),USE(?OLE),CREATE('Shell.Explorer.2')
               END
               BUTTON('OK'),AT(335,433,41,10),USE(?OkButton),STD(STD:Close),FONT('Segoe UI',10)
            END

   Code                                         
      szFilename = '"C:\Temp\ASCII-Table.pdf"'
      
      OPEN(Window)
      ACCEPT
         CASE Event()
         of EVENT:OpenWindow
            ?OLE{'Navigate(' & szFilename & ')'}
         .
      .  
      CLOSE(WINDOW)    
 

which results in this ..

2 Likes

you can try : Free PDF Reader - Sumatra PDF
its a very good pdf reader and you can control with command line options.

1 Like

One vote for Sumatra, I keep it in folder with my app, only one exe file and one txt for configuration. It can be configured to close with ESC key, so for end user same experiance.
EscToExit = true

Petar

Example from my code:
PDFFile=CLIP(GLO:EfakturePath)&CLIP(LocDodatak)&CLIP(NAR:BR_Tekuceg)&‘.pdf’
IF Exists(PDFFile)
RUN(CLIP(GLO:rootpath)&'\sumatra.exe '&CLIP(PDFFile))
END

1 Like

FYI, Easy Edge (Chromium) from Ingasoftplus has a feature to programmatically perform a search in opened PDF document.

1 Like