Automatic PDF Conversion

Hi all!

I’m up to score for the upcoming Optimist North American Championships in June. Anyone who has scored for them recently will tell you that they have become increasingly strict about results formatting. At this point, I’m required to publish in black and white (sigh, no top three in colors!) and instead of publishing to a web site, I am to either deliver by thumb drive or email to their representative, who publishes results on their website.

Last time I did the Opti NAs I remember being pretty much at 100% just getting all results in the system, so I’m not too interested in adding more steps to my workflow.

So, since I’m a Linux user, my plan is to go ahead and publish html to a folder on our hosting service, then have a script there detect the new file, convert the HTML to PDF, and automatically email the results. I’m just about to get to work building the scripts.

Before I do, I just wanted to touch base to see if anyone else done anything like this? I think a PDF conversion and email module added to Sailwave would be marvelous, but I suspect that’s wishful thinking!

Hi Andy,

  Sailwave can email results already but only in HTML format in

case you did not know; either by linking to your default email
client or a built-in SMTP mailer. However, this might not work on
Linux; something for me to try next time I fire up one of my Linux
systems.

  I think Jon has in the past looked at including functionality in

Sailwave to generate PDF copies of the results. If I recall
correctly the code roughly doubled the size of the Sailwave
executable. Hopefully Jon will comment more appropriately on this.

  I like your solution for Linux as it in my view is perfectly

possible. Something I would consider if I was writing the code is
using ‘inotify’ functionality. Perhaps you already have that in
mind. I am willing to help you test a script.

  Agree the Optimist Class losing on eye catching presentation of

top 3 in colour and the tablesort functionality.

Kind regards,

Huw

···

On 13/05/2018 00:06, [sailwave] wrote:

andy@sailor.nu

Hi all!

            I'm up to score for the upcoming Optimist North

American Championships in June. Anyone who has scored
for them recently will tell you that they have become
increasingly strict about results formatting. At this
point, I’m required to publish in black and white (sigh,
no top three in colors!) and instead of publishing to a
web site, I am to either deliver by thumb drive or email
to their representative, who publishes results on their
website.

            Last time I did the Opti NAs I remember being

pretty much at 100% just getting all results in the
system, so I’m not too interested in adding more steps
to my workflow.

            So, since I'm a Linux user, my plan is to go ahead

and publish html to a folder on our hosting service,
then have a script there detect the new file, convert
the HTML to PDF, and automatically email the results.
I’m just abou t to get to work building the scripts.

          Before I do, I just wanted to touch base to see if anyone

else done anything like this? I think a PDF conversion and
email module added to Sailwave would be marvelous, but I
suspect that’s wishful thinking!


Virus-free. www.avast.com

The most recent versions of OS X and Windows both support print-to-PDF (and OS X has had it for several years at least, Windows 7 didn’t have it, Windows 8 might have, but I never ran 8). Linux can also support print-to-PDF after some tutorial following (iow, I don’t know if distros are shipping that). It should be feasible to generate the HTML, add a window.print() call in the onload() hook, and then trigger the browser to open like Sailwave already supports (it’s been a while since I ran Sailwave, so I can’t remember if it has direct print capabilities).

Might I suggest a slight tweak to your process? If possible, do the PDF conversion locally before posting onwards; this way you can do a quick skim of the files before emailing them, just in case Mr. Murphy takes an interest in your work.

Hi,

I agree with what you have said and confirm that Sailwave *** does
not*** directly print it publishes results as HTML.
Therefore one needs to select the print to PDF option you describe
when printing from a web browser.

  Andy is trying to eliminate this from his work flow when

producing results for the North American Optimist Championship
and make the generation of a PDF file of the results automatic.
Andy and I both know that it is possible on Linux system. It may
be possible to do on a Windows system as well but I have not
investigated such a process, but it is something I will do.

  As already mentioned in an earlier reply to the original message

in this thread, Jon has looked at including functionality to
generate a PDF of the results but had some problems one of which,
as I recall,l is the size increase of the executable.

Kind regards,

Huw

···

On 13/05/2018 19:33,
[sailwave] wrote:

flickr@cricalix.net

          The most recent versions of OS X and Windows both

