Displaying a PDF

I found simple way but only to show and print PDF files in Xojo (Windows). It is PDF-XChange Viewer Simple DLL SDK. It is free, but everything what you can do is to show and print PDF files.

First you must add ActiveX to project.

Then for simple viewing:

dim link as string = "C:/Simplepdf.pdf"
pdf_ActiveX.Src = link

and for PDF printing:

pdf_ActiveX.Print

There is also free version of Debenu Quick Pdf library which you can use for creating PDF files. Combination of this two free ActiveX controls is the way you can add PDF functionality to your project.

Disclaimer - maybe I am missing the point.

On Win - tested on XP and Win7 - make sure Acrobat Reader is installed ( this is pretty normal to have on a PC unless you are antedeluvian. ) Two options:

  1. Load up a WebBrowser OLE control and use that ( ie: MSIE ) which in turn will use the Acrobat plugin.
  2. Load up an Acrobat Reader OLE object and use that.

I have had no issues printing, as the AR takes control of the PDF.

If anyone wants the sample project just say so. ( Errors and Omissions, crap from a hobby programmer, exceptions escluded :wink: ).

[quote=182339:@Peter Job]On Win - tested on XP and Win7 - make sure Acrobat Reader is installed ( this is pretty normal to have on a PC unless you are antedeluvian. ) Two options:

Load up a WebBrowser OLE control and use that ( ie: MSIE ) which in turn will use the Acrobat plugin.
Load up an Acrobat Reader OLE object and use that.
I have had no issues printing, as the AR takes control of the PDF.[/quote]

Ok, but trick and aim od my example is to be Acrobat independent! You can offer PDF functionality without verifying if user have installed Acrobat Reader.

Only the demo is free according to their site. Once you go to production it is most definitely not free.

For the simple functions, basic PDF creation and showing and printing PDF files you can use and distribute it without limitation.

Here is window from my application where I use PDF for viewing and printing drug recipes (PDF-XChange Viewer Simple DLL ).

There are some examples of using Quick PDF library at this forum.

I see it now. Their site is very confusing about this.

Another way to display a pdf in Windows is to use a shell. Execute the folderitem’s NativePath and the default pdf viewer will launch and display it.

If Chrome is installed, it is a great way to display PDF. Windows 8 and 8.1 as well as 10 have an app more or less like Preview which displays PDF. Finally, the Edge browser (formerly Project Spartan) displays natively PDF.

Finally, after all these years, Microsoft has discovered PDF :wink:

I use a build in Xojo HTMLViewer with the native renderer for Window, Linux and OS X in my projects.
Const langHelpFile As String = “MyApplicationHelp.pdf”
dim MyHTMLView as HTMLViewer
In the open event:
dim f as FolderItem
f = app.executablefile.parent.child(“Resources”).child(langHelpFile)
if f <> nil then
if f.Exists then
me.LoadURL f.URLPath
end if
end if

That’s all. No plugin, no, dll, no ActiveX, no PDF writer. This is tested with Windows7, Windows8, Windows10 and Mac OS X 10.0 - 10.11

I would read that: "Finally after all these years, Microsoft has surrendered to PDF :wink: "

PDF display via HTMLViewer requires a PDF plugin to be installed…

And there is not much influence on that plugin from the host app.

Good for them. I can understand they want to have their own electronic paper standard, but really, XPS is such a joke, somebody must have told them how ridiculous they were. For once her majesty Microsoft had to eat its own hat :slight_smile: