Re: Best scripting language to use with LEP (docx to PDF)

2019-04-07 Thread Pat Bensky via 4D_Tech
That's a great component that works very well for converting HTML to PDF.
Sadly it doesn't work for our project, because our documents are created
using 4DWritePro. Converting them to HTML loses some vital formatting -
most importantly, things like text columns on a page. I suppose this could
be fixed by putting the text into tables, but there are various problems
with that - the page formatting goes a bit haywire, and in WP you cannot
have tables within tables, so it would not be possible to produce a
document that has both text columns and tables within those pages 

So ... back to the scripting drawing board ...

Pat

On Sat, 6 Apr 2019 at 13:12, Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> if you go down the automation (applescript) route,
> be sure where you create the result document.
>
> Word is sandboxed, so you can only export to the temporary folder
>
> in 4D code
>
> $path:=Temporary folder+"com.microsoft.Excel"+Folder separator
>
> this would be for CFBundleShortVersionString > 14 i.e. Office 2016 or
> later.
>
> c.f.
>
> https://github.com/miyako/4d-plugin-office-document-converter
>
> 2019/04/06 21:05、Pat Bensky via 4D_Tech <4d_tech@lists.4d.com 4d_tech@lists.4d.com>>のメール:
>
> If you use the Save As ... option in Word to create the PDF, it preserves
> the hyperlinks. If you just choose Print and choose Save as PDF, it doesn't
> preserve the links.
>
>
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Best scripting language to use with LEP (docx to PDF)

2019-04-06 Thread Keisuke Miyako via 4D_Tech
if you go down the automation (applescript) route,
be sure where you create the result document.

Word is sandboxed, so you can only export to the temporary folder

in 4D code

$path:=Temporary folder+"com.microsoft.Excel"+Folder separator

this would be for CFBundleShortVersionString > 14 i.e. Office 2016 or later.

c.f.

https://github.com/miyako/4d-plugin-office-document-converter

2019/04/06 21:05、Pat Bensky via 4D_Tech 
<4d_tech@lists.4d.com>のメール:

If you use the Save As ... option in Word to create the PDF, it preserves
the hyperlinks. If you just choose Print and choose Save as PDF, it doesn't
preserve the links.



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Best scripting language to use with LEP (docx to PDF)

2019-04-06 Thread Pat Bensky via 4D_Tech
Miyako,

>
> but my understanding is that
> Word on Windows embeds hyperlinks when exporting to PDF,
> whereas Word on Mac doesn't (same with any app that performs print-to-pdf
> using the system feature)
>
If you use the Save As ... option in Word to create the PDF, it preserves
the hyperlinks. If you just choose Print and choose Save as PDF, it doesn't
preserve the links.

I will certainly check out your component.
Pat

>
> another approach maybe to use wkhtmltox
>
> https://github.com/miyako/4d-component-wkhtmltopdf
>
> a variety of options is available
>
> https://wkhtmltopdf.org/usage/wkhtmltopdf.txt
>
>
>
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Best scripting language to use with LEP (docx to PDF)

2019-04-06 Thread Keisuke Miyako via 4D_Tech
I might be mistaken,

but my understanding is that
Word on Windows embeds hyperlinks when exporting to PDF,
whereas Word on Mac doesn't (same with any app that performs print-to-pdf using 
the system feature)

another approach maybe to use wkhtmltox

https://github.com/miyako/4d-component-wkhtmltopdf

a variety of options is available

https://wkhtmltopdf.org/usage/wkhtmltopdf.txt



**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Epperlein, Lutz (agendo) via 4D_Tech
Hi Alexander,

Some time ago we gave this tool a try. The results were really good.
There were two versions of the tool, the Total Doc Converter for desktop use 
and the Total Doc ConverterX for server use.

The testing of the desktop version shows a dialog with a progress bar, this is 
rather a showstopper for server use. Testing the server version was not 
possible at this time, there were only a trial version of the desktop variant 
available. And we don't want to buy a pig in a poke, too much bad experiences 
especially in this area.
But I see just now there is a trial version of Total Doc ConverterX too. 
That's new. We will give it a try again, I think.

Thanks
Lutz Epperlein


