Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TIFF image viewer on VFP form

Status
Not open for further replies.

ravicoder

Programmer
Apr 29, 2006
30
IN
Hello all

I need to build an application where functionality is needed to view a TIFF or PDF image - pagination, zoom, annotation etc - mainly TIFF images. I have scoured the net for a functioning image viewer but not able to get a suitable answer to my requirements. I have tried the KODAK image activex control but it does not give any option for moving among pages.

Would greatly appreciate if someone could help me with this.

Thanks
 
This has come up several times over the years. You could try searching past threads for a solution (if you haven't already done so).

One product that I have seen recommended in various places is Viscomsoft's Activex viewer ( I haven't used it myself, so this isn't a personal recommendation.

To display PDFs, you could embed the standard web browser control that comes with VFP, then navigate to the relevant file. Or, if you can accept the PDF appearing in its own window, you can simply ShellExecute the file.

If you don't know how to do any of the above, come back here.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
As far as we know, there are only two decent PDF ActiveX viewers. One is from Viscomsoft (as Mike mentioned) and the other is from Foxit Software. We tried both and decided on Foxit - much more robust with comprehensive API. Also, you don't have to install the retail Foxit viewer to use it. However, some of the UI elements are outdated, so we built our own using the API (see bottom navigation | viewing bar in example below). Note: This product is not cheap - these days, you get what you pay for.

Capture5_xbw9lb.png
 
you can use VFPX imaging to extract individual pages from a tiff, save as .png and then use VFP's native image viewer to view one page at a time.

[pre]do system.app
loDrawing = _SCREEN.SYSTEM.drawing
logpimage = loDrawing.BITMAP.new(getfile("TIFF"))
logpimage.SelectActiveFrame(loDrawing.Imaging.FrameDimension.PAGE,0) && zero based page numbers
logpimage.SAVE("c:\temp\page1.png",loDrawing.Imaging.ImageFormat.png)
[/pre]

doesn't help you with zoom, annotation nor PDFs of course .....

n
 
Thanks all for the help

I was trying out image viewer cp and I was not able to find any method / property for moving between pages i.e. provide a button for next / previous page. Can anyone help on this please ?
 
The control does not provide buttons - or any other user interface elements. You have to do that yourself. Add two buttons to your form; in the click events, write code to move betweens the pages of the TIFF. To find out what code you need to write, you will have to look at the control's documentation (unless somebody here is familiar with it). You might also be able to figure it out via Intellisense.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Here is the online documentation for ImageViewer:
Viscomsoft has another product - PDFViewer: Here is the online documentation for PDFViewer:
We used to use PDFViewer years ago, but had to switch because it does not support multiple instances.
 
Based on the docs that Vernspace linked to, I can't see any methods for navigating between pages. But there is a method for splitting out the individual pages into separate files. That way, you can split the TIFF into a temporary file for each page. You could then display the pages in a native VFP image control. You would provide a Next Page and Previous Page button. In the buttons' Click events, you would set the control's Picture property to the relevant next or previous file. Finally, when you have finished, you would delete the temporary files.

The relevant method is TIFSplit(). There's also a property called GetTotalPage, which tells you how many pages the TIF has.

The above is based on my reading of the docs. I don't have the control installed, so I haven't been able to try any of this.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi,

Cesar made it possible with following code:'
Code:
DO LOCFILE("system.prg")

WITH _Screen.System.Drawing

   * Get the FullPath of the image
   LOCAL lcPict
   lcPict = GETFILE("tif")

   * Create a GDI+ image object with the original Image
   LOCAL loSrcBmp as xfcBitmap
   loSrcBmp = .Bitmap.FromFile(lcPict)

   * Resize the original image to this image object dimensions
   LOCAL loBmp as xfcBitmap
   loBmp = .Bitmap.New(loSrcBmp, This.Width, This.Height)

   * Get the PictureVal of the image, and update this control
   This.PictureVal = loBmp.GetPictureValfromhBitmap()

ENDWITH

Stsy healthy,
Koen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top