Edit Links |
FAQ /
Categories: PDF << | Page list | >>Table of contents (hide)
§1. How can I include PDF documents in my file?Use the menu Insert->File->External Material and there the template pdfpages. If you get the error message "Set output to PDF. (use: \pdfoutput = 1)" when you generate a DVI file instead of a PDF file, you have to update your pdfpages package. With pdfpages version 0.4f, this problem is fixed. §2. How do I create clickable URLs/hyperlinks in a PDF file ?Enable the hyperref support in the document settings under PDF Properties. Then all URLs within a LyX URL box will be created as clickable hyperlinks. For more information about this, see LyX's User's Guide manual, section PDF Properties. Incoming hyperlink anchors are Named-Destinations §3. How do I generate bookmarks in a PDF file?This is done in the document settings under PDF Properties §4. How can I create custom PDF bookmarks?
Enable the hyperref support in the document settings under PDF Properties. This will create a bookmark and a Named-Destination (Anchor) called "Name_of_anchor.0" (in my system). URL will be §5. The fonts are bad in the exported PDF, what can I do?The default LaTeX fonts (cm or ec) are bitmap fonts. Therefore they cannot be scaled to any size and in PDF they look pixeled. To avoid these problem, use scalable fonts, like Type 1 (PostScript) or TT (True Type) Fonts. Modern LaTeX distributions ship a whole range of Type 1 fonts. Using True Type fonts is a bit trickier (but some LaTeX distributions like MiKTeX ease their use). Some bleeding edge distributions like XeTeX even provide support for OpenType fonts, which is the latest and greatest font format. However, running these distributions with LyX is still tricky (but might improve in the future). If you want to keep the look of the default fonts, you have several possibilities.
Alternatively, you can also try one of the other Type 1 fonts that ship with LaTeX; for instance Times or Palatino. Caveat: Times, as the name indicates, is designed for printing newspaper with small columns. Therefore the letters are smaller than in other fonts, what makes them improper for one-column documents. To use Times select
To use Palatino select
See also section 3.7.2 "Document Font and Font size" in the LyX User's Guide or the FAQ for the TEX FAQ (keyword=fonts) [tex.ca.uk]. §6. How can I edit/write the properties of a PDF file?This is done in the document settings under PDF Properties What you still can't do is encrypt your document. If you want to define what the reader is allowed to do with your document, you have to use Adobe Acrobat (open your PDF with Acrobat and set the properties). §7. I have included hyperref and LyX tells me of "undefined code sequence"s!If you are using for example Algorithm floats you run into problems with LyX and §8. Can I add annotations to the PDF?Yes. Use the LaTeX package pdfcomment. Here is a module that adds some native LyX-support for that package. §9. Can I permit others to insert annotations to the PDF?As of Adobe Acrobat 7 (pro) you can set the permissions of a PDF so that other users can insert annotations with the free Adobe Reader >= 7.0. By default, this is not allowed. Unfortunately, there is no way yet to change this special permission outside of Acrobat. Due to a very rigid licensing policy (of Adobe) it is unlikely that this will change in the future. §10. Can I generate a PDF file containing a subset of the pages in my document?There are several methods:
gsc -dFirstPage=3 -dLastPage=5 -sDEVICE=pdfwrite -sOutputFile=test.pdf -dBATCH -dNOPAUSE sourcefile.pdf
pdftk sourcefile.pdf cat 130-140 output test.pdf
§11. pdfTeX warning stops generating PDF (destination with the same identifier):You are using package "hyperref" and you have at least two pages "1". ==> recommended hyperref options: plainpages=false,pdfpagelabels If the pages were labled differently (for example: documentclass book with \frontmatter and \mainmatter the pages are labeled "i" and "1"), then the problem is solved. If there is a title page without a printed page number, you can set the page counter to zero, for example. Or \thepage can be redefined, eg: \begingroup \renewcommand{\thepage}{title} % commands that generates the title page \newpage \endgroup Other options:
§12. My eps figures are rotated in the pdf output. What can I do ?The following is a short digest of this thread. The Orientation comment is allowed in eps files. Unfortunately it is interpreted differently by different programs Some programs interpret "Orientation Landscape" as "this file is already in landscape orientation", while others interpret it as "this file should be in landscape orientation, therefore it should be rotated by 90 degrees."
This makes it difficult to implement a unique solution to eps file conversion in LyX, and to get the same output in dvi, ps, and pdf. Ghostcript has a
ps2pdf -dAutoRotatePages=/None foo.ps
lyx -dbg files -e pdf foo.lyx
13. Difference of ps2pdf, dvipdfm(x) and pdflatexLyX supports three different ways of producing PDF files. This is because all of them have their specific pros and cons. Also see http://mintaka.sdsu.edu/GF/bibliog/latex/LaTeXtoPDF.html §13.1 ps2pdf methodTraditionally, you converted your LaTeX source file to a DVI file, which could then be converted to PostScript with latex dvips ps2pdf text.tex -------> text.dvi -------> text.ps --------> text.pdf This basically requires all the graphics to be EPS files. But that's not a major problem, as LyX converts all files to the appropriate format if needed (however, if you have the choice, using EPS as native format is recommended). The main advantage of this method (especially compared with PDFLaTeX) is that the resulting PDF file is almost always much smaller. Also, dvi and postscript specials are supported (the former is also true for dvipfdm(x)). For instance, LyX's change tracking feature uses dvi specials to mark the changes in the output. Hence, the change tracking marks are not visible in a PDF produced with PDFLaTeX. §13.2 Dvipdfm methodIf you don't need PostScript output, you can save a step by going directly from DVI to PDF format by using dvipdfm or the newer dvipdfmx, which is intended to supersede the former: latex dvipdfm(x) text.tex -------> text.dvi -------> text.pdf Once again, the figures must be Encapsulated PS. So you have compact, scalable graphics – with one less step. §13.3 Pdflatex methodThe pdflatex program produces a PDF file directly from the LaTeX source: pdflatex text.tex --------> text.pdf That looks pretty painless; but there's a catch. While the previous methods employ EPS exclusively as the graphics format, pdflatex won't accept EPS directly at all: all the graphics have to be converted to JPEG, PNG, or PDF (!) before compiling. That isn't as bad as it sounds, because EPS can be "wrapped" with PDF headers to become PDF and still have scalable, vector graphics. And JPEG is a compact format for photographs, while PNG is a very compact way to store images with sharp outlines without introducing compression artifacts." And LyX does it again automatically for you, if required. The advantage of this method is that pdflatex is the most feature-rich converter program. It features, for instance, character protusion and font expansion (see this document for explanation), two microtypographical features that let your document look even better than "ordinary" LaTeX could ever achieve. §14. How can I make Acrobat Reader (acroread) update its display?
§15. How can I make gv/Ghostview automatically update its display?Set the resource (in for instance $HOME/.Xdefaults or $HOME/.gv) to: GV.watchFile: True
§16. Where can I find tools for working with PDFs?Open-source tools:
Commercial tools:
§17. The fonts are not embedded in the exported PDF, what can I do?If all the fonts are not embedded, and if the file is sent to other people who have not the non-embedded fonts installed, there will happen a font substitution which can make the pdf file unreadable. This is the reason why most publishers simply do not accept PDF documents with non-embedded fonts (and with bitmapped fonts, see the previous question). If you want to check font embedding, you may either use the To make sure that all fonts are embedded:
If this does not work, please check the PDF output level of your ps2pdf command: these switches do not work with output level less than or equal to 12.
Note that recent versions of the §18. How can I Post-process a PDF?See **Help->Customisation** Post processing can be done by the Copier of a new File-Format. This is called to copy the pdf from the temp dir to the destination, and can do any post-processing along the way - e.g. DigitalSigning (below) First: In Tools->Preferences->File Handling->File Formats Create a new file format called "pdf signed (pdflatex)", same as pdf (pdflatex) except -shortname pdf9 (this is what it will accept) -shortcut none -copier: c:\sign\signpdf.bat $$i $$o Then: In Tools->Preferences->File Handling->Converters Now you can run file->export->pdf signed (pdflatex) Unix: <insert a minimal unix script> Windows: Unfortunately the file parameters $$i,$$o use forward / not backslash \ as the directory separators (thus dos commands can't find the files). CopyIt.bat is a minimal batch file, which fixes the paths rem Simple example Copier batch file for Lyx rem Lyx is passing unix paths ie / instead of backslash as dir separator rem you can use Msg to debug what is being passed into your batch files. rem Msg * "Param1 is: " %1 " Param2 is: " %2 rem replace / with \ in path see: http://www.dostips.com/DtTipsStringManipulation.php#Snippets.Replace set P1=%1 set P1=%P1:/=\% set P2=%2 set P2=%P2:/=\% copy /y %P1% %P2% Is there a direct way to get valid DOS filenames from $$i $$o? §19. How can I Digitally Sign a PDF?PDFs can be digitally signed, using an X509 code signing certificate. Acrobat Reader can show and check signatures. This can be for two purposes: Certification/Authentication/Tamperproofing (signed once when created ie a hash check), and approvals (signed by different people as it is read and approved). My interest is in the first - Authentication/Tamperproofing. PDFs can be signed using a normal code signing certificate or using an Adobe traceable certificate. Using a normal certificate allows you to verify that files have not been tampered with, and allows people to check the certificate, and who it was signed by. However Adobe Reader won't (by default, out of the box) verify the certificate itself. (users can enable certificates trusted by Windows(approve sites) (below) certificate store, and this would work fine for company documents, or in a later legal case). If you want an Adobe tracable certificate they appear to only be available on hardware (usb stick) and are very limited use eg 500 signs/year @ USD299. §To make Acrobat Reader DC use the windows certificate store, i.e. accept valid non-adobe certificates: So what I can do is use my normal code signing certificate to provide some tamperproofing of documents put on a website. While I can do binary compare of pdfs on my own website, once they are copied to other sites - which they are - signing provides some protection against tampering (adding javascript attacks, changing company name etc). This is also good for emailed quotes where prices or terms and conditions could be altered later. A digital signature makes it much easier to show in court, 3 years later, that an emailed document was altered, than trying to prove the customers copy is a fake and not your copy JsignPDF is used to sign the files. It has a gui, but I want to automatically sign PDF's when printed or uploaded, so I use a batch file signpdf.bat, below. The Certificate has been saved as a .PFX file, same as you use with signtool.exe to sign EXE files. A Timeserver is needed to give an externally verifed signing time (Why?(approve sites)). The signature ("Digitally signed by Wimble Inc 2016.07.28 22:43:53 PST") with no graphics is added on the bottom edge of page 1. To automatically sign pdf during export, you must create a new post-processing output format. Set the Copier field to "c:\sign\signpdf.bat $$i $$o" rem SIGNPDF.BAT Sign PDF file. Works with LyX. usage signpdf <inpdf> OR signpdf <inpdf> <outpdf> rem change paths below to suit your system. Use lines with "Msg" to help debugging setlocal set STDIR=c:\sign\ set JSP= java -jar "c:\Program Files\JSignPdf\jsignpdf-1.6.1\JSignPdf.jar" rem set TS=-ts https://freetsa.org/tsr -ta NONE -tsh SHA512 set TS=-ts http://timestamp.comodoca.com/rfc3161 -ta NONE -tsh SHA512 set OCSP= --ocsp set V= -llx 5 -lly 0 -urx 500 -ury 40 -V -fs 8 set CL= -cl CERTIFIED_NO_CHANGES_ALLOWED rem set CL= -cl CERTIFIED_FORM_FILLING_AND_ANNOTATIONS rem Msg * "Param1 is: " %1 " Param2 is: " %2 rem for Lyx, replace / with \ in path see: http://www.dostips.com/DtTipsStringManipulation.php#Snippets.Replace set P1=%1 set P1=%P1:/=\% set P2=%2 set P2=%P2:/=\% if [%2]==[] set P2=%P1% For %%A in (%P1%) do ( Set "INFILE=%%~nxA" ) For %%A in (%P2%) do ( Set "OUTPATH=%%~dpA" ) set P2S=%OUtPATH%%INFILE:.pdf=_signed.pdf% rem Msg * %P1% %P2% %OUTPATH% " " %INFILE% %P2S% %JSP% -d %OUTPATH% -kst PKCS12 -ksf %STDIR%MyCodeSigningCertificate.pfx -ksp MyKeyPassWord -ha SHA512 %TS% %OCSP% %V% %CL% %P1% if not [%2]==[] move /y %P2S% %P2% §20. Anchors / LinkTargets / Named DestinationsNamedDestinations are Adobes name for Anchors or Link Targets ie where URL's hyperlink to a specific point of a pdf. Why? 20.1 How to make them?Hyperref generates them automatically, when exported with pdflatex (ps2pdf loses them). Here are some from a file I generated with pdflatex. section*.1 subsection.2.3 section.2 Doc-Start page.1 The obvious problem with this is that they are named using section numbering, not section titles, so adding a new section breaks the link to content. In a practical sense it renders them rather useless. You can create a nameddest directly You can create one along with a custom bookmark Hyperref destination renaming explains hyperef naming. You can rename the section names with a following label, with destlabel=true Put \usepackage[destlabel=true]{hyperref} in the preamble. Unfortunately document->properties->pdf->hperref options puts destlabel=true into hypersetup, which does not work. \\ I have yet to find a way to have the section names automatically used as named destinations. URL Limitations
special characters. 20.2 How to Explore the Named Destinations?Online Named-Destination Lister(approve sites)
Unless you can find what they are, you can't use them. Acrobat (paid version) appears to be the only gui tool to view named destinations. Why don't you request SumatraPDF to add this(approve sites) now Pdf's are compresssed and unreadable normally. Put this in the preamble to make them readable. 20.3 How to call a named destination?www.abc.com/somepdf.pdf#subsection.2.3 www.abc.com/somepdf.pdf#page.3 www.abc.com/somepdf.pdf#AnchorName.0 Or you can explicitly specify 'nameddest' www.abc.com/somepdf.pdf#nameddest=subsection.2.3 You can also call page numbers directly (also pagemode, zoom, and view)(approve sites) www.abc.com/somepdf.pdf#page=3 §21. Where can I find more help on PDF?Check out Herbert's page on PDF. << | FAQ.PageList | >> |