I'm trying to set <readme> tag in Distribution.xml part of the package to contain something which may contain images. For now I've tried rtfd and pdf; for rtfd it compains that it can't open the file because of permissions lack and pdf is displayed as plain text.
So the question is: how to use something that may contain images with Distribution.xml
productbuild doesn't handle .rtfd files correctly but I have found that OS X 10.9 Mavericks doesn't handle HTML base 64 encoded images either.
My workaround is to use productbuild with dummmy .rtf files and then use pkgutil to repackage the installer.
Your distribution.xml file contains:
<welcome file='Welcome-ReplaceMe.rtf' />
and Welcome-ReplaceMe.rtf exists in a .lproj folder inside Resources. Once the installer is built, but before you sign it with productsign expand the package:
pkgutil --expand Installer.mpkg Installer.expanded
change the Distribution file inside Installer.expanded to use:
<welcome file='Welcome.rtfd' />
and delete the dummy Welcome-ReplaceMe.rtf and add Welcome.rftd. Finally repackage the installer:
pkgutil --flatten Installer.expanded Installer.mpkg
Since I didn't find solution I used some workaround:
Convert RTF to HTML
Use this site to convert image to embeded html image and replace all linked images in the original html
Use html instead of rtfd in the Distribution.xml
Drawback is that it require more work to be done and html is displayed differently in the package than I saw in browsers.
I have no solution, just a creative workaround :)
I tried to apply the existing answers.
An HTML file with embedded images (base64 encoded) didn't work in my case
So I tried to get the image file inside the package, right next to the HTML file and something like <img src="./success.png" alt="success">, which didn't work either :/
My out-of-the-box solution was to just use an emoji instead of the image. In my case all I wanted was this green checkmark you'd see on the conlusion screen anyways. There's an emoji (✅) that looks quite similar.
Related
I am building a distribution package for xnec2c and I want .nec files to associate with xnec2c and also display the associated icon.
(This question is different than the many xdg-utils answers out there because it asks about packaging and whether xdg-* calls are actually necessary.)
I know I can register them with these:
xdg-mime install --mode system x-nec2c.xml
xdg-icon-resource install --mode system --context mimetypes --size 256 xnec2c.png application-x-nec2
xdg-mime default xnec2c.desktop # but `man` says not as root?
Should it be sufficient just to drop the .xml and .desktop and .png in the right place on the filesystem?
Does the post-install in the package need to run some or all of these commands?
I read here that the icon would be application-x-nec2 and not application/x-nec2. Is this correct?
I would like the files to work by placing them in the right spot without running the xdg-* tools if supported.
(The package is a .rpm, but type and distro shouldn't matter since xdg is a standard. I want the same basic process to work for .deb, too.)
Everything should associate as the mime type application/x-nec2 since "nec2" is the file format for ".nec" files. This is reflected in the .desktop and .xml definitions below unless I have an error. Please correct me if I have something out of place!
Here are the relevant files that deploy:
/usr/share/applications/xnec2c.desktop (see below)
/usr/share/mime/packages/x-nec2.xml (see below)
/usr/share/pixmaps/xnec2c.svg
/usr/share/icons/hicolor/256x256/apps/xnec2c.png
/usr/share/icons/hicolor/scalable/apps/xnec2c.svg
and here are is the content:
==> /usr/share/applications/xnec2c.desktop <==
[Desktop Entry]
Name=Xnec2c
GenericName=NEC2 Simulator
Comment=Numerical Electromagnetics Code software
Exec=xnec2c
Icon=xnec2c
Terminal=false
Type=Application
Categories=Science;
Keywords=nec2;em;simulator;
X-Desktop-File-Install-Version=0.22
MimeType=application/x-nec2;
==> /usr/share/mime/packages/x-nec2.xml <==
<?xml version="1.0"?>
<mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
<mime-type type="application/x-nec2">
<comment>NEC2 Antenna Simulation File</comment>
<icon name="application-x-nec2"/>
<glob-deleteall/>
<glob pattern="*.nec"/>
</mime-type>
</mime-info>
You don't need to run the mime-* tools, but you do need to update the desktop and icon associations for the freedesktop environment after install like so:
update-mime-database /usr/share/mime
update-desktop-database
gtk-update-icon-cache /usr/share/icons/hicolor
These should be run after uninstall, too, to cleanup after removal. In RPMs this is the %postun section.
Substitute /usr/share with whatever deployment variable you might use like %{_datadir} for RPM .spec's.
Also the icon name had an issue. It should have just been named 'xnec2c' not 'application-x-nec2' because the 'xnec2c' icon gets installed with the installer as follows:
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/icons/hicolor/256x256/apps/%{name}.png
I attempted to convert my mybook.adoc to mybook.pdf using pandoc, and got the following error.
$ pandoc -s mybook.adoc -t asciidoc -o mybook.pdf
pandoc: cannot produce pdf output with asciidoc writer
Is there another tool that I should use instead of or in concert with pandoc?
How can I convert asciidoc to pdf?
Prerequisites: all that’s needed is Ruby (1.9.3 or above)
Install a native PDF converter for AsciiDoc - Asciidoctor PDF:
gem install asciidoctor-pdf --pre
Run:
asciidoctor-pdf mybook.adoc
You should get the file mybook.pdf in the same directory.
If you're using Visual Studio Code with AsciiDoc extension, Ctrl + SHFT + P (or Shift ⇧ + Cmd ⌘ + P in macOS) and type AsciiDoc: Export document as PDF.
You will need to have asciidoctor-pdf or wkhtmltopdf installed according to the command instructions.
If you have Docker installed, you can use the AsciiDoctor Docker Image. Then you can use the image interactively or in batch mode as explained below:
Prerequisites
Install Docker
Install the Docker image:
$ docker pull asciidoctor/docker-asciidoctor
Create the pdf by executing the following command:
$ cd [directory to where my book.adoc is located]
$ docker run --rm -v $(pwd):/documents/ asciidoctor/docker-asciidoctor asciidoctor-pdf mybook.adoc
Explanation
docker run starts a Docker container
--rm cleanup - removes the Docker container after the command has been executed
-v mount a volume to the image
$(pwd) get the path to the current directory, e.g. the value of [directory to where my book.adoc is located] above
documents the name of the mounted volume in the running container
asciidoctor/docker-asciidoctor the name of the Docker image that is used to create the Docker container
asciidoctor-pdf the command that actually triggers the pdf generation
mybook.adoc the name of the AsciiDoc source file to generate the pdf from
See also the docker run documentation
AsciiDoc has a couple of toolchains that will render PDFs from AsciiDoc source. You can use the Ruby-based AsciiDoc -> Prawn -> PDF toolchain developed by Asciidoctor, or you can use the older AsciiDoc -> DocBook -> FOP toolchain. These are rendering/publishing procedures, whereas Pandoc mainly provides for conversion and is best for converting from one o another type of source format.
I now realize the ideal route from asciidoc to pdf is to first convert the asciidoc to docbook. This employs the intended sphere of asciidoc and a docbook->pdf converter using each in its separate area of concern.
Furthermore, instead of pandoc I have found that when mathematical formulas are included, it was easier to use dblatex for docbook->pdf conversion. Thus my conversion pipeline is the following:
asciidoc -> asciidoctor -> docbook -> dblatex -> pdf
A sample make file:
make: my.adoc
asciidoc -b docbook my.adoc
dblatex my.xml
This discussion page suggests that asciidoc is primarily designed to compile to docbook.
The easiest way to convert AsciiDoc document to PDF is as follows -
Open AsciiDocLive
Paste your document in the editor and see the preview
save it as HTML
Open any online HTML to PDF convertor
Upload your newly generated HTML file
Convert to PDF and download it.
Done.
Following #Remis's answer, I used asciidoctor's pdf backend.
I could not figure out how to install asciidoctor-pdf on nixos, but managed to find the following alternative which worked:
asciidoctor -r asciidoctor-pdf -b pdf or asciidoctor-pdf
Another workflow, which I use a lot, is to create HTML from your AsciiDoc file using the AsciiDoctor processor, linking a custom CSS stylesheet with print styling rules:
asciidoctor -a stylesheet=path-to-stylesheet.css file.adoc
You can then open the HTML file in your browser and print to PDF.
For more advanced styling, such as page numbering, headers, footers, page breaks and columns, you can use PrinceXML (or other similar products). This is a commandline processor that will convert the HTML file to PDF using the styling rules in the CSS used by the HTML file. PrinceXML applies styling rules that are in the CSS3 standard but which aren't yet supported by browsers, allowing you to create finely styled layouts.
In case if you have AsciiDoc plugin in Intellij, here is the way you can generate -
create the adoc file ex - "tktds-dhs-e2e-gcp.adoc" and write your content.. or you may already have adoc file..
At top where file is opened in editor, click on PDF or HTML button to generate .pdf or .html files {need to click 1 at a time} refer below image -
Further you can find pdf / html file in same directory, refer below image -
Working on Windows 8 64bit, Firefox 19.0.2.
I went to .../Firefox/Profiles/.../extensions and put my ekons#www.solver.ws file containing
a string
h:\myextensions\ekons\
The directory h:\myextensions\ekons\ contains install.rdf file of my extension.
Every time I restart Firefox, it deletes .../Firefox/Profiles/.../extensions/ekons#www.solver.ws file. Of course, without trying to install the extension.
Any suggestions?
Addition
I attach an image FF extensions directory.
Well, it was my mistake: extension file name was not the same as ID inside install.rdf.
Such files are silently deleted by FireFox from profile directory.
I had the same isue, the problem was an extra tag </em:description> in the install.rdf file.
When it was a valid XML all goes ok.
My config is:
- Windows Vista
- XAMPP 1.7.1
- Media Wiki + Semantic MW
- an extension that uses Graphviz to create a SVG
- Graphviz 2.26.3 (install dir c:\graphviz.....)
Everything works fine but the problem is: the xml tag
'image xlink:href="some_image.png"....'
is missing from the SVG file created using a Media Wiki php page.
This is done by:
$cmdlinesvg = wfEscapeShellArg($cmd).' -T svg '.wfEscapeShellArg($src).' -o '.wfEscapeShellArg($svg);
$WshShell = new COM("WScript.Shell");
$WshShell->Exec($cmdlinesvg);
I've created a batch file that executes the same command line:
c:\graphviz2.26.3\bin\dot.exe -T svg filename.dot -o filename.svg
and if I run it manually it works, and the xml tag appears.
Anyone knows what is the problem? thanks in advance.
SOLVED
The problem is related to the image path that is in the .DOT file.
If you run the command line manually, the image path doesn't need to be a full path.
You can have only: shapefile="some_image.png"
If you run the command inside php code, the image path HAS to be a full path.
So you must have: shapefile="C:\xampp......\some_image.png"
Another problem arises: the resulting .SVG file doesn't show the images.
If you right-click and open the .SVG file with the browser (ie Firefox), the images are ok.
But, again, through a php page, the images are lost.
Solution: edit the .SVG file (this is XML) to change the paths.
On the original .SVG file we have:
On the modified .SVG file we must have:
PS: I'm doing my master thesis, so this is for a particular problem, but still I hope it helps someone.
How to configure poedit to extract strings from xml file?
I have Zend Framework navigation items in .xml like this:
<entry-i>
<label>Text to translate</label>
<params>
...
<params>
<entry-i>
And I want poedit to read just messages from <label>s.
I have been searching for a solution as well, and I have just gotten it to work!
In Poedit (I have 1.4.2), add a new parser (Edit > Preferences) with the following properties:
Language: XML
List of extensions separated by semicolons (e.g. .cpp;.h): *.xml
Parser command: xgettext --force-po -o %o %C %K %F -L glade
An item in keywords list: -k%k
An item in input files list: %f
Source code charset: --from-code=%c
In your translation project, add label and title to your keyword list and update the catalog.
The above advice to abuse the Glade extractor to parse non-Glade XML files is misguided. It’s never going to work well (case in point: some comments around here). Of course, it was better than nothing back in 2010.
Starting with gettext 0.19.7 (bundled with Poedit since 1.8.7), there’s a better way: there’s now builtin support in gettext for custom XML files via ITS rules.
The best way to extract strings from a custom XML file is to
Add a custom extractor with your extension, specifying standard gettext invocation, without the -L glade bit.
Write ITS rules for your file format.
Put them in the location of other .its and .loc files in Poedit’s installation.
For anyone running into problems with the configuration for Poedit on windows, specifically if you get an error message saying that glade and expat are not available, replace the supplied xgettext.exe with current one from the gnuwin32 project:
http://gnuwin32.sourceforge.net/packages/gettext.htm
You need to download the binaries and the dependencies. However, only the binary xgettext.exe must be extracted and related files (just run it and it will tell you what is missing)
Looks like PoEdit does not support XML yet.
I have created a little php script, to extract the labels to .php file,
which PoEdit does understand.
$xml = simplexml_load_file("../application/configs/navigation.xml")
or die("Error: Cannot open XML file");
echo '<?';
foreach($xml->xpath('//label') as $label){
echo 'echo _("'.$label.'");'. PHP_EOL;
}
It worked great!! I found the problem about "glade not supported" using Poedit 1.4.6 in Windows 7 but I fixed by downloading last gnuwin32 binaries and dependencies as user496209 said. Don't download the complet package because PoEdit comes with its own gettext library, so just donwload binaries and dependencies and replace the requested files into the poedit folder.