support print-to-PDF (and OS X has had it for several
years at least, Windows 7 didn’t have it, Windows 8 might
have, but I never ran 8). Linux can also support
print-to-PDF after some tutorial following (iow, I don’t
know if distros are shipping that). It should be feasible
to generate the HTML, add a window.print() call in the
onload() hook, and then trigger the browser to open like
Sailwave already supports (it’s been a while since I ran
Sailwave, so I can’t remember if it has direct print
capabilities).

          Might I suggest a slight tweak to your process? If

possible, do the PDF conversion locally before posting
onwards; this way you can do a quick skim of the files
before emailing them, just in case Mr. Murphy takes an
interest in your work.


Virus-free. www.avast.com

A slight modification of this is to publish to an application, e.g.
Word or Excel, then print to PDF.

···
regards,
Malcolm Osborne
Rondevlei, South Africa
   On 2018-05-13 21:07, Huw Pearce

[sailwave] wrote:

Hi,

          I agree with what you have said and confirm that Sailwave

does not directly print it publishes results
as HTML. Therefore one needs to select the print to PDF
option you describe when printing from a web browser.

          Andy is trying to eliminate this from his work flow when

producing results for the North American Optimist
Championship and make the generation of a PDF file of the
results automatic. Andy and I both know that it is
possible on Linux system. It may be possible to do on a
Windows system as well but I have not investigated such a
process, but it is something I will do.

          As already mentioned in an earlier reply to the original

message in this thread, Jon has looked at including
functionality to generate a PDF of the results but had
some problems one of which, as I recall,l is the size
increase of the executable.

Kind regards,

Huw

huw.pearce@bcs.org.uk
On 13/05/2018 19:33, [sailwave] wrote:

flickr@cricalix.net

              The most recent versions of OS X and Windows both

support print-to-PDF (and OS X has had it for several
years at least, Windows 7 didn’t have it, Windows 8
might have, but I never ran 8). Linux can also support
print-to-PDF after some tutorial following (iow, I
don’t know if distros are shipping that). It should be
feasible to generate the HTML, add a window.print()
call in the onload() hook, and then trigger the
browser to open like Sailwave already supports (it’s
been a while since I ran Sailwave, so I can’t remember
if it has direct print capabilities).

              Might I suggest a slight tweak to your process? If

possible, do the PDF conversion locally before posting
onwards; this way you can do a quick skim of the files
before emailing them, just in case Mr. Murphy takes an
interest in your work.


Virus-free.
www.avast.com

There are a few possible solutions.

Option 1

The first thing to do is publish the results to your web browser. Which is very quick, and has a what I consider an important step in that you get to check the results are as you expect them. Many a time when I publish the results it becomes very obvious that I’ve forgotten a step or I’ve forgotten to set the publishing order to for the fleets, then use the Print to PDFin the browser this is very quick. You could print them to a DropBox or pCloud folder with predefined file names which have been shared with the person who wants them for the publishing this way once you print to PDF you have nothing else to do except notify them somehow they are updated. You could of course then email them but that is another process for the busy scorer so if it was me I would want to avoid this manual email step.

Note Chrome browser has built in print to PDF and with Windows 10 there is a Microsoft Print to PDF as well, I use the Chrome browsers print to PDF which works well

Option 2

This is an interesting one.

Use WKHTMLtoPDF to convert the HTML to PDF You can download this from https://wkhtmltopdf.org/

Then create a one line batch file with these contents (adjust if yours is located elsewhere)

“C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe” %1 SWout.pdf

I saved this file to C:\Users\Public\Documents\Sailwave\Extras\SWPDF.bat

Then publish as normal but to an installed application

image.png

For the Application give the name of the SWPDF.bat we created earlier

When you click publish, a PDF SWout.pdf is created (sample attached)

WKHTMLtoPDF is available for 32 and 64 bit windows as well as Mac and Linux

There is also a Python module which uses this called PDFKit.

Python can also send emails with attachments with only a few lines of code so if the application is a Python script you could very easily publish and email a PDF fully automatically. I would advise using the preview button to check the results first and then click publish if you are happy

If anyone needs any help with this let me know.

