I am trying to build Sphinx doc output as PDF rather than HTML. I can only use the tools which come with Sphinx, i.e. I cannot download additionl tools like rst2pdf. I have tried using 'make latexpdf', per the Sphinx documentation, which states it will produce pdf in addition to the .tex files. However I am only getting .tex. What am I missing? The Sphinx documentation states that PDF files will be produced.
Sphinx uses Latex to export the documentation as a PDF file.
Thus one needs the basic Latex dependencies used to write a pdf on the system.
For example, on a system running Ubuntu 16.04, they can be downloaded and installed by :
apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
If running Sphinx 1.6 or above on GNU/Linux or OSX, you may also need the latexmk package.
Reference: sphinx.builders.latex.LaTeXBuilder documentation.
After installing the above packages, running make latexpdf in the sphinx project directory generates the documentation output as the PDF file ./_build/latex/<sphinx-project-name>.pdf>
Note: In the current scenario where you do not see a PDF file on your system after running make latexpdf, check the output of the command for any errors regarding missing latex tools/files. Use the system package manager to identify the missing packages and install them.
Related
I am attempting to install PDFBox on my system in order to create PDF files, but am unsure which jar files I need. If I go to https://pdfbox.apache.org/download.cgi
I see command line tools as follows:
pdfbox-app (9.1MB)
preflight-app (9.2MB)
debugger-app (9.0MB)
I also see "Libraries of each subproject" as follows:
pdfbox (2.6MB)
fontbox (1.6MB)
preflight (248KB)
xmpbox (132KB)
pdfbox-tools (77KB)
pdfbox-debugger (245KB)
What is meant by "each subproject"? Is it talking about the command line tools or something different?
I am planning to use java from the command line rather than in an IDE. Does this mean that I just need the Command line tools or do I need the "Libraries of each Subproject" as well? What does the "-app" indicated in the command line tools vs the related libraries?
Is there a page on apache.org that mentions the differences between all of these?
To create PDF files should I be using the preflight and debugger files as well or are those optional?
Summarizing the comments: you want to create a PDF from scratch and access your development over ssh so you can't use an IDE and have to use javac. For that you could use pdfbox-app jar file, but this would be huge. Instead, use the pdfbox, fontbox and commons-log jar files. See also here for additional dependencies if you want to do more advanced stuff (read / render (= convert to image) / decrypt / sign).
I have a Markdown file that I wish to convert to PDF so that I can upload it on Speakerdeck. I am using Pandoc to convert from markdown to PDF.
My problem is I can't specify what content should go on what page of the PDF, because Markdown doesn't provide any feature like that.
E.g., Markdown:
###Hello
* abc
* def
###Bye
* ghi
* jkl
Now I want Hello to be one slide and Bye to be on another slide on Speakerdeck. So, I will need them to be on different pages in the PDF that I generate using Pandoc.
But both Hello and Bye gets on the same page in the PDF.
How can I accomplish this?
Via the terminal (tested in 2020)
Download dependencies
sudo apt-get install pandoc texlive-latex-base texlive-fonts-recommended texlive-extra-utils texlive-latex-extra
Try to use
pandoc MANUAL.txt -o example13.pdf
pandoc MANUAL.md -o example13.pdf
Via a Visual Studio Code extension (tested in 2020)
Download the Yzane Markdown PDF extension
Right click inside a Markdown file (md)
The content below will appear
Select the Markdown PDF: Export (pdf) option
Note: Emojis are better in Windows than Linux (I don't know why)
2016 update:
NPM module: https://github.com/alanshaw/markdown-pdf
Has a command line interface: https://github.com/alanshaw/markdown-pdf#usage
npm install -g markdown-pdf
markdown-pdf <markdown-file-path>
Or, an online service: http://markdown2pdf.com
As SpeakerDeck only accepts PDF files, the easiest option is to use the Latex Beamer backend for pandoc:
pandoc -t beamer -o output.pdf yourInput.mkd
Note that you should have LaTeX Beamer installed for that.
In Ubuntu, you can do sudo apt-get install texlive-latex-recommended to install it. If you use Windows, you may try this answer.
You may also want to try the HTML/CSS output from Slidy:
pandoc --self-contained -t slidy -o output-slidy.html yourInput.mkd
It has a decent printing output, as you can check out trying to print the original.
Read more about slideshows with pandoc here.
Easy online solution: dillinger.io.
Just paste your Markdown content into the editor on the left and see the (html) preview on the right. Then click Export as on the top and chose pdf.
It's based on the open source dillinger editor.
Adding to elias' answer, if you want to separate text in slides, just put *** between the text you want to separate. For your example to be in several pages, write it like this:
### Hello
- abc
- def
***
### Bye
- ghi
- jkl
And then use elias' answer, pandoc -t beamer -o output.pdf yourInput.md.
I have Ubuntu 18.10 (Cosmic Cuttlefish) and installed the full package from texlive. It works for me.
Previously I had used the npm markdown-pdf answer. However, on a fresh install of Ubuntu 19.04 (Disco Dingo) I had issues getting it to install correctly.
Instead I started using the Visual Studio Code package: "Markdown PDF"
Details:
Name: Markdown PDF
Id: yzane.markdown-pdf
Description: Convert Markdown to PDF
Version: 1.2.0
Publisher: yzane
Visual Studio Marketplace link: https://marketplace.visualstudio.com/items?itemName=yzane.markdown-pdf
It has worked consistently well. If you've had issues getting other answers to work, I would recommend trying this.
I've managed to get a stable Markdown -> HTML > PDF pipeline working with the MarkReport project.
It is a bit more than what Pandoc will do though, since it is based on WeasyPrint and is therefore aimed for clean report publishing, with cover, headers, sections, ...
It also enriches the HTML with syntax highlighting and LaTeX equations.
Simple way with iOS:
Use Shortcuts app (by Apple)
Make Rich Text From Markdown: Clipboard
^
Make PDF from Rich Text From Markdown
^
Show [PDF] in Quick Look
Just copy text and run the shortcut. Press share in Quick Look (bottom left) to store or send it. I use this to quickly convert Joplin notes to pdf.
I found that many markdown-to-pdf converters produce files that I don't find exactly neat-looking. However there is a solution to this.
If you're using IntelliJ, you can use a plugin called "Markdown". The export function uses pandoc as an engine so you probably will need to install that along with pdf-latex. https://pandoc.org/installing.html
In IntelliJ, under Tools > Markdown Converter > Export Markdown File To...
And there you go, a clean looking document. Additional styling can be added via a .css stylesheet.
Is there a tool that generates both PDF and CHM documentation from Markdown (or similar, such as RST) on Windows.
We are currently using Sphinx, but have been unable to get the PDF generation working on Windows (this guy has the same issue). It's a pain to have to generate the CHM on Windows and the PDF version on Linux (and I do need to generate both versions).
Is there an alternative tool (free or inexpensive commercial) that could do this task?
The source format must be in a plain-text-like format for version control, of which Markdown and RST are examples.
The Free Pascal distribution holds a CHM compiler called chmcmd. Some people with documentation tools report success with it (like the Preshrunk-cotton python package)
Some Linux distros also pack the chm compiler independently from the main FPC distribution. (since it only is a 700k binary without dependencies).
On Windows you can use the same (the windows version of chmcmd), or Microsoft Help Workshop, the default CHM generator from MS.
That's the CHM compiler part, now the input:
A CHM project before compilation is basically just html with a couple of XML indexes (TOC and master keyword based index) and a project file that is an INI file.
Usually the HTML generator backend of a documentation tool is tweaked to generate it as a special case. From what I read in your "this guy" link, sphinx can do that.
I was able to fulfil this need using Sphinx after all. I used MiKTeX to generate the PDF on Windows.
Install MiKTeX (< 200mb)
wget -nv -N http://mirrors.ctan.org/systems/win32/miktex/setup/miktex-portable-2.9.4757.exe
7z.exe x -y miktex-portable-2.9.4757.exe -o"miktex"
Add the bin directory to your path
SET Path=%Path%;%CD%\miktex\miktex\bin
Run Sphinx's "make.bat" to generate the .tex file.
SET SPHINXOPTS=-W -E
make.bat latex
Invoke MiKTeX's pdflatex:
cd build/latex
pdflatex.exe YOUR_PROJECT_NAME.tex
The resultant PDF will be in your build/latex directory
Is there any open source tool to convert PDF to SWF other than pdf2swf tools?
pdf2swf uses "xpdf" to process PDF files.
You can try ImageMagic, it uses a different library (gscript) to process PDF files. You will have to convert to some intermediate format (like JPG/ SVG) and use a different tool to create SWF.
Have you tried SWFTOOLS? On Debian/Unbuntu:
sudo apt-get install swftools
pdf2swf filename.pdf
http://wiki.swftools.org/index.php/Examples#pdf2swf They have a Windows version, and the source so you can compile it on other Linux flavors
I'm trying to generate report with DynamicJasper, but I'm getting the following error:
net.sf.jasperreports.engine.util.JRFontNotFoundException:
Font 'Arial' is not available to the JVM.
msttcorefonts is installed, but I guess the JVM is not using any fonts from it.
I'm using Ubuntu 10.04.
How can I fix this?
I tried installing mscorefonts, but the package was installed and up-to-date.
sudo apt-get update
sudo apt-get install ttf-mscorefonts-installer
I tried searching for the font in the filesystem, with:
ls /usr/share/fonts/truetype/msttcorefonts/
This folder just had the README, with the correct instructions on how to install.
cat /usr/share/fonts/truetype/msttcorefonts/README
You need an internet connection for this:
sudo apt-get install --reinstall ttf-mscorefonts-installer
I re-installed ttf-mscorefonts-installer (as shown above, making sure to accept the EULA!) and the problem was solved.
JasperReports raises a JRFontNotFoundException in the case where the font used inside a report template is not available to the JVM as either as a system font or a font coming from a JR font extension. This ensure that all problems caused by font metrics mismatches are avoided and we have an early warning about the inconsistency.
Jasper reports is trying to help you in your report development, stating that it can not export your report correctly since it can not find the font defined in TextField or StaticText
<font fontName="Arial"/>
Yes you can disable this by setting net.sf.jasperreports.awt.ignore.missing.font to true but you will have export inconsistencies.
Yes you can install the font as JVM system font (but you need to do it on every PC used that may generate report and you can still have encoding problems).
The correct way!
Use Font Extensions!, if you like to create your own (see link below), jasper reports also distributes a default font-extension jar (jasperreports-fonts-x.x.x.jar), that supports fontName DejaVu Sans, DejaVu Serif and DejaVu Sans Mono
<font fontName="DejaVu Sans"/>
From the JasperReport Ultimate Guide:
We strongly encourage people to use only fonts derived from font
extensions, because this is the only way to make sure that the fonts
will be available to the application when the reports are executed at
runtime. Using system fonts always brings the risk for the reports not
to work properly when deployed on a new machine that might not have
those fonts installed
Links on StackOverflow on how to render fonts correctly in pdf
Checklist on how to render font correctly in pdf
Generate font-extensions with JasperSoft Studio
Generate font-extensions with iReport
I use IReport to install font:
tools -> options -> fonts -> click install font
Then select the font and click
-> export as extension and type name myfont.jar
add this jar and also spring.jar* to your build path.
*copy spring.jar from Jaspersoft\iReport-3.7.0\ireport\modules\ext
sudo apt-get install msttcorefonts works (on our Ubuntu development environment), but is not a very good solution.
Instead, we bundled the fonts with our application based on this tip. Their JAR file bundles the following fonts,
Arial
Times New Roman
Courier New
Comic Sans MS
Georgia
Verdana
Monospaced
Direct Link to download jar:
Maven ver 1.0. DynamicFonts
There are three method to avoid such a problem.
Method 1 : by setting ignore missing font property.
JRProperties.setProperty("net.sf.jasperreports.awt.ignore.missing.font", "true");
or you can set this property by entering following line into .jrxml file.
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
Method 2 : by setting default font property.
JRProperties.setProperty("net.sf.jasperreports.default.font.name", "Sans Serif");
or you can set this property by entering following line into .jrxml file.
<property name="net.sf.jasperreports.default.font.name" value="Sans Serif"/>
Method 3 : by adding missing font property.
Firstly install missing fonts in IReport by selecting " Tools >> Options >> Fonts >> Install Font " then select the all font and Export this By clicking on "Export as Extension" with .jar Extension.
You can use this jar for Jasperreports-font.X.X.X.jar which will be present in your project library or classpath.
For CentOS:
wget msttcorefonts
Then:
tar -zxvf msttcorefonts.tar.gz
cp msttcorefonts/*.ttf /usr/share/fonts/TTF/
fc-cache -fv
After all, restart JVM.
I solved this by choosing 'SansSerif' or 'Serif' only and not 'Arial' or 'Times New Roman'.
If you are using maven in your project, you can just add the jasper-fonts dependency to pom.xml:
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports-fonts</artifactId>
<version>6.8.1</version>
</dependency>
Installing the missing font on the system may be a working solution but not for me, I didn't want to have to install the missing fonts after each deployment in a new server, instead I opted for embedding the font with the application.
Regards.
Try adding the line
net.sf.jasperreports.awt.ignore.missing.font=true
to your jasperreports.properties file.
Jasper stops finding one font
For Debian
add
non-free contrib
to deb and deb-src in /etc/apt/sources.list ie:
deb http://ftp.debian.org/debian/ squeeze main non-free contrib
deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib
Then
apt-get update
apt-get install msttcorefonts
Of course you'll need to restart jasperserver. ie:
/opt/jasperreports-server-cp-4.5.0/ctlscript.sh restart
Change for your version / path.
I faced the issue with my web application based on Spring 3 and deployed on Weblogic 10.3 on Oracle Linux 6. The solution mentioned at the link did not work for me.
I had to take the following steps -
1. Copy the Arial*.ttf font files to JROCKIT_JAVA_HOME/jre/lib/fonts directory
2. Make entries of the fonts in fontconfig.properties.src
3. Restart the cluster from Weblogic console
filename.Arial=Arial.ttf
filename.Arial_Bold=Arial_Bold.ttf
filename.Arial_Italic=Arial_Italic.ttf
filename.Arial_Bold_Italic=Arial_Bold_Italic.ttf
You can do it by installing fonts, that means everywhere you want to run that particular application. Simplest way is just add this bl line to your jrxml file:
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
can make your custom fonts via iReport and converting like jars files
Create jasper report in multiple languages(Unicode)
1)Install font in ireport desginer
2)create extension of font(we will use it in applications classpath)
3)install font on os(optional)
4)paste all .ttf of font in jre->lib->fonts directory (otherwise web application will throw error font is not available to JVM)
You can use this library which packages the Liberation-fonts as JasperReport font extension, and registers them as Arial, Times New Roman and Courier:
https://mvnrepository.com/artifact/com.mpobjects.jasperreports.font/jasperreports-fonts-liberation
Actually I fixed this issue in a very simple way
go to your home path, like /root
create a folder named .fonts
copy your all your font files to .fonts, you can copy the font from C:\windows\fonts if you use windows.
sudo apt-get install fontconfig
fc-cache –fv to rebuid fonts caches.
Solution in 2 steps (if you are using centOS)
Download the Microsoft core fonts rpm package.
[root#WEBSVR~/]# wget http://www.itzgeek.com/msttcore-fonts-2.0-3.noarch.rpm
Install rpm package.
[root#WEBSVR~/]# rpm -Uvh msttcore-fonts-2.0-3.noarch.rpm
Add the below in your .jrxml file:
<property name="net.sf.jasperreports.awt.ignore.missing.font" value="true"/>
Copy your Fonts on the following directory
JDK_HOME\jre\lib\fonts
Hey Having trouble viewing documents produced on Windows?
You can try a fine solution easy:
yum install curl cabextract xorg-x11-font-utils fontconfig
rpm -i
https://downloads.sourceforge.net/project/mscorefonts2/rpms/msttcore-fonts-installer-2.6-1.noarch.rpm
After this I need reboot my system CentOS6.
Source: http://mscorefonts2.sourceforge.net/