How To Separate Upward Pdf Files - Purpose 2
In an before post, I used the pdftk tool to extract pages from a pdf file. I had no argue to investigate choice solutions until I encountered the next problem.
I had to extract the showtime four pages of a pdf document. The ordinarily reliable pdftk ascendance generated a Java exception.
$ pdftk T4.pdf truthful cat 1-4 output outputT4.pdf Unhandled Java Exception: Unhandled Java Exception: java.lang.NullPointerException at gnu.gcj.runtime.NameFinder.lookup(libgcj.so.12) at java.lang.Throwable.getStackTrace(libgcj.so.12) at java.lang.Throwable.stackTraceString(libgcj.so.12) at java.lang.Throwable.printStackTrace(libgcj.so.12) at java.lang.Throwable.printStackTrace(libgcj.so.12)
To troubleshoot the problem, I executed the pdftk ascendance using a dissimilar input pdf file. It worked simply fine. The work appears to last the specific input pdf file.
At that point, I started looking for an choice tool.
gs, aka Ghostscript, is a previewer for PDF every bit good every bit PostScript files.
You tin straight gs output to diverse output devices using the -sDEVICE parameter. The pdfwrite device specifies that the output volition last inward PDF file format.
The page make to extract is defined yesteryear -dFirstPage together with -dLastPage parameters. The advert of the output file is specified using -sOutputFile parameter.
$ gs -sDEVICE=pdfwrite -dNOPAUSE -dBATCH -dSAFER -dFirstPage=1 -dLastPage=4 -sOutputFile=outputT4.pdf T4.pdf GPL Ghostscript 9.05 (2012-02-08) Copyright (C) 2010 Artifex Software, Inc. All rights reserved. This software comes amongst NO WARRANTY: reckon the file PUBLIC for details. **** Warning: considering '0000000000 XXXXX n' every bit a costless entry. **** Warning: considering '0000000000 XXXXX n' every bit a costless entry. **** Warning: considering '0000000000 XXXXX n' every bit a costless entry. Processing pages 1 through 4. Page 1 Loading NimbusSanL-Regu font from /usr/share/fonts/type1/gsfonts/n019003l.pfb... 4287624 2669241 2475832 1154775 three done. Loading NimbusSanL-Bold font from /usr/share/fonts/type1/gsfonts/n019004l.pfb... 4328616 2778664 2516200 1192102 three done. Loading NimbusMonL-Regu font from /usr/share/fonts/type1/gsfonts/n022003l.pfb... 4371912 2946486 2677672 1350807 three done. Page two Loading NimbusSanL-BoldItal font from /usr/share/fonts/type1/gsfonts/n019024l.pfb... 4431472 2877228 2738224 1120988 three done. Loading NimbusSanL-ReguItal font from /usr/share/fonts/type1/gsfonts/n019023l.pfb... 4471488 2998784 2758408 1209901 three done. Page three Page four **** This file had errors that were repaired or ignored. **** The file was produced by: **** >>>> iText 1.4.5 (by lowagie.com) <<<< **** Please notify the writer of the software that produced this **** file that it does non accommodate to Adobe's published PDF **** specification.
The to a higher house output messages provided a clue on why the input pdf file was problematic. The pdf file does non "conform to Adobe's published PDF specification." To its credit, gs "repaired or ignored" the problem. It continued on to successfully extract the pages. In this special example, gs is to a greater extent than fault tolerant than its counterpart, pdftk.
P.S. You tin also role ImageMagick to separate pdf files. See my post.
0 Response to "How To Separate Upward Pdf Files - Purpose 2"
Post a Comment