I think this is quite cool anyone else?

Jon


Mailtrack
Sender notified by

                [Mailtrack](https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&)
···

Jon Eskdale

03333 443377

07530 112233

Hi everyone reading this thread,

  Nice reply from Jon which has given me a new avenue to explore.

It will be interesting to hear from the author of the message that
started this thread to see what they decided to do and how.

  A word of caution for those users of Sailwave who score

International events/regattas where an International Jury is
present. What word of caution?

  I used to publish results separately to an event web site, or

Sailwave results folder, and then to a local web browser for
printing for the Official Notice Board [ONB]. I use the capability
to include the date & time the results are published and it is
this that a Jury picked up on. The time stamp of the
published/printed results via a local web browser was different to
the one shown on the event web site. The question from the jury
was which was correct. The one on the ONB copy being an earlier
date/time than the version on the event web site. Although when
you looked at the results in fine detail there was no difference,
the Jury asked for both to be the same. To achieve Jury request
the publishing process was changed, so that the copy on the event
web site or Sailwave was posted first and then that version opened
in a web browser for printing. This is the procedure I now follow.

  It is technically possible [at least I can see a process on Linux

/ Apple systems and expect same could be done on Windows systems]
to publish to a location and then automatically transfer a copy of
the HTML results file to event web site or Sailwave results folder
and automatically print a copy for the ONB.

  I do know that quite a few regattas are using an electronic ONB

as part of the regatta web site.

Now to go and look at links Jon provided.

Kind regards,

Huw

···

On 14/05/2018 22:26, Jon Eskdale
[sailwave] wrote:

jon@sailwave.com

          There are a

few possible solutions.

Option 1

            The first thing to do is publish the results to your

web browser. Which is very quick, and has a what I
consider an important step in that you get to check the
results are as you expect them. Many a time when I
publish the results it becomes very obvious that I’ve
forgotten a step or I’ve forgotten to set the publishing
order to for the fleets, then use the Print to PDFin the
browser this is very quick. You could print them to a
DropBox or pCloud folder with predefined file names
which have been shared with the person who wants them
for the publishing this way once you print to PDF you
have nothing else to do except notify them somehow they
are updated. You could of course then email them but
that is another process for the busy scorer so if it was
me I would want to avoid this manual email step.

            Note Chrome browser has built in print to PDF and

with Windows 10 there is a Microsoft Print to PDF as
well, I use the Chrome browsers print to PDF which works
well

Option 2

This is an interesting one…

            Use WKHTMLtoPDF to convert the HTML to PDF You can

download this from https://wkhtmltopdf.org/

            Then create a one line batch file with these contents

(adjust if yours is located elsewhere)

                "C:\Program

Files\wkhtmltopdf\bin\wkhtmltopdf.exe" %1 SWout.pdf

            I saved this file

to C:\Users\Public\Documents\Sailwave\Extras\SWPDF.bat

            Then publish as normal but to an installed

application

            For the Application give the name of the SWPDF.bat we

created earlier

            When you click publish, a PDF SWout.pdf is created 

(sample attached)

            WKHTMLtoPDF is available for 32 and 64 bit windows as

well as Mac and Linux

            There is also a Python module which uses this called

PDFKit.

            Python can also send emails with attachments with

only a few lines of code so if the application is a
Python script you could very easily publish and email a
PDF fully automatically. I would advise using the
preview button to check the results first and then click
publish if you are happy

If anyone needs any help with this let me know.

I think this is quite cool anyone else?

Jon

Jon Eskdale

03333 443377

07530 112233


Mailtrack
Sender notified by

                    [Mailtrack](https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&)
            On Mon, 14 May 2018 at 09:59, Malcolm

Osborne malcolmo@telkomsa.net
[sailwave] <sailwave@yahoogroups.com >
wrote:

                      A slight modification of this is to publish

to an application, e.g. Word or Excel, then
print to PDF.

regards,
Malcolm Osborne
Rondevlei, South Africa
                      On

2018-05-13 21:07, Huw Pearce huw.pearce@bcs.org.uk
[sailwave] wrote:

Hi,

                          I agree with what you have said and

