Improving on the sharing functionality regarding the public web server hosting aspects to our inhouse Pandoc Document Conversion interfacing web application last talked about at the recent Pandoc on AlmaLinux Conversion Guises Tutorial had us …
- rearranging any PHP $_GET[] based navigation to $_POST[] based navigation (except for links off emails and/or SMSs, which have to be $_GET[] based … but read on) … and …
- a link href mailto: and sms: calls now occur before that navigation rather than after … so that …
- logic can coalesce to $_POST[] based Pandoc calls … which result in …
- RJM Programming web server /tmp/ positioned output documents created … in readiness for …
- email or SMS links used by a sharing recipient first try seeing if that RJM Programming web server /tmp/ positioned output document still exists, and if so, the processing is much less involved … and will …
- try recreating those RJM Programming web server /tmp/ positioned output document otherwise
Involving PDF as an input file type we decided to, in our changed macos_textutil_convert.php PHP web application you can also try below …
- interface via a new input checkbox … that if checked …
- opens a new iframe with a totally different iframe hosted inhouse web application presenting actions you can make happen when the input is a PDF file
All this above can be confusing to users new to Open Source products and ideas, and so to embellish span elements around the place, offering onclick logic so the user can start on their own research regarding these fabulous Open Source products with which PHP works so well.
Previous relevant Pandoc on AlmaLinux Conversion Guises Tutorial is shown below.
It pans out yesterday’s Pandoc on AlmaLinux Conversions Primer Tutorial revisit start to our …
Pandoc documemt conversion
… interfacing PHP web application involves more than a two day job. Today, before any PDF input or any new format thinking, we took an interest in the way a user may want to use the output formats …
- html
- txt … which Pandoc knows as plain
… as we found “talents” for each, those being …
- html … is better when there are UTF-8 characters involved in the converted data
- txt … which Pandoc knows as plain … is useful in a pair of guises …
- with line feeds
- without line feeds
… depending on what use the user sees with this data, and because we want to restrict the user to internal use only data displays, we wanted to have a means by which these three “guises” were available to the user in an HTML div element (which is more flexible than a textarea element) to serve these purposes, as well as popup window HTML presentations where those UTF-8 characters can be more easily controlled.
The day gets quickly used up with issues like this, we find, regarding the changed macos_textutil_convert.php PHP web application you can also try below.
Previous relevant Pandoc on AlmaLinux Conversions Primer Tutorial is shown below.
Yesterday’s Word to HTML to CSV Delimitation Primer Tutorial offered a timely reminder that not only …
- LibreOffice and Microsoft Office software applications offer exports of document formats to HTML … but, also, open source gives us …
- (what is now possible to offer in a public sense because of the recent AlmaLinux installation (you can read more about at Pandoc Install and Public Face Tutorial) of) Pandoc command line application we can use to convert input document formats such as *.doc* and *.html and *.txt to others … and down the track …
- tomorrow’s job can involve the interfacing of another inhouse “open source using” web application so that input *.pdf is possible here too
For security purposes we restrict where output files end up to …
/tmp/
… as you might surmise would be a wise move. The user ends up relying on the changed macos_textutil_convert.php PHP web application itself, that way, to display the outputted data (created via command line Pandoc commands performed on the RJM Programming AlmaLinux web server via PHP exec calls) for them.
In making this happen, exporting to PDF, we found that we additionally had to install to the AlmaLinux web server …
dnf install texlive
… the best “heads up” for this after reading the Pandoc error message being this useful webpage, thanks.
Previous relevant Word to HTML to CSV Delimitation Primer Tutorial is shown below.
The modern document applications allow conversion to HTML. What happens during that process, exactly? Well, that’s “under the hood” stuff. A little background, though, and context …
- Why would you want to convert, say a Word file, to HTML (using, perhaps, LibreOffice, in our case, or Microsoft Word)? … well, as a mere mortal programmer …
- (any form of) text is easier to deal with for “mere mortal programmer” languages we might want to use like …
- PHP … is very good at the delimiter processing bits that allow the programmer be useful …
- converting … the data into other guises, the one that interested us being …
- CSV (comma separated value) data … to be fed into spreadsheet applications like Excel or LibreOffice’s one … and then create charts
… and to do useful delimiter work in PHP you need to know, or suss out, “what happens”, or evidence of that … think hex dumps (where $dr is a PHP variable containing an HTML file record) …
<?php
echo bin2hex($dr) . "\n";
// ... gave, in our case, output such as ...
// c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020c2a020546f74616c207c20c2a020c2a02036302c30333220c2a020c2a020c2a03130302e3030
?>
And so we line up all the useful contributors …
- CP3O
- C2A0
- R2D2
- … … …
Hang on?! What’s with C2A0? And for that matter, the pitiful “am typing” simulation “… … … “?!
Well, we asked around, and got to this useful link telling us these are non-ascii characters describing a …
Non-breaking space
… scenario programmers of HTML will know can be those …
… HTML entities in your webpage content. Well, now, at least to us, that all makes sense. But, for our job, that could be the tip of the “UTF-8 headache” situation! We know we’re only interested in ascii data characters for the conversion job we are trying to do. Is there a way to simplify this “middleperson” HTML data content? Well, this other useful link … got us to use …
<?php
$dr=preg_replace('/[\x7F-\xFF]/ui', '', $dr);
?>
… helped us with …
- sanity
- simplification
… as far as the PHP delimitation logic went. This was an inhouse job, but we’ll show you a skeletal of how we used …
- input Word report … we are calling from_word_to_html.html … say …
- containing spreadsheetable data …
- we wanted to extract into …
- individual CSV files … ready to …
- open as useful spreadsheets … and perhaps onto some chart production …
- processing via command line command …
php dostuff.php
… where that PHP is (very informally) … - dostuff.php
… in case these ideas interest you?!
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.
If this was interesting you may be interested in this too.