> For conversion to and from doc/docx (pdf/html/rtf/etc.) we have been using 
> an external
> tool (with command line interface).
> It does not require MS Word but you need to install the Office compatibility 
> library
> from MS (free).
> It works well as service and is quite stable, the results are good enough 
> for us.
> The tool is called Total Document Converter by CoolUtils.
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Epperlein, Lutz (agendo) via 4D_Tech
> An easy way to create Word files is:
> - create a file in XML format
> - Change the file extension from xml to docx
>
> Voila! AS long as your XML is well-formed and conforms to the Open XML
> standard, it works a treat.

That's nearly the same we do. With the difference that we don't create plain 
xml, we use templates generated from real docx files because of the complexity 
of the MS Word documents. At last this is XML  too.
More see in the mentioned thread "Creating Word docs in 4D" here at the iNUG.

Regards
Lutz

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Pat Bensky via 4D_Tech
An easy way to create Word files is:
- create a file in XML format
- Change the file extension from xml to docx

Voila! AS long as your XML is well-formed and conforms to the Open XML
standard, it works a treat.
Seee https://en.wikipedia.org/wiki/Office_Open_XML

On Fri, 5 Apr 2019 at 12:32, Epperlein, Lutz (agendo) via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> Regarding the topic: MS Word on the server
>
> In the past we use the following approach to generate native .doc files:
> - The application on the server generated reports as html files
> - These files got an extension .doc
> These files were able to open in MS Word.
> But there were problems e.g. if you wanted to forward these generated .doc
> files via e-mail. They lost the property to render as a MS Word document,
> they
> were plain .html files again.
> So we did the following trick:
> - We installed MS-Word on the server.
> - And then we started a script (VBS in this case) ...
> - .. to open the document in MS Word and to save it as a native MS
> Word-document in format .doc
> - (It could be possible to generate PDF documents as well this way.)
>
> Now we use another approach (see the thread "Creating Word docs in 4D").
> Installing and using MS Word on a server in a context of Windows services
> is a
> rather bad idea. This is anything else but reliable.
>
> The in the mentioned thread described process to generate .docx documents
> works well and is reliable. Now we have the requirement to convert these
> rather complex MS Word documents to PDFs. We didn't found a good solution
> yet.
>
> Regards
> Lutz
>
>
>
> > -Original Message-
> > Subject: Re: Best scripting language to use with LEP (docx to PDF)
> >
> > Good questions Lutz :)
> > I'd like to think that it will work when running as a service as long as
> a)
> > it runs silently and b) Word is installed on the server. But that is
> > certainly something that will need to be tested.
> >
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Herr Alexander Heintz via 4D_Tech
For conversion to and from doc/docx (pdf/html/rtf/etc.) we have been using an 
external tool (with command line interface).
It does not require MS Word but you need to install the Office compatibility 
library from MS (free).
It works well as service and is quite stable, the results are good enough for 
us.
The tool is called Total Document Converter by CoolUtils.
Easy to find on the web.

> Am 05.04.2019 um 13:32 schrieb Epperlein, Lutz (agendo) via 4D_Tech 
> <4d_tech@lists.4d.com>:
> 
> Regarding the topic: MS Word on the server
> 
> In the past we use the following approach to generate native .doc files:
> - The application on the server generated reports as html files
> - These files got an extension .doc
> These files were able to open in MS Word.
> But there were problems e.g. if you wanted to forward these generated .doc 
> files via e-mail. They lost the property to render as a MS Word document, 
> they 
> were plain .html files again.
> So we did the following trick:
> - We installed MS-Word on the server.
> - And then we started a script (VBS in this case) ...
> - .. to open the document in MS Word and to save it as a native MS 
> Word-document in format .doc
> - (It could be possible to generate PDF documents as well this way.)
> 
> Now we use another approach (see the thread "Creating Word docs in 4D").
> Installing and using MS Word on a server in a context of Windows services is 
> a 
> rather bad idea. This is anything else but reliable.
> 
> The in the mentioned thread described process to generate .docx documents 
> works well and is reliable. Now we have the requirement to convert these 
> rather complex MS Word documents to PDFs. We didn't found a good solution yet.
> 
> Regards
> Lutz
> 
> 
> 
>> -Original Message-
>> Subject: Re: Best scripting language to use with LEP (docx to PDF)
>> 
>> Good questions Lutz :)
>> I'd like to think that it will work when running as a service as long as a)
>> it runs silently and b) Word is installed on the server. But that is
>> certainly something that will need to be tested.
>> 
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Epperlein, Lutz (agendo) via 4D_Tech
Regarding the topic: MS Word on the server

