Recent

Author Topic: Form as PDF, DOC, XLS, PPT and JPG viewer  (Read 24290 times)

rajivsoft

  • New Member
  • *
  • Posts: 48
Form as PDF, DOC, XLS, PPT and JPG viewer
« on: April 05, 2011, 10:53:39 am »
Hi all,
I need to create a form that will be a viewer for all common documents and images, i only need to view them, no edit. For JPG and other images it's quite easy, but what to do with PDF, DOC, XLS and PPT? What can you advice?
Thanks.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8267
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #1 on: April 05, 2011, 11:15:59 am »
Difficult, currently we only have fpspreadsheet that can read some Excel formats but that's all. PDF is easy to generate but quite difficult to make a reader for, DOC is worse, undocumented proprietary format, same case with PPT. Only the new ???x (docx, xlsx, pptx) format is documented (it uses Microsoft OpenXML format).

rajivsoft

  • New Member
  • *
  • Posts: 48
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #2 on: April 05, 2011, 12:37:00 pm »
Difficult, currently we only have fpspreadsheet that can read some Excel formats but that's all. PDF is easy to generate but quite difficult to make a reader for, DOC is worse, undocumented proprietary format, same case with PPT. Only the new ???x (docx, xlsx, pptx) format is documented (it uses Microsoft OpenXML format).
All yesterday and today i'm reading about this... For now my solution is to open PDF in default Mac OS viewer (by " Shell('Open ' + file_name); " and to open DOC, XLS and PPT with NeoOffice (by " Shell('Open -a "NeoOffice" ' + file_name); ", but this mean to force my users to install NeoOffice, but it's not all that problem because on Win they need to install MS Office to use this feature).
Also i have read about possible conversion of PDF to an image by imagemagic but without integration in form of also word formats it's quite useless... then i'v discovered Pascal UNO bridge but i have no clue of how it works (how to use it? my users need to install X11 OpenOffice or NeoOffice is ok?), is there any example for Mac?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8267
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #3 on: April 05, 2011, 07:41:31 pm »
Actually, assuming all of your users have internet connection, you can use many online web service to convert those files into an image then simply display them.

circular

  • Hero Member
  • *****
  • Posts: 3451
    • Personal webpage
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #4 on: April 05, 2011, 08:04:07 pm »
I had done a reader for Excel 2.0 to 97 in Delphi.

I suppose it could be ported.

It's here :
http://consume.o2switch.net/Excel97read.zip
Conscience is the debugger of the mind

Leledumbo

  • Hero Member
  • *****
  • Posts: 8267
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #5 on: April 05, 2011, 08:10:10 pm »
Quote
I had done a reader for Excel 2.0 to 97 in Delphi.

I suppose it could be ported.
FPSpreadsheet is already capable of doing that. Haven't seen your code, but are you sure it's free from direct Windows API code?

circular

  • Hero Member
  • *****
  • Posts: 3451
    • Personal webpage
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #6 on: April 05, 2011, 10:23:12 pm »
Are you sure ? On the wiki, it says that Excel3 and 4 reading is not implemented. And it says that formatting is not supported.

I looked at the code, and yes, it uses API for reading OLE compound. But I suppose compound reading is already included in FPSpreadsheet, so by combining FPSpreadsheet and this unit, I suppose it could be possible to read all formats.
Conscience is the debugger of the mind

Leledumbo

  • Hero Member
  • *****
  • Posts: 8267
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #7 on: April 06, 2011, 07:21:03 am »
Quote
re you sure ? On the wiki, it says that Excel3 and 4 reading is not implemented. And it says that formatting is not supported.
Ah, yes. Sorry.
Quote
I looked at the code, and yes, it uses API for reading OLE compound. But I suppose compound reading is already included in FPSpreadsheet, so by combining FPSpreadsheet and this unit, I suppose it could be possible to read all formats.
OK, next problem: who wants to do this?

circular

  • Hero Member
  • *****
  • Posts: 3451
    • Personal webpage
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #8 on: April 06, 2011, 08:43:28 am »
Good question. Maybe rajivsoft.
Conscience is the debugger of the mind

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #9 on: April 06, 2011, 01:29:28 pm »
http://wiki.lazarus.freepascal.org/fpvectorial can read PDF files, but not fully, only vector graphics at the moment.

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #10 on: April 06, 2011, 01:31:48 pm »
Are you sure ? On the wiki, it says that Excel3 and 4 reading is not implemented. And it says that formatting is not supported.

The code has a good structure and is extensible, so adding formatting support to fpspreadsheet is not hard.

Quote
But I suppose compound reading is already included in FPSpreadsheet,

Yes, it is.

Quote
so by combining FPSpreadsheet and this unit, I suppose it could be possible to read all formats.

It's probably easier to implement the missing formats by copying from other existing readers.

Having said that, Excel 3 and 4 are pretty much dinossaurs. Your probability of finding them out there is virtually zero.
« Last Edit: April 06, 2011, 01:38:12 pm by felipemdc »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3541
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #11 on: April 06, 2011, 01:45:32 pm »
I have a long term idea of implementing fpdocument. It would be like fpvectorial, or fpspreadsheet, but it would be able to read/write multi-page documents composed of rich text, raster images and vectorial images. It would delegate individual parts of reading to fcl-image and fpvectorial as needed and parse the rich text. It would support formats like DOC and PDF. It could potentially cover PPT too. But I have no time =)

circular

  • Hero Member
  • *****
  • Posts: 3451
    • Personal webpage
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #12 on: April 06, 2011, 06:43:39 pm »
Having said that, Excel 3 and 4 are pretty much dinossaurs. Your probability of finding them out there is virtually zero.
That's right.

About your long term idea, it's clear that it would take a long time.  :D
Conscience is the debugger of the mind

rajivsoft

  • New Member
  • *
  • Posts: 48
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #13 on: April 13, 2011, 05:17:57 pm »
And what is the best way or the best component to use for realize a jpeg/png/gif viewer with resampling?
« Last Edit: April 13, 2011, 05:42:34 pm by rajivsoft »

circular

  • Hero Member
  • *****
  • Posts: 3451
    • Personal webpage
Re: Form as PDF, DOC, XLS, PPT and JPG viewer
« Reply #14 on: April 13, 2011, 09:47:25 pm »
I suppose with a TImage you can show these images and stretch them.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018