confirm that Sailwave does not
directly print it publishes results as
HTML. Therefore one needs to select the
print to PDF option you describe when
printing from a web browser.

                          Andy is trying to eliminate this from his

work flow when producing results for the
North American Optimist Championship and
make the generation of a PDF file of the
results automatic. Andy and I both know
that it is possible on Linux system. It
may be possible to do on a Windows system
as well but I have not investigated such a
process, but it is something I will do.

                          As already mentioned in an earlier reply

to the original message in this thread,
Jon has looked at including functionality
to generate a PDF of the results but had
some problems one of which, as I recall,l
is the size increase of the executable.

Kind regards,

Huw
On
13/05/2018 19:33, flickr@cricalix.net
[sailwave] wrote:

                              The most recent versions of OS X

and Windows both support print-to-PDF
(and OS X has had it for several years
at least, Windows 7 didn’t have it,
Windows 8 might have, but I never ran
8). Linux can also support
print-to-PDF after some tutorial
following (iow, I don’t know if
distros are shipping that). It should
be feasible to generate the HTML, add
a window.print() call in the onload()
hook, and then trigger the browser to
open like Sailwave already supports
(it’s been a while since I ran
Sailwave, so I can’t remember if it
has direct print capabilities).

                              Might I suggest a slight tweak to

your process? If possible, do the PDF
conversion locally before posting
onwards; this way you can do a quick
skim of the files before emailing
them, just in case Mr. Murphy takes an
interest in your work.

width:46px;height:29px
Virus-free.
www.avast.com

Thanks Huw -

Topic 1 - Different times on results.

A solution here which is the method I use is

Use the Preview button to check the results look OK and then print the local notice board copy.

Then use the publish button to publish to the online media, whether this is a file or Sailwave results folder or Web server.

This way the date and time are the same.

At very busy events I just publish to the Online media and someone else prints from there for the local Notice board. This way they are identical.

Another alternative is to tick the publish again box at the bottom and then all will have the same date and time.

Topic 2 - Printing to PDF

I did continue the experiment a bit last night using a Python script. And successfully got it to create a PDF using publish to Installed Application where the application was SWPDF.py

This had a small advantage of naming the file to match the name e.g. where the source was Whitwell2018.html the PDF produced was Whitwell2018.pdf

Adding email to a fixed location with the pdf as an attachment is very easy which I did just to prove the principle.

Ideally, if it was developed a bit more you would have a window appear to allow and remember things such as Orientation of Portrait or Landscape, and turn email on/off and modify destination email address. Is there a demand for this?

Jon

Mailtrack
Sender notified by

                [Mailtrack](https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality4&)
···

Jon Eskdale

03333 443377

07530 112233

Is there a demand for this?

I’d suggest that it might be a good idea to have a collection of utilities that are ancillary to the software. IOW, they’re not in the installer, but a page on the SailWave site can link to the various github/bitbucket/whatever sites with all the usual disclaimers for the third-party ones that you’re not responsible for the End Times happening if the software is used.

Hi Jon,

Topic 2:

I just thought I would add to this as I’ve been doing some work with automatic PDF form population through php and a mysql database. I ended up using a system called PDFtk (PDF toolkit) that allows the creation, editing and various other tasks with PDF documents. PDFtk is available free and with ‘pro’ versions and certainly for me, took a huge amount of the grunt work out of the process. It’s a standalone toolkit that can be accessed from various programming languages. I used a php interface class from github for my particular project. Here’s their web site: https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/

I’m not affiliated with them, just thought it might be useful.

Cheers

Keith

···

From: sailwave@yahoogroups.com sailwave@yahoogroups.com
Sent: 15 May 2018 10:09
To: sailwave@yahoogroups.com
Subject: Re: [sailwave] Automatic PDF Conversion

Thanks Huw -

Topic 1 - Different times on results.

A solution here which is the method I use is

Use the Preview button to check the results look OK and then print the local notice board copy.

Then use the publish button to publish to the online media, whether this is a file or Sailwave results folder or Web server.

This way the date and time are the same.

At very busy events I just publish to the Online media and someone else prints from there for the local Notice board… This way they are identical.

Another alternative is to tick the publish again box at the bottom and then all will have the same date and time.