In the past we use the following approach to generate native .doc files:
- The application on the server generated reports as html files
- These files got an extension .doc
These files were able to open in MS Word.
But there were problems e.g. if you wanted to forward these generated .doc 
files via e-mail. They lost the property to render as a MS Word document, they 
were plain .html files again.
So we did the following trick:
- We installed MS-Word on the server.
- And then we started a script (VBS in this case) ...
- .. to open the document in MS Word and to save it as a native MS 
Word-document in format .doc
- (It could be possible to generate PDF documents as well this way.)

Now we use another approach (see the thread "Creating Word docs in 4D").
Installing and using MS Word on a server in a context of Windows services is a 
rather bad idea. This is anything else but reliable.

The in the mentioned thread described process to generate .docx documents 
works well and is reliable. Now we have the requirement to convert these 
rather complex MS Word documents to PDFs. We didn't found a good solution yet.

Regards
Lutz



> -Original Message-
> Subject: Re: Best scripting language to use with LEP (docx to PDF)
>
> Good questions Lutz :)
> I'd like to think that it will work when running as a service as long as a)
> it runs silently and b) Word is installed on the server. But that is
> certainly something that will need to be tested.
>
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Pat Bensky via 4D_Tech
Good questions Lutz :)
I'd like to think that it will work when running as a service as long as a)
it runs silently and b) Word is installed on the server. But that is
certainly something that will need to be tested.

I am trying to find a solution that is very simple for users of all
technical abilities to use - ie something that requires no additional
software to be installed.
We are creating complex documents using Write Pro. They can be exported
directly to PDF but there are two problems with this:
1) You have no control over the resolution - they are always large,
high-res files.
2) (Most importantly) Any hyperlinks are lost.

The documents can also be exported to .docx format (starting with v17r4).
This works well, and the resulting documents can then be opened in Word and
saved as PDF with a choice of two resolutions, and the hyperlinks are
preserved. This is what we want to automate.

I don't know anything about Powershell scripting but I'll find someone who
does and give that a go. I've already got somebody working on an
AppleScript version. If there are any Powershell scripters on this forum
who would like to have a go at this, please contact me!

Pat

On Fri, 5 Apr 2019 at 09:15, Epperlein, Lutz (agendo) via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> The more interesting question is, at least from my point of view, which
> tools
> do you use for the conversion from docx to PDF. And do this tools work in
> a
> context of Windows service. Does the conversion works reliable if started
> from
> a 4D app running as a Windows Service.
>
> And as suggestion for a scripting language under Windows I second Tom's
> proposal: Use powershell.
>
> Regards
> Lutz
>
> > -Original Message-
> > Subject: Re: Best scripting language to use with LEP
> >
> > Hi Pat,
> >
> > I believe that PowerShell is included in all versions of Windows:
> >
> >
> https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-
> > powershell?view=powershell-6
> >
> > And I see that there is a version for MacOS too, but will need to be
> > installed:
> >
> https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-
> > core-on-macos?view=powershell-6
> >
> > Tom Benedict
> > >
> > > Windows
> > > Any suggestions as to which language would be best? PERL? Java?
> **
> 4D Internet Users Group (4D iNUG)
> Archive:  http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **



-- 
*
CatBase - Top Dog in Data Publishing
tel: +44 (0) 207 118 7889
w: http://www.catbase.com
skype: pat.bensky
*
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

RE: Best scripting language to use with LEP (docx to PDF)

2019-04-05 Thread Epperlein, Lutz (agendo) via 4D_Tech
The more interesting question is, at least from my point of view, which tools 
do you use for the conversion from docx to PDF. And do this tools work in a 
context of Windows service. Does the conversion works reliable if started from 
a 4D app running as a Windows Service.

And as suggestion for a scripting language under Windows I second Tom's 
proposal: Use powershell.

Regards
Lutz

> -Original Message-
> Subject: Re: Best scripting language to use with LEP
>
> Hi Pat,
>
> I believe that PowerShell is included in all versions of Windows:
>
> https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-
> powershell?view=powershell-6
>
> And I see that there is a version for MacOS too, but will need to be 
> installed:
> https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-
> core-on-macos?view=powershell-6
>
> Tom Benedict
> >
> > Windows
> > Any suggestions as to which language would be best? PERL? Java?
**
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**