Page 1 of 1

Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 9:01 am
by driessen
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.

Re: Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 1:29 pm
by nageswaragunupudi
I need to transfer a PDF-document with several pages, to a Word-document.

Code: Select all | Expand

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

Re: Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 2:50 pm
by driessen
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.

Re: Combination of PDF and Word-document - rpreview

Posted: Wed Aug 07, 2024 3:59 pm
by Otto
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
Image