Topic 2 - Printing to PDF

I did continue the experiment a bit last night using a Python script. And successfully got it to create a PDF using publish to Installed Application where the application was SWPDF.py

This had a small advantage of naming the file to match the name e.g. where the source was Whitwell2018.html the PDF produced was Whitwell2018.pdf

Adding email to a fixed location with the pdf as an attachment is very easy which I did just to prove the principle.

Ideally, if it was developed a bit more you would have a window appear to allow and remember things such as Orientation of Portrait or Landscape, and turn email on/off and modify destination email address. Is there a demand for this?

Jon

Jon Eskdale

03333 443377

07530 112233

Mailtrack

Sender notified by
Mailtrack

On Tue, 15 May 2018 at 09:21, Huw Pearce huw.pearce@bcs.org.uk [sailwave] sailwave@yahoogroups.com wrote:

Hi everyone reading this thread,

Nice reply from Jon which has given me a new avenue to explore. It will be interesting to hear from the author of the message that started this thread to see what they decided to do and how.

A word of caution for those users of Sailwave who score International events/regattas where an International Jury is present. What word of caution?

I used to publish results separately to an event web site, or Sailwave results folder, and then to a local web browser for printing for the Official Notice Board [ONB]. I use the capability to include the date & time the results are published and it is this that a Jury picked up on. The time stamp of the published/printed results via a local web browser was different to the one shown on the event web site. The question from the jury was which was correct. The one on the ONB copy being an earlier date/time than the version on the event web site. Although when you looked at the results in fine detail there was no difference, the Jury asked for both to be the same. To achieve Jury request the publishing process was changed, so that the copy on the event web site or Sailwave was posted first and then that version opened in a web browser for printing. This is the procedure I now follow.

It is technically possible [at least I can see a process on Linux / Apple systems and expect same could be done on Windows systems] to publish to a location and then automatically transfer a copy of the HTML results file to event web site or Sailwave results folder and automatically print a copy for the ONB.

I do know that quite a few regattas are using an electronic ONB as part of the regatta web site.

Now to go and look at links Jon provided.

Kind regards,

Huw

On 14/05/2018 22:26, Jon Eskdale jon@sailwave.com [sailwave] wrote:

There are a few possible solutions.

Option 1

The first thing to do is publish the results to your web browser. Which is very quick, and has a what I consider an important step in that you get to check the results are as you expect them. Many a time when I publish the results it becomes very obvious that I’ve forgotten a step or I’ve forgotten to set the publishing order to for the fleets, then use the Print to PDFin the browser this is very quick. You could print them to a DropBox or pCloud folder with predefined file names which have been shared with the person who wants them for the publishing this way once you print to PDF you have nothing else to do except notify them somehow they are updated. You could of course then email them but that is another process for the busy scorer so if it was me I would want to avoid this manual email step.

Note Chrome browser has built in print to PDF and with Windows 10 there is a Microsoft Print to PDF as well, I use the Chrome browsers print to PDF which works well

Option 2

This is an interesting one…

Use WKHTMLtoPDF to convert the HTML to PDF You can download this from https://wkhtmltopdf.org/

Then create a one line batch file with these contents (adjust if yours is located elsewhere)

“C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe” %1 SWout.pdf

I saved this file to C:\Users\Public\Documents\Sailwave\Extras\SWPDF.bat

Then publish as normal but to an installed application

image.png

For the Application give the name of the SWPDF.bat we created earlier

When you click publish, a PDF SWout.pdf is created (sample attached)

WKHTMLtoPDF is available for 32 and 64 bit windows as well as Mac and Linux

There is also a Python module which uses this called PDFKit.

Python can also send emails with attachments with only a few lines of code so if the application is a Python script you could very easily publish and email a PDF fully automatically. I would advise using the preview button to check the results first and then click publish if you are happy

If anyone needs any help with this let me know.

I think this is quite cool anyone else?

Jon

Jon Eskdale

03333 443377

07530 112233

Mailtrack

Sender notified by
Mailtrack

On Mon, 14 May 2018 at 09:59, Malcolm Osborne malcolmo@telkomsa.net [sailwave] sailwave@yahoogroups.com wrote:

