pdf

Getting started with pdf

Remarks#

Portable Document Format (PDF) is a file format used to present and exchange documents reliably, independent of software, hardware, or operating system. Invented by Adobe, PDF is now an open standard maintained by the International Organization for Standardization (ISO). PDFs can contain images, links, buttons, form fields, audio, video, and business logic. They can also be signed electronically, commented on and encrypted and are easily viewed using free Acrobat Reader DC software. They are also viewable using Google Drive and other software.

PDF files can be created specifically to be accessible for people with disabilities. PDF file formats in use as of 2014 can include tags (XML), text equivalents, captions, audio descriptions, etc. Tagged PDF is required in the PDF/A-1a specification. Some software can automatically produce tagged PDFs, but this feature is not always enabled by default. Some screen readers, including JAWS, Window-Eyes, Hal, and Kurzweil 1000 and 3000 can read tagged PDFs aloud, as can later versions of the Acrobat and Acrobat Reader programs. Moreover, tagged PDFs can be re-flowed and magnified for readers with visual impairments.

Problems remain with adding tags to older PDFs and those that are generated from scanned documents. In these cases, accessibility tags and re-flowing are unavailable, and must be created either manually or with OCR techniques. These processes are inaccessible to some people with disabilities.

Source

Versions#

VersionSoftware(s)Release Date
1.0Adobe Acrobat 1.01993-06-01
1.1Adobe Acrobat 2.01994-11-01
1.2Adobe Acrobat 3.01996-11-01
1.3Adobe Acrobat 4.01999-04-01
1.4Adobe Acrobat 5.02001-05-01
1.5Adobe Acrobat 6.0, Adobe Reader 6.02003-04-01
1.6Adobe Acrobat 7.0, Adobe Reader 7.02005-01-01
1.7Adobe Acrobat 8.0, Adobe Reader 8.02006-10-01

Installation or Setup

To view a pdf you can download Adobe reader for free . You can create pdfs programmatically with the help of, e.g by using iTextSharp, jsPDF or PDFSharp (there are other libraries available)

Code sample from pdfsharp.net

Code source View the output here

using System;
using System.Diagnostics;
using System.IO;
using PdfSharp;
using PdfSharp.Drawing;
using PdfSharp.Pdf;
using PdfSharp.Pdf.IO;
 
namespace HelloWorld
{
  /// <summary>
  /// This sample is the obligatory Hello World program.
  /// </summary>
  class Program
  {
    static void Main(string[] args)
    {
      // Create a new PDF document
      PdfDocument document = new PdfDocument();
      document.Info.Title = "Created with PDFsharp";
 
      // Create an empty page
      PdfPage page = document.AddPage();
 
      // Get an XGraphics object for drawing
      XGraphics gfx = XGraphics.FromPdfPage(page);
 
      // Create a font
      XFont font = new XFont("Verdana", 20, XFontStyle.BoldItalic);
 
      // Draw the text
      gfx.DrawString("Hello, World!", font, XBrushes.Black,
        new XRect(0, 0, page.Width, page.Height),
        XStringFormats.Center);
 
      // Save the document...
      const string filename = "HelloWorld.pdf";
      document.Save(filename);
      // ...and start a viewer.
      Process.Start(filename);
    }
  }
}

PDFTK Server for pdf manipulation

Install PDFTK Server from https://www.pdflabs.com/tools/pdftk-server/

PDFtk Server is a command line tool which can:

•    Merge PDF Documents or Collate PDF Page Scans
•    Split PDF Pages into a New Document
•    Rotate PDF Documents or Pages
•    Decrypt Input as Necessary (Password Required)
•    Encrypt Output as Desired
•    Fill PDF Forms with X/FDF Data and/or Flatten Forms
•    Generate FDF Data Stencils from PDF Forms
•    Apply a Background Watermark or a Foreground Stamp
•    Report PDF Metrics, Bookmarks and Metadata
•    Add/Update PDF Bookmarks or Metadata
•    Attach Files to PDF Pages or the PDF Document
•    Unpack PDF Attachments
•    Burst a PDF Document into Single Pages
•    Uncompress and Re-Compress Page Streams
•    Repair Corrupted PDF (Where Possible)

PDFtk Server does not require Adobe Acrobat or Reader, and it runs on Windows, Mac OS X and Linux.

Collate scanned pages

pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf

or if odd.pdf is in reverse order:

pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output collated.pdf

Decrypt a PDF

pdftk secured.pdf input_pw foopass output unsecured.pdf

Encrypt a PDF using 128-bit strength (the default), withhold all permissions (the default)

pdftk 1.pdf output 1.128.pdf owner_pw foopass

Same as above, except password baz must also be used to open output PDF

pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz

Same as above, except printing is allowed (once the PDF is open)

pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing

Join in1.pdf and in2.pdf into a new PDF, out1.pdf

pdftk in1.pdf in2.pdf cat output out1.pdf

or (using handles):

pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf

or (using wildcards):

pdftk *.pdf cat output combined.pdf

Remove page 13 from in1.pdf to create out1.pdf

pdftk in.pdf cat 1-12 14-end output out1.pdf

or:

pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow