When I convert a markdown file to pdf using pandoc, any image links such as
![](path/to/name_of_file)
the pdf includes the image but has a "Figure n:" under the image. How can I suppress this behaviour?
Secondly, if I include a header using
\usepackage{graphicx}
\usepackage{fancyhdr}
\pagestyle{fancy}
\lhead{\includegraphics[width=3cm]{/Users/pdd/Documents/DATA/Work/Logo/DCM logo email image.jpg}}
in my template.latex file, the pdf includes the image but displays the image name before the image, inserts a horizontal line under the image and places "Heading 1" on the right of the page as an additional header. Again, how can I suppress this behaviour?
Many Thanks
Paul
If you use a filename for the image that does not contain any spaces, the heading disappears. That's the simple and quick solution to this, even if it's not the most satifactory.
Related
I need pdftk to watermark a pdf. I’m generating the content of the watermark programatically and write it out into a text file. Then I use cupsfilter to create the watermark pdf, and then pdftk to apply the generated watermark pdf onto an eBook pdf.
I understand that pdftk applies page by page watermark pdf onto eBook pdf.
If I create a 62 line text file, with 61 empty lines and watermark text on 62nd, then it gets applied properly at around 5/6 of the page height on every page of the eBook pdf.
I add one more empty line, the watermark text disappears. It does not end up on the next page, it is simply not there.
My ultimate goal is to have the watermark text at the bottom of the second page of the eBook
So I would need to create a 3 page pdf, having the first page empty, watermark text at the bottom of the second page and an third page again empty
I tried to insert page break using BBEdit into the text file, but I do not get the expected result.
does anybody have a hint how could I create the required text file which once printed out with cupsflter into a pdf will create the needed watermark pdf (first and third page empty and line or two of text at the bottom of the second page)
OK, so first, the manual is not entirely clear about difference between stamp and multistamp, and background and multibackground - it explains that the watermark pdf will be applied page by page onto eBook pdf if the watermark pdf is a multipage pdf, and that if the watermark pdf has fewer pages than the eBook pdf, the last page of the watermark pdf will be applied to all surplus pages of the eBook, and this is correct, but only in case of multistamp/multibackground option. If you use stamp/background option then only the first page of the watermark pdf will be applied to all pages of the eBook pdf, this was the first to figure out.
So I created two txt files using echo, one empty (one space in it) and one with one line of watermark text. Than I used pdftk cat option to merge the empty pdf with the watermark pdf, so I got two page pdf having first page empty and second with the line of text. Than I merged this file once again with the empty pdf, and ended up with 3 pages pdf.
Then I applied this 3 page watermark pdf with multibackground option to the eBook and got what I wanted - first page no watermark, second page the line of text and third an all other pages with no watermark.
Referring to a previous question
Inserting a pdf file in latex
I'd like to ask how to insert a PDF page into a latex document by filling exactly one page.
If I include a page with design elements that extent to zero margin off the page edges, the solution provided in the link will result in the following, adding white margins of different sizes to the included page:
how do do this propably?
i did workaround-solve it by
\includepdf[noautoscale = true,scale=1.03 ]{<file>}
but this dos not precisely match the old page edges with the new ones. is there a clean version?
Solutions that did not bring the desired results:
https://tex.stackexchange.com/questions/105589/insert-pdf-file-in-latex-document
Thanks!
To adjust the width and height for your pdf pages. First you should use noautoscale to be able to use width and height.
Remark: don't use fitpaper=true or trim=Left Bottom Right Top because they are for geometry page not to adjust your pdf pages.
\documentclass[]{book}
\usepackage[]{pdfpages}
\begin{document}
\includepdf[pages={1},noautoscale,width=5cm,height=10cm]{your.pdf}
\end{document}
I'm using iText with Java to create a PDF file. I'm trying to place a paragraph on left, and float an image on right (e.g. next to each other). Using the following code does insert the image, but it also makes the text fuzzy on the entire page (other pages are fine).
// add image
Image img = Image.getInstance(imgPath);
img.setAlignment(Image.RIGHT | Image.TEXTWRAP);
img.scaleToFit(1000, 72f); // 1" height
//img.setSpacingBefore(0f); // does not have any effect
document.add(img);
// add text
Paragraph par = new Paragraph("some text here", styleBody);
par.setSpacingBefore(20f);
document.add(par);
If I remove the image portion of the code, the text looks clean. This is my first attempt at adding an image next to text. Must be doing something obviously wrong. Any idea what could cause this?
I was able to solve this problem. The code above is perfectly fine. The problem was I was using a PNG image with transparency. When I removed the transparency (by re-exporting the image from Illustrator with transparency turned off), I was able to create PDFs with clear text.
I think the transparency forces the PDF page to be written in CMYK color scheme rather than RGB, which perhaps causes this issue.
Hope this helps someone else. I searched everywhere but couldn't find any leads talking about fuzzy text in iText.
How can I easily crop a PDF page in a given PDF file? I prefer using as little coding as possible, and guess border geometries as little as possible...
There are several options:
Crop by point-and-click using a GUI front-end:
pdf-quench
krop
briss
PDF scissors
Crop by using the command line:
pdfcrop command (provided by texlive-extra-utils), using the following arguments: pdfcrop --margins '-30 -30 -250 -150' --clip input.pdf output.pdf (-left -top -right -bottom format).
PDFCrop
convert -crop command (provided by imagemagick)
Ghostscript
Crop by writing your own script:
Python
LaTeX
For quick, GUI-aided PDF cropping tasks, try pdfarranger (available in Debian repos, formerly known as PDF-Shuffler).
For precise point-and-click cropping, one option is to use LibreOffice Draw.
The instructions below assume you want to crop part of a single-page PDF:
Start with a blank document
Select the Insert > Image... menu
Navigate to the PDF you wish to crop
The contents of the PDF will show up as an image
Right-click on the PDF content in your document and select the "Crop" menu item.
Use the handles to resize the viewable area of the PDF to the section you want to remain after cropping
Click outside of the PDF to disable the crop handles
Click again on the PDF content to position it however you want by:
Dragging it around the page
Using the arrow keys to move it
Use the Draw positioning tools to align or center the PDF content.
When you're happy with the result, save, export it to PDF, or print it.
For multi-page PDFs, You'll have to work page by page by first splitting the PDF into multiple pages using some other tool like PDF Arranger (or simply "Printing to PDF" each page of the PDF you want to crop in your PDF viewer), cropping them one by one with Draw, then recombining them into a single PDF (using PDF Arranger again).
You could try using the pdfCropMargins Python program (https://pypi.org/project/pdfCropMargins/) with the -pg option to select the particular page. The command-line program offers many options, and also has an optional GUI.
You can use Inkscape to losslessly crop PDFs. This uses Inkscape's built-in SVG-PDF conversion.
Open your file in Inkscape: File -> Open -> select your file -> Open
Resize PDF:
Using user-input values: File -> Document properties -> Page -> Custom size
Using auto resize to content: File -> Document properties -> Page -> Custom size -> Resize page to content... -> set desired margin -> Resize page to drawing or selection
Inkscape is a particularly good option as often PDF crop utilities (such as krop, mentioned in other answers) do not change the actual size of the object, instead adjusting how much of the object (e.g. an A4 page) is displayed.
E.g. from krop homepage:
Unfortunately, there is no simple way to eliminate
unnecessary/invisible parts of a PDF file. krop only adjusts which
parts of a PDF are displayed; the original content is still there in
the file and will, for instance, show up when editing the file in
inkscape
Editing directly in Inkscape does exactly what this says is impossible.
The list of tools provided by #sparkler was interesting, but did not help me very much.
Some of the tools provided, actually cropped my pages, but usually they involved some conversion to an image which made pdf files blurry and hard to read.
In the end I used podofocrop of PoDoFo tools which was able to retain all the graphics at full resolution and the text as real text.
It will crop all pages to the minimal size (i.e. without a border).
The command is: podofocrop input.pdf output.pdf
To install on MacOS use brew install podofo
I have a lot of pdf files each one with an image inside. I want to clip a rectangular region in each of these files and concatenate them into a single pdf file. Is it possible with ghostscript or similar?
I'll have a go at this. Try Briss if you want to crop rectangular regions in pdf files. It's free and cross-platform GUI.
If you have multiple pdf files you can concatenate/merge them first online using http://www.pdfmerge.com/ Then use Briss to crop the images out into a new pdf file. Or vice-versa depending on the location of your images inside the pdf files.
After you fire up Briss, load the merged pdf file containing the images. When you're asked if you want to exlude anything, just click "cancel" if you want to include all pages.
If your file has many pages, similar pages may be overlapping each other so you can draw a rectangle over the region you want to crop. Click Action -> Preview for previewing the output. Click Action -> Crop PDF to finalize your output pdf file. Cheers.