A slight modification of this is to publish to an application, e.g. Word or Excel, then print to PDF.

regards,
Malcolm Osborne
Rondevlei, South Africa

On 2018-05-13 21:07, Huw Pearce huw.pearce@bcs.org.uk [sailwave] wrote:

Hi,

I agree with what you have said and confirm that Sailwave does not directly print it publishes results as HTML. Therefore one needs to select the print to PDF option you describe when printing from a web browser.

Andy is trying to eliminate this from his work flow when producing results for the North American Optimist Championship and make the generation of a PDF file of the results automatic. Andy and I both know that it is possible on Linux system. It may be possible to do on a Windows system as well but I have not investigated such a process, but it is something I will do.

As already mentioned in an earlier reply to the original message in this thread, Jon has looked at including functionality to generate a PDF of the results but had some problems one of which, as I recall,l is the size increase of the executable.

Kind regards,

Huw

On 13/05/2018 19:33, flickr@cricalix.net [sailwave] wrote:

The most recent versions of OS X and Windows both support print-to-PDF (and OS X has had it for several years at least, Windows 7 didn’t have it, Windows 8 might have, but I never ran 8). Linux can also support print-to-PDF after some tutorial following (iow, I don’t know if distros are shipping that). It should be feasible to generate the HTML, add a window.print() call in the onload() hook, and then trigger the browser to open like Sailwave already supports (it’s been a while since I ran Sailwave, so I can’t remember if it has direct print capabilities).

Might I suggest a slight tweak to your process? If possible, do the PDF conversion locally before posting onwards; this way you can do a quick skim of the files before emailing them, just in case Mr. Murphy takes an interest in your work.

width:46px;height:29px

Virus-free. www.avast.com

Excuse me for saying, but if the Optimist North American Championships Team want you to do all the hard work and then just pass on the results so that they can upload to their site, I may tell them to do the results themselves. Sorry for sounding so grumpy, but people do not realis the amount of work goes into scoring a National event, and for them to demand how and where the results are published, then !?%&£*(

···

On 15 May 2018, at 10:14, flickr@cricalix.net [sailwave] sailwave@yahoogroups.com wrote:

Is there a demand for this?

I’d suggest that it might be a good idea to have a collection of utilities that are ancillary to the software. IOW, they’re not in the installer, but a page on the SailWave site can link to the various github/bitbucket/whatever sites with all the usual disclaimers for the third-party ones that you’re not responsible for the End Times happening if the software is used.

Brian Starr
brian.starr@virgin.net

Brian,

Breaking news! Optis are special, don’t you know. They have a number of unusual scoring practices. Boats continue to get more expensive. (They couldn’t get more complicated.). And yet the class continues for each new class of young sailors. Amazing . . . . :sunglasses:

jrc

···

John R Culter
Medinet Vancouver
604 742-8832 or 604 908-3118 mobile

It’s hard for me to respond to this, as we are on the verge of doing the event. Ultimately, organizations like ours depend on these sorts of events to keep afloat - many yacht clubs are suffering from declining/aging membership, which translates to lower regular income. So we take a deep breath and do what we are asked.

The past two times we hosted IODA events we were impressed with the level of organization they had. There comes a limit, however. I fear that IODA will find it difficult to find willing hosts for their events in the future.

Back to Sailwave discussion!

—In sailwave@yahoogroups.com, <brian.starr@…> wrote :

Excuse me for saying, but if the Optimist North American Championships Team want you to do all the hard work and then just pass on the results so that they can upload to their site, I may tell them to do the results themselves. Sorry for sounding so grumpy, but people do not realis the amount of work goes into scoring a National event, and for them to demand how and where the results are published, then !?%&£*(

···

On 15 May 2018, at 10:14, flickr@… [sailwave] sailwave@yahoogroups.com wrote:

Is there a demand for this?

I’d suggest that it might be a good idea to have a collection of utilities that are ancillary to the software. IOW, they’re not in the installer, but a page on the SailWave site can link to the various github/bitbucket/whatever sites with all the usual disclaimers for the third-party ones that you’re not responsible for the End Times happening if the software is used.

Brian Starr
brian.starr@…