FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Combination of PDF and Word-document - rpreview
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM

Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 09:01 AM

Hello,

In my application, I need to transfer a PDF-document with several pages, to a Word-document.

I want to do that in the same way a report in RPREVIEW.PRG is exported to a Word-document.

The result has to be a image of every page in my PDF-document on a page in the new Word-document.

I did have a look at RPREVIEW.PDF, but the big difference is the fact that I start with an EMF-document, and not a PDF-document.

Anyone any suggestions?

Thank you very much in advance.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 01:29 PM
I need to transfer a PDF-document with several pages, to a Word-document.
Code (fw): Select all Collapse
function PdfToWord( cPdf )

   local oWord

   if !File( cPdf )
      ? cPdf + " not found"
      return nil
   endif

   if ( oWord := WinWordObj() ) == nil
      ? "Word not loaded"
      return nil
   endif

   oWord:Documents:Open( TrueName( cPdf ), .f. )
   oWord:ScreenUpdating := .t.
   oWord:Visible := .t.

return nil
Regards



G. N. Rao.

Hyderabad, India
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM

Re: Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 02:50 PM

Mr. Rao,

Thank you for trying to help me.

I did a test with your suggestion. Unfortunately there are 2 problems

  1. The layout of the document is completely wrong.

  2. The PDF is converted to editable text. But I need to have it as an image.

Any idea?

Thanks.

Regards,

Michel D.
Genk (Belgium)


_____________________________________________________________________________________________

I use : FiveWin for (x)Harbour v. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 6984
Joined: Fri Oct 07, 2005 07:07 PM

Re: Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 03:59 PM
Hello Michel,
In my DMS, I have solved it by monitoring the directory with a timer.
If a new file, such as a PDF, WORD, RTF, etc., is added to a directory,
a preview is created as a JPG.
The original file is opened, and a screenshot is automatically created, which is then saved as a JPG.
Best regards,
Otto

Continue the discussion