Blank LatexPDF File issue with custom Latex Style with SPHINX - pdf

Recently I've created my PDF file correctly as in style formatting.
But now I've got the issue that my RST files from Sphinx are not included.
Maybe that someone knows how I include the RST content into the custom PREAMBLE - sty file content
main.sty
\PassOptionsToPackage{english}{babel}
\usepackage{amsmath}
\usepackage{color,pxfonts,fix-cm}
\usepackage{latexsym}
\usepackage[mathletters]{ucs}
\DeclareUnicodeCharacter{32}{$\ $}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{pict2e}
\usepackage{wasysym}
\usepackage{tikz}
\pagestyle{empty}
\geometry{left=0.2in, top=0.5in, paperwidth=595pt, paperheight=878pt}
\begin{document}
\definecolor{color_93343}{rgb}{0.25098,0.25098,0.25098}
\definecolor{color_217206}{rgb}{0.737255,0.839216,0.443137}
\begin{tikzpicture}[overlay]\path(0pt,0pt);\end{tikzpicture}
\begin{picture}(-5,0)(2.5,0)
\put(-15,-837.4999){\includegraphics[width=596.25pt,height=887.25pt]{latexImage_ab7aceb12f4add82da5ce423202fd278.png}}
\put(55.775,-99.78003){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(55.525,-810){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(282.38,-810){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(509.48,-810){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(55.775,-823.5){\fontsize{11}{1}\usefont{T1}{cmr}{m}{n}\selectfont\color{color_93343} }
\put(55.775,-118.05){\fontsize{16}{1}\usefont{T1}{cmr}{b}{n}\selectfont\color{color_217206} }
\put(55.775,-150.3){\fontsize{16}{1}\usefont{T1}{cmr}{b}{n}\selectfont\color{color_217206} }
\end{picture}
\end{document}
[SPHINX] Conf.py:
latex_engine = 'pdflatex'
latex_additional_files = [
'latexImage_ab7aceb12f4add82da5ce423202fd278.png',
'main.sty'
]
latex_elements = {
# Additional stuff for the LaTeX preamble.
'extraclassoptions': 'openany',
'preamble' : r"""
\usepackage{main}
\renewcommand{\subtitle}{%s}
""" % (project)
}
It creates the latex PDF with the correct custom styling.. But all the RST content is not included.
I also tried it with 'latex_documents' Creation method within the conf.py but resulted also with a blanko PDF file.

Related

Ghostscript PDFA1A to PDFA1B Validation VeraPdf

So I want to have a valid PDFA1B which validates correctly with my function:
public boolean isValidPdfA1B(File pdf) throws Exception {
VeraGreenfieldFoundryProvider.initialise();
PDFAFlavour flavour = PDFA_1_B;
try (PDFAParser parser = Foundries.defaultInstance().createParser(pdf, flavour)) {
PDFAValidator validator = Foundries.defaultInstance().createValidator(flavour, false);
ValidationResult result = validator.validate(parser);
if (result.isCompliant()) {
return true;
} else {
return false;
}
} catch (IOException | ValidationException | ModelParsingException | EncryptedPdfException exception) {
// Exception during validation
return false;
}}
First I created a pdf with word - export ISO19005-1 PDFA compliant
Then i used Ghostscript with AdobeRGB.icc and the following command to create a PDFA1B document:
λ gswin64 -dPDFA=1 -dBATCH -dNOPAUSE -dNOOUTERSAVE
-sColorConversionStrategy=UseDeviceIndependentColor -sDEVICE=pdfwrite -sOutputFile=/PATH/TO/output-a.pdf -dPDFACompatibilityPolicy=2 /PATH/TO/PDFA_def.ps /PATH/TO/word_created.pdf
Before I hat to do the pdfmarks solution from Ghostscript won't generate PDF/A with UTF16BE text string detected in DOCINFO - in spite of PDFACompatibilityPolicy saying otherwise to avoid the error with DocumentInfo
So now (with UseDeviceIndependentColor set, RGB does produce a lot of more problems) - I have the following errors when in my Vera-Pdf Check:
DeviceRGB may be used only if the file has a PDF/A-1 OutputIntent that
uses an RGB colour space

Latex printing Listings in black/white only, although the rest is printed in color?

I'm currently having trouble printing my generated PDF of a latex document. Although printing the whole document in color just fine, for some reason all my listings are printed in black and white only. In the PDF itself the listings are displayed in color, just as expected. Is this a normal latex behavior or am I doing something wrong? I'm using the regular listing package with the following defined style. Minimum working example:
\documentclass[ twoside,openright,numbers=noenddot,%
toc=bibliography,toc=listof,%
footinclude=false,headinclude=false,cleardoublepage=empty,%
BCOR=5mm,paper=a4,fontsize=11pt,%DIV=14,%
ngerman%
]{scrreprt}
\RequirePackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00A0}{~}
\RequirePackage[T1]{fontenc}
\newcommand{\currentVersion}{Version 2.1\xspace}
\newcounter{dummy}
\PassOptionsToPackage{ngerman}{babel}
\RequirePackage{babel}
\RequirePackage{csquotes}
\renewcaptionname{ngerman}{\listfigurename}{Abbildungen}
\renewcaptionname{ngerman}{\listtablename}{Tabellen}
\PassOptionsToPackage{fleqn}{amsmath}
\RequirePackage{amsmath}
\usepackage{geometry}
\geometry{a4paper,left=25mm,right=35mm,top=25mm,bottom=30mm}
\PassOptionsToPackage{dvipsnames}{xcolor}
\RequirePackage{xcolor}
\definecolor{ingwi}{cmyk}{.9,0,0,0}
\usepackage{textcomp}
\usepackage{scrhack}
\usepackage{xspace}
\usepackage{mparhack}
\PassOptionsToPackage{printonlyused}{acronym}
\usepackage{acronym}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[shadow]{todonotes}
\newcommand{\todox}[1]{\todo[inline, size=\small]{#1}}
\newcounter{todocounter}
\renewcommand{\todox}[2][]{\stepcounter{todocounter}\todo[inline, size=\small,caption={\thetodocounter: #2}, #1]{\renewcommand{\baselinestretch}{0.5}\selectfont\thetodocounter: #2\par}}
\usepackage{blindtext}
\counterwithout{footnote}{chapter}
\usepackage{tabularx}
\setlength{\extrarowheight}{3pt}
\usepackage{caption}
\captionsetup{format=plain,indention=1em,font=small}
\usepackage{subfig}
\usepackage{wrapfig}
\usepackage{listings}
\lstset{emph={trueIndex,root},emphstyle=\color{BlueViolet}}%\underbar} % for special keywords
\lstset{language=[LaTeX]Tex,%C++,
keywordstyle=\color{RoyalBlue},%\bfseries,
basicstyle=\small\ttfamily,
%identifierstyle=\color{NavyBlue},
commentstyle=\color{Green}\ttfamily,
stringstyle=\rmfamily,
numbers=none,%left,%
numberstyle=\scriptsize,%\tiny
stepnumber=5,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
% frameround=ftff,
frame=single,
texcl=true,
belowcaptionskip=.75\baselineskip
%frame=L
}
\lstdefinestyle{Java}{
belowcaptionskip=1\baselineskip,
breaklines=true,
xleftmargin=\parindent,
language=Java,
texcl=true,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bfseries\color{blue},
commentstyle=\itshape\color{black!50!white},
morecomment=[s][\color{white}]{---}{+++},
morecomment=[s][\color{orange!90!black}]{#}{\ },
identifierstyle=\color{black},
stringstyle=\color{green!60!black}}
\lstdefinestyle{Xml}{
belowcaptionskip=1\baselineskip,
breaklines=true,
xleftmargin=\parindent,
language=Java,
texcl=true,
numbers=left,
numberstyle=\tiny,
stepnumber=1,
numbersep=8pt,
showstringspaces=false,
basicstyle=\footnotesize\ttfamily,
identifierstyle=\bfseries\color{black},
commentstyle=\itshape\color{black!50!white},
stringstyle=\color{green!60!black}}
\PassOptionsToPackage{pdftex,hyperfootnotes=false,pdfpagelabels}{hyperref}
\usepackage{hyperref}
\pdfcompresslevel=9
\pdfadjustspacing=1
\PassOptionsToPackage{pdftex}{graphicx}
\usepackage{graphicx}
\hypersetup{%
%draft, % = no hyperlinking at all (useful in b/w printouts)
pdfstartpage=1, pdfstartview=Fit,%
colorlinks=true, linktocpage=true,
%urlcolor=Black, linkcolor=Black, citecolor=Black, %pagecolor=Black,%
%urlcolor=brown, linkcolor=RoyalBlue, citecolor=green, %pagecolor=RoyalBlue,%
% uncomment the following line if you want to have black links (e.g., for printing)
colorlinks=false, pdfborder={0 0 0},
breaklinks=true, pdfpagemode=UseNone, pageanchor=true, pdfpagemode=UseOutlines,%
plainpages=false, bookmarksnumbered, bookmarksopen=true, bookmarksopenlevel=1,%
hypertexnames=true, pdfhighlight=/O,%nesting=true,%frenchlinks,%
pdftitle={test},%
pdfauthor={\textcopyright\ test, test},%
pdfsubject={},%
pdfkeywords={},%
pdfcreator={pdfLaTeX},%
pdfproducer={LaTeX with hyperref}%
}
\makeatletter
\#ifpackageloaded{babel}%
{%
\addto\extrasamerican{%
\renewcommand*{\figureautorefname}{Figure}%
\renewcommand*{\tableautorefname}{Table}%
\renewcommand*{\partautorefname}{Part}%
\renewcommand*{\chapterautorefname}{Chapter}%
\renewcommand*{\sectionautorefname}{Section}%
\renewcommand*{\subsectionautorefname}{Section}%
\renewcommand*{\subsubsectionautorefname}{Section}%
}%
\addto\extrasngerman{%
\renewcommand*{\chapterautorefname}{Kapitel}%
\renewcommand*{\sectionautorefname}{Abschnitt}%
\renewcommand*{\subsectionautorefname}{Abschnitt}%
\renewcommand*{\subsubsectionautorefname}{Abschnitt}%
\renewcommand*{\paragraphautorefname}{Absatz}%
\renewcommand*{\subparagraphautorefname}{Absatz}%
\renewcommand*{\footnoteautorefname}{Fu\"snote}%
\renewcommand*{\FancyVerbLineautorefname}{Zeile}%
\renewcommand*{\theoremautorefname}{Theorem}%
\renewcommand*{\appendixautorefname}{Anhang}%
\renewcommand*{\equationautorefname}{Gleichung}%
\renewcommand*{\itemautorefname}{Punkt}%
}
\providecommand{\subfigureautorefname}{\figureautorefname}%
}{\relax}
\makeatother
\PassOptionsToPackage{l2tabu,orthodox,abort}{nag}
\usepackage{nag}
\usepackage{enumitem}
\setdescription{font=\normalfont\bfseries}
\usepackage[activate={true,nocompatibility},final,tracking=true,kerning=true,spacing=true,factor=1100,stretch=10,shrink=10]{microtype}
\usepackage{mathpazo}
\setkomafont{disposition}{\bfseries}
\usepackage{adjustbox}
\usepackage{tabularx}
\usepackage{pifont}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand{\code}[1]{\texttt{\em{#1}}}
\begin{document}
\frenchspacing
\raggedbottom
\selectlanguage{ngerman}
\pagenumbering{roman}
\pagestyle{plain}
\cleardoublepage
\pagenumbering{arabic}
\pagestyle{headings}
\begin{minipage}[chbt]{0.95\textwidth}
\begin{lstlisting}[caption=test,captionpos=b,label={lst:example_facade},style=Java]
public class ExampleFacade implements CrudFacade<ExampleEntity> {
#Override
public ExampleEntity getSpecificEntity(String id) throws NoSuchDataSetException {
// retrieve specific entity from database
// ...
}
}
\end{lstlisting}
\end{minipage}
\begin{figure}[hbt]
\centering
\includegraphics[width=0.6\textwidth]{insert your picture here}
\caption{test}
\label{fig:lifecycle}
\end{figure}
\end{document}
Download my PDF: https://www.file-upload.net/download-14777480/test.pdf.html
Edit: It seems as though this is only a problem with my particular printer for some reason I can't explain at all. When using the printer of a friend it works just fine, even with the original PDF, not just the working example. I'm using the Brother DCP-L3550CDW.

How to create each page as PDF from existing PDF using mPDF in Laravel

use ZanySoft\LaravelPDF\PDF;
$mpdf = new PDF();
$mpdf->SetImportUse();
$pagecount = $mpdf->SetSourceFile(storage_path() . '/app/public/applications/test.pdf');
// test.pdf have 2 pages $pagecount have value 2.
for($i=1; $i <= $pagecount ; $i++) {
$tplId = $mpdf->ImportPage($i);
$mpdf->addPage();
$mpdf->UseTemplate($tplId);
// store each page as pdf file
$new_file_name = "new-".$i.".pdf";
$mpdf->Output($new_file_name, \Mpdf\Output\Destination::FILE);
}
I am getting an error Class 'Mpdf\Output\Destination' not found. I have tried below things as second argument of Output();
$mpdf->Output($new_file_name, \PDF\Output\Destination::FILE);
$mpdf->Output($new_file_name, \Mpdf\Mpdf\Output\Destination::FILE);
But, it is not working. Please help to store fetch page store as PDF file direct on directory.
ZanySoft\LaravelPDF\PDF uses mPDF in version 6.1 which does not have output destination class constants yet.
Use a plain string:
$mpdf->Output($new_file_name, 'F');
Or use composer package mpdf/mpdf in version >=7 directly.

Converting docx to pdf with phpword

I want to convert a docx file to pdf using phpword
my code looks like this:
$FilePath = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".docx";
$FilePathPdf = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".pdf";
//DOCX TO PDF
require_once APPPATH.'third_party/phpword/bootstrap.php';
$rendererLibraryPath = PHPWORD_BASE_DIR . '/vendor/dompdf/dompdf';
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF');
$phpWord = new \PhpOffice\PhpWord\PhpWord();
//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load($FilePath);
//Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save($FilePathPdf, true);
But i generate an empty pdf file: LINK TO FILE
Paths are correct and .docx have content
I try with tcpdf render:
$rendererLibraryPath = PHPWORD_BASE_DIR . '/vendor/tecnickcom/tcpdf';
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');
and my pdf file have 2 pages without content: LINK TO 2ND FILE
Finally i found a free alternative solution installing libreoffice:
$FilePath = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".docx";
$FilePathPdf = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".pdf";
require_once APPPATH.'third_party/phpword/bootstrap.php';
$template = new \PhpOffice\PhpWord\TemplateProcessor(APPPATH.'media/Plantillas/Factura/Factura.docx');
foreach($data as $key => $value){
$template->setValue($key, $value);
}
$template->saveAs($FilePath);
shell_exec($this->CI->config->item('libreoffice_exec')." --headless --convert-to pdf --outdir \"".$Path."\" \"$FilePath\"");
Calling soffice.exe CLI with this parameters:
soffice.exe --headless --convert-to pdf --outdir "C:/media/Documentos/Facturas/pdf" "C:/media/Documentos/Facturas/Factura1.docx";

CMS and store hi-resolution images in generated pdf

I'm looking for good CMS for publishing software manuals.
Requirements:
publish manual pages as web pages with thumbnails and shows full resolution after click on image,
exporting manual pages to a pdf file with full resolution images instead to thumbnails.
I found IMHO best wiki system named Tiki Wiki (https://info.tiki.org/) but when I export to pdf then I gets low resolution thumbnail.
I solve this problem by very simple Tiki Wiki code modification:
Modify lib/wiki-plugins/wikiplugin_img.php to force using full image resolution instead to thumbnail in print page mode (inserted code 1) and rescale images in generated HTML by 0.5 factor (inserted code 2):
[...]
function wikiplugin_img( $data, $params )
{
[...]
$imgdata = array_merge($imgdata, $params);
// inserted code 1 (~410 line)
if ($GLOBALS['section_class']=="tiki_wiki_page print"){
$imgdata['thumb'] = '';
}
// end of inserted code 1
//function calls
if ( !empty($imgdata['default']) || !empty($imgdata['mandatory'])) {
[...]
$fwidth = '';
$fheight = '';
if (isset(TikiLib::lib('parser')->option['indexing']) && TikiLib::lib('parser')->option['indexing']) {
$fwidth = 1;
$fheight = 1;
} else {
// inserted code 2 (~410 line)
if ($GLOBALS['section_class']=="tiki_wiki_page print"){
$fwidth = $imageObj->get_width() / 2;
$fheight = $imageObj->get_height() / 2;
} else {
$fwidth = $imageObj->get_width();
$fheight = $imageObj->get_height();
}
// end of inserted code 2 (~638 line)
}
[...]
Now, after printing to pdf by wkhtmltopdf we gets pdf with small but full resolution images.
Additional modifies:
Adds following lines to cms/cssmenus.css (or other css included in print mode) for increase bottom margin of image caption:
div.thumbcaption {
margin-bottom: 5mm;
}
Removes lines from 171 to ~175 in templates/tiki-show_content.tpl for remove the "The original document is available at" foot.