I am trying to generate a PDF file from an html content using FPDF
$this->pdf->AddPage();
$html = "Hello World";
$footer = "Footer";
$this->pdf->WriteHTML($html);
$this->pdf->SetXY(1,255);
$this->pdf->MultiCell(208, 20, $footer, 0, "C", false, 0, '','',true,0,true,true,0,'B',false);
The generated file contains a vertical line on the top of the page (above Hello World). After few tests I found out that it's added by AddPage(), I get that it's sort of a seperator of pages but I don't want to keep it and didn't find how to remove it.
Also, it doesn't seem like a common issue so I don't know if I'm missing something...
I think you are using TCPDF instead of FPDF. So just disable the automated page header via the setPrintHeader() method.
Open the api's code, go to the AddPage() function and modify it...remove the line that is being added.
Related
I have this problem: I'm using Vue CLI with Vetur/Volar, and as u can see from the pic, i wish i could see indentation line also between the empty spaces. Vs code automatically indent everything like that by itself in my case, but, with some empty spaces without lines. And (more strange) i have in my project only 'one' file (a FooterPage.vue file as all the other .vue, nothing different) that's indent in the correct way....only in that file... I actually decided to remove indentation line because is frustrating
[enter image description here](https://i.stack.imgur.com/vJIjW.png)
I need the Indentation lines like the Footer vue file from the system and not like the other pic
Try adding this to your user settings.json or your workspace's .vscode/settings.json file:
"[css]": {
"editor.indentSize": 3,
"editor.detectIndentation": false
}
I am using a shell script to modify many pdfs and would like to create a script that adds the page number (1 of X format) to the bottom of PDFs in a directory along with the text of the filename.
I tried using pdfjam with this format:
pdfjam --pagenumbering true
but it fails saying undefine pagenumbering
Any other recommendations how to do this? I am OK installing other tools but would like this to all be within a shell script.
Thank you
tl;dr: pdfjam --pagecommand '' input.pdf
By default, pdfjam adds the following LaTeX command to every page: \thispagestyle{empty}. By changing the command to an empty command, the default plain page style is used, which consists of a page number at the bottom. Of course you may want to play with other styles or layout options to position the page number differently.
When one imports a multi-page pdf file (the file I have in mind contains images of artwork, one per page) into Mathematica 8.0.1 by
book = Import["simple.pdf"]
Mathematica returns a list of graphics objects, one for each page. I have some manipulations I perform on each page, and then want to save the changed pages back into a single PDF file
Export["DistortedSimple.pdf", distortedbook]
the resulting file has all of the images on a single page. Is there a convenient way to export a list of images to PDF, one per page?
It doesn't seem to be possible with Export, no matter how much I play with the Pages element (apart from the notebook-based solutions given by others).
An alternative is to install pdftk (a relatively small command line tool that we'll use to assemble the pages), and use the following Mathematica function:
exportMultipagePDF[name_String, g_List, options___] :=
Module[
{fileNames, quote},
quote[s_] := "\"" <> s <> "\"";
fileNames =
Table[
FileNameJoin[{$TemporaryDirectory, "mmapage" <> IntegerString[i] <> ".pdf"}],
{i, Length[g]}
];
Check[
Export[#1, #2, "PDF", options] & ### Thread[{fileNames, g}],
Return[$Failed]
];
If[
Run["pdftk", Sequence ## (quote /# fileNames), "cat output", name] =!= 0,
Return[$Failed]
];
DeleteFile /# fileNames;
]
On Windows I needed to quote the file names before passing them to PDFtk. I don't know about other platforms, hopefully it won't cause any trouble.
Try it with
exportMultipagePDF["test.pdf", Table[Graphics[{Hue[x], Disk[]}], {x, 0, 1, .2}]]
(Hi Kevin!)
I just evaluated:
Print[ExampleData[#]] & /# Take[ExampleData["TestImage"], 6]
Export["Desktop/Kevin.pdf", EvaluationNotebook[]]
using V8.0.1 for OS X, and the resulting PDF was split into four pages. So I think you best approach is to (programmatically) create a notebook of your modified images, and export that notebook.
Try saving the notebook as PDF rather than Exporting the set of cells as a PDF.
EDIT:
To ensure you have your page breaks where you want, set Screen Environment to Printing (you can do this via a menu command or programmatically), and insert page breaks using the relevant menu command. This guide page might be helpful.
From your comment, it sounds like you need to set the ImageSize option for the transformed image to ensure it is the size you want when displaying onscreen.
Has anyone put together a plugin or tool for exporting a Tiddlywiki to pdf?
No, there isn't.
As a workaround, I write or find a decent printable stylesheet, then print to PDF.
Why not select the target tiddler to "Open in new window", and print it to PDF with any installed PDF printer?
To accomplish this I used a tool to convert HTML to PDF. These steps are a bit long but well worth it. Once you've got it working it is easily repeated.
In each tiddler that I want in my PDF, I mark with a specific tag; I used TableOfContents.
In each tiddler that is marked with this tag, I added an order field--to be used to define the order of tiddlers to appear in the PDF.
Ensure your HTML headers are properly defined for the document. I think tiddler titles use <h2>, so properly defining subheadings using <h3><h4> etc will ensure, if you want, a nice auto-generated Table of Contents in your PDF.
If you want each tiddler to start on a new page (in the PDF), we need to add this HTML to the end of each tiddler:
<div style = "display:block; clear:both; page-break-after:always;"></div>
With a completed TiddlyWiki document export the tiddlers to a single HTML file--this will be used to generate a PDF document. To export, go to the AdvancedSearch, select the Filter tab. In the search textbox enter your filter criteria--for me that was:
[tag[TableOfContents]sort[order]]
You'll see, immediately, on-screen a list of the tiddlers the system found based on that criteria. Then click on the Export icon and select Static HTML.
Optionally, but I think it's a great idea, manually create a cover page (in your favorite editor)--this will be a single HTML file to act as the cover page in the PDF document; call it cover.html. More on this later.
Download and install wkhtmltopdf (command-line tool to generate PDF from an HTML file).
https://wkhtmltopdf.org/downloads.html
Learn and get familiar with the wkhtmltopdf command line syntax. There are numerous features here so the command you end up with maybe lengthy. Use wkhtmltopdf /? to view general help, then wkhtmltopdf --extended-help to view details (well worth the read).
Generate a PDF document. At the command prompt navigate to the folder where your TiddlyWiki document is located. Here is a list of my favorite command-line switches. My app is installed in C:\Program Files..., so my command line starts with that...
"c:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"
Add this switch for a header on the left:
--header-left "My document title"
For a header on the right:
--header-right "v1.0.0.1"
Font size of header:
--header-font-size 8
Display a line below the header:
--header-line
Spacing between header and content in mm (default 0):
--header-spacing 5
A left-footer ([section] is replaced with the name of the current section:
--footer-left "[section]"
A centered footer:
--footer-center "Page [page] of [topage]"
Footer font size:
--footer-font-size 8
Footer spacing:
--footer-spacing 5
If you want titles to hyperlink (in the PDF) to go back to the TOC:
--enable-toc-back-links
Make sure no background images get printed:
--no-background
I added special styles in the TiddlyWiki document for print media--to hide tags and clean up the spacing. Then I used this switch to ensure print media is used:
--print-media-type
Being in North America I want letter-size pages; I think the default is A4:
-s Letter
IMPORTANT--give the tool access to local files, otherwise your images will be missing in the PDF:
--enable-local-file-access
Use this if you want to have a cover page (see step 6 above):
cover "cover.htm"
And use this if you want a TOC automatically generated. Without a cover page, the TOC will be your first page, so create a cover page:
toc
After the toc identify your exported tiddler HTML file as input to the tool:
tiddlers.html
And, the final argument on the command line is the output PDF file name:
MyDocument.pdf
Export the tid to html.
Then in the terminal, issue:
html2pdf $myTid.html $myTid.pdf
$myTid is only a var and can be any name
:)
I am using doxygen to generate a PDF of my code documentation. The PDF has very big margins when using PAPER_TYPE = letter. It looks OK when using a4wide but I would like to have more control over it. I want to use a package called geometry but can't figure out where to add code like this:
\usepackage[top=2.9cm,left=2in,bottom=1in,right=1in]{geometry}
I would like to not have to change the doxygen-generated tex files if possible.
In your Doxyfile, add or edit the EXTRA_PACKAGES line:
EXTRA_PACKAGES = mydoxy
Then create a new file called mydoxy.sty:
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{mydoxy}[2009/12/29 v1.0.0 csmithmaui's Doxygen style]
\RequirePackage[top=2.9cm,left=2in,bottom=1in,right=1in]{geometry}
% any other custom stuff can go here
\endinput
Drop that mydoxy.sty where LaTeX can find it.
The EXTRA_PACKAGES line will tell Doxygen to add \usepackage{mydoxy} to the preamble of the .tex files it generates. This will cause LaTeX to look for a file named mydoxy.sty. In the mydoxy.sty file that we've created, we can add whatever LaTeX code we like (before the \endinput line). Feel free to drop any other customizations you like in this style file.
Note that I haven't tested this, and I'm making a number of assumptions that may be false. But it should at least get you started.