{"id":15042413,"url":"https://github.com/tavinus/pdfscale","last_synced_at":"2025-04-06T11:08:06.471Z","repository":{"id":41160176,"uuid":"62981733","full_name":"tavinus/pdfScale","owner":"tavinus","description":"Bash Script to Scale and Resize PDFs using Ghostscript","archived":false,"fork":false,"pushed_at":"2024-07-22T12:50:45.000Z","size":532,"stargazers_count":260,"open_issues_count":4,"forks_count":37,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-06T11:08:01.377Z","etag":null,"topics":["bash-script","ghostscript","imagemagick","macos","pdf","pdfinfo","resize-pdfs","scale-pdfs"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tavinus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"tavinus","ko_fi":"tavinus","custom":["https://bit.ly/paypaltavinus"]}},"created_at":"2016-07-10T04:37:48.000Z","updated_at":"2025-04-03T19:37:32.000Z","dependencies_parsed_at":"2024-07-22T15:24:37.790Z","dependency_job_id":null,"html_url":"https://github.com/tavinus/pdfScale","commit_stats":null,"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tavinus%2FpdfScale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tavinus%2FpdfScale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tavinus%2FpdfScale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tavinus%2FpdfScale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tavinus","download_url":"https://codeload.github.com/tavinus/pdfScale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247471519,"owners_count":20944158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","ghostscript","imagemagick","macos","pdf","pdfinfo","resize-pdfs","scale-pdfs"],"created_at":"2024-09-24T20:47:15.817Z","updated_at":"2025-04-06T11:08:06.450Z","avatar_url":"https://github.com/tavinus.png","language":"Shell","readme":"# pdfScale 2\nBash Script to ***scale*** and/or ***resize*** PDFs from the command line.  \nUses ghostscript (`gs`) to create a scaled and/or resized version of the pdf input.  \n\nIn `scaling mode`, the PDF paper size does not change, just the elements are scaled.  \nIn `resize mode`, the PDF paper will be changed and fit-to-page will be applied.  \nIn `mixed mode`, the PDF will first be `resized` then `scaled` with two Ghostscript calls.  \nA temporary file is used in `mixed mode`, at the target location.  \n  \n---------------------------------------------- \n#### If you want to support this project, you can do it here :coffee: :beer:   \n  \n[![paypal-image](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=HP344TKTWXFXE\u0026source=url)   \n\n----------------------------------------------  \n  \n## Example Runs\nBetter than explaining is showing it:  \n#### Checking File Information\n```\n$ ./pdfScale.sh -i test.pdf\npdfScale.sh v2.6.2 - Paper Sizes\n-------------+-----------------------------\n        File | test.pdf\n  Paper Type | A4 Portrait\n       Pages | 4\n-------------+-----------------------------\n  FIRST PAGE |    WIDTH x HEIGHT\n      Points |      595 x 842\n Millimeters |      210 x 297\n      Inches |      8.3 x 11.7\n-------------+-----------------------------\n   ALL PAGES |    WIDTH x HEIGHT (pts)\n           1 |      595 x 842\n           2 |      595 x 842\n           3 |      595 x 842\n           4 |      595 x 842\n-------------+-----------------------------\n```\n#### Scale by 0.95 (-5%)\nThis also shows a very special case of a PDF file that has no `/MediaBox` defined. It is a dumb container of n-up binary PDF pages.  \n  \n 1. `Ggrep` fails, then \n 2. `PDFInfo` fails (not installed), then \n 3. `ImageMagick` fails (not installed), then \n 4. The Ghostscript PS script does the job  \n   \n*This was on CygWin64 `@` Windows11 x64, MacOS would try `mdls` as well.*\n```\n$ ./pdfScale.sh -v ../input-nup.pdf\npdfScale.sh v2.6.2 - Verbose Execution\n   Single Task: Scale PDF Contents\n       Dry-Run: FALSE\n    Input File: ../input-nup.pdf\n   Output File: ../input-nup.SCALED.pdf\n   Explode PDF: Disabled\n Get Page Size: Adaptive Enabled\n        Method: Grep\n                Failed, trying next method\n        Method: PDFInfo\n                Failed, trying next method\n        Method: ImageMagick's Identify\n                Failed, trying next method\n        Method: Ghostscript PS Script\n    Page Range: None (all pages)\n  Source Width: 842 postscript-points\n Source Height: 595 postscript-points\n    Print Mode: Print ( auto/empty )\n  Scale Factor: 0.95 (auto)\n Scale Percent: -5%\n    Vert-Align: CENTER\n     Hor-Align: CENTER\n Translation X: 22.16 = 22.16 + 0.00 (offset)\n Translation Y: 15.66 = 15.66 + 0.00 (offset)\n    Background: No background (default)\n  Final Status: File created successfully\n```\n#### Resize to A0 and Scale by 1.05 (+5%)\n```\n$ ./pdfScale.sh -v -r a0 -s 1.05 ../mixsync_manual_v1-2-3.pdf\npdfScale.sh v2.6.2 - Verbose Execution\n   Mixed Tasks: Resize \u0026 Scale\n       Dry-Run: FALSE\n    Input File: ../mixsync_manual_v1-2-3.pdf\n   Output File: ../mixsync_manual_v1-2-3.A0.SCALED.pdf\n   Explode PDF: Disabled\n Get Page Size: Adaptive Enabled\n        Method: Grep\n    Page Range: None (all pages)\n  Source Width: 842 postscript-points\n Source Height: 595 postscript-points\n    Print Mode: Print ( auto/empty )\n   Fit To Page: Enabled (default)\n   Auto Rotate: PageByPage\n   Flip Detect: Wrong orientation detected!\n                Inverting Width \u003c-\u003e Height\n  Run Resizing: A0 ( 3370 x 2384 ) pts\n     New Width: 3370 postscript-points\n    New Height: 2384 postscript-points\n  Scale Factor: 1.05\n Scale Percent: +5%\n    Vert-Align: CENTER\n     Hor-Align: CENTER\n Translation X: -80.24 = -80.24 + 0.00 (offset)\n Translation Y: -56.76 = -56.76 + 0.00 (offset)\n    Background: No background (default)\n  Final Status: File created successfully\n```\n#### Resize to A3, Scale by 1.11 (+11%) and Explode the results\n*Exploding (splitting) will create a PDF file for each page, with the `.Page#.pdf` suffix*  \n```\n$ ./pdfScale.sh -v -s 1.11 -r A3 -e ../mixsync_manual_v1-4-2.pdf\npdfScale.sh v2.6.2 - Verbose Execution\n   Mixed Tasks: Resize \u0026 Scale\n       Dry-Run: FALSE\n    Input File: ../mixsync_manual_v1-4-2.pdf\n   Output File: ../mixsync_manual_v1-4-2.A3.SCALED.Page%d.pdf\n   Explode PDF: Enabled\n Get Page Size: Adaptive Enabled\n        Method: Grep\n    Page Range: None (all pages)\n  Source Width: 595 postscript-points\n Source Height: 842 postscript-points\n    Print Mode: Print ( auto/empty )\n   Fit To Page: Enabled (default)\n   Auto Rotate: PageByPage\n   Flip Detect: No change needed\n  Run Resizing: A3 ( 842 x 1191 ) pts\n     New Width: 842 postscript-points\n    New Height: 1191 postscript-points\n  Scale Factor: 1.11\n Scale Percent: +11%\n    Vert-Align: CENTER\n     Hor-Align: CENTER\n Translation X: -41.72 = -41.72 + 0.00 (offset)\n Translation Y: -59.01 = -59.01 + 0.00 (offset)\n    Background: No background (default)\n  Final Status: File created successfully\n```\n#### Resize to A2 and disables Auto-Rotation\n```\n$ ./pdfScale.sh -v -r A2 -a none ../input.pdf\npdfScale.sh v2.6.2 - Verbose Execution\n   Single Task: Resize PDF Paper\n       Dry-Run: FALSE\n    Input File: ../input.pdf\n   Output File: ../input.A2.pdf\n   Explode PDF: Disabled\n Get Page Size: Adaptive Enabled\n        Method: Grep\n    Page Range: None (all pages)\n  Source Width: 595 postscript-points\n Source Height: 842 postscript-points\n    Print Mode: Print ( auto/empty )\n  Scale Factor: Disabled (resize only)\n   Fit To Page: Enabled (default)\n   Auto Rotate: None\n   Flip Detect: No change needed\n  Run Resizing: A2 ( 1191 x 1684 ) pts\n  Final Status: File created successfully\n```\n#### Resize to custom 200x300 mm, disable Flip-Detection and Scale by 0.95 (-5%)\n```\n$ ./pdfScale.sh  -v -v -r 'custom mm 200 300' -f disable -s 0.95 ../mixsync_manual_v1-2-3.pdf\n2024-07-17:14:43:15 | pdfScale.sh v2.6.2 - Verbose Execution\n2024-07-17:14:43:15 |    Mixed Tasks: Resize \u0026 Scale\n2024-07-17:14:43:15 |        Dry-Run: FALSE\n2024-07-17:14:43:15 |     Input File: ../mixsync_manual_v1-2-3.pdf\n2024-07-17:14:43:15 |    Output File: ../mixsync_manual_v1-2-3.CUSTOM.SCALED.pdf\n2024-07-17:14:43:15 |    Explode PDF: Disabled\n2024-07-17:14:43:15 |  Get Page Size: Adaptive Enabled\n2024-07-17:14:43:15 |         Method: Grep\n2024-07-17:14:43:15 |     Page Range: None (all pages)\n2024-07-17:14:43:16 |   Source Width: 842 postscript-points\n2024-07-17:14:43:16 |  Source Height: 595 postscript-points\n2024-07-17:14:43:16 |     Print Mode: Print ( auto/empty )\n2024-07-17:14:43:16 |    Fit To Page: Enabled (default)\n2024-07-17:14:43:16 |    Auto Rotate: PageByPage\n2024-07-17:14:43:16 |    Flip Detect: Disabled\n2024-07-17:14:43:16 |   Run Resizing: CUSTOM ( 567 x 850 ) pts\n2024-07-17:14:43:16 |      New Width: 567 postscript-points\n2024-07-17:14:43:16 |     New Height: 850 postscript-points\n2024-07-17:14:43:16 |   Scale Factor: 0.95\n2024-07-17:14:43:16 |  Scale Percent: -5%\n2024-07-17:14:43:16 |     Vert-Align: CENTER\n2024-07-17:14:43:16 |      Hor-Align: CENTER\n2024-07-17:14:43:16 |  Translation X: 14.92 = 14.92 + 0.00 (offset)\n2024-07-17:14:43:16 |  Translation Y: 22.37 = 22.37 + 0.00 (offset)\n2024-07-17:14:43:16 |     Background: No background (default)\n2024-07-17:14:43:17 |   Final Status: File created successfully\n```\n\n## Help info\n```\n$ ./pdfScale.sh -h\npdfScale.sh v2.6.2\n\nUsage: pdfScale.sh \u003cinFile.pdf\u003e\n       pdfScale.sh -i \u003cinFile.pdf\u003e\n       pdfScale.sh [-v] [-s \u003cfactor\u003e] [-m \u003cpage-detection\u003e] \u003cinFile.pdf\u003e [outfile.pdf]\n       pdfScale.sh [-v] [-r \u003cpaper\u003e] [-f \u003cflip-detection\u003e] [-a \u003cauto-rotation\u003e] \u003cinFile.pdf\u003e [outfile.pdf]\n       pdfScale.sh -p\n       pdfScale.sh -h\n       pdfScale.sh -V\n\nParameters:\n -v, --verbose\n             Verbose mode, prints extra information\n             Use twice for timestamp\n -h, --help\n             Print this help to screen and exits\n -V, --version\n             Prints version to screen and exits\n --install, --self-install [target-path]\n             Install itself to [target-path] or /usr/local/bin/pdfscale if not specified\n             Should contain the full path with the desired executable name\n --upgrade, --self-upgrade\n             Upgrades itself in-place (same path/name of the pdfScale.sh caller)\n             Downloads the master branch tarball and tries to self-upgrade\n --insecure, --no-check-certificate\n             Use curl/wget without SSL library support\n --yes, --assume-yes\n             Will answer yes to any prompt on install or upgrade, use with care\n -n, --no-overwrite\n             Aborts execution if the output PDF file already exists\n             By default, the output file will be overwritten\n             Does NOT work if using --explode\n -m, --mode \u003cmode\u003e\n             Paper size detection mode\n             Modes: a, adaptive  Default mode, tries all the methods below\n                    g, grep      Forces the use of Grep method\n                    m, mdls      Forces the use of MacOS Quartz mdls\n                    p, pdfinfo   Forces the use of PDFInfo\n                    i, identify  Forces the use of ImageMagick's Identify\n                    s, gs        Forces the use of Ghostscript (PS script)\n -i, --info \u003cfile\u003e\n             Prints \u003cfile\u003e Paper Size information to screen and exits\n -e, --explode\n             Explode (split) outuput PDF into many files (one per page)\n --range, --page-range \u003cpage-list\u003e\n             Defines the page range to be processed, using the -sPageList notation\n             Read below for more information on valid page ranges\n -s, --scale \u003cfactor\u003e\n             Changes the scaling factor or forces mixed mode\n             Defaults: 0.95 (scale mode) / Disabled (resize mode)\n             MUST be a number bigger than zero\n             Eg. -s 0.8 for 80% of the original size\n -r, --resize \u003cpaper\u003e\n             Triggers the Resize Paper Mode, disables auto-scaling of 0.95\n             Resize PDF and fit-to-page\n             \u003cpaper\u003e can be: source, custom or a valid std paper name, read below\n -c, --cropbox \u003cpaper\u003e\n             Resets Cropboxes on all pages to a specific paper size\n             Only applies to resize mode\n             \u003cpaper\u003e can be: full | fullsize - Uses the same size as the main paper/mediabox\n                             custom          - Define a custom cropbox size in inches, mm or points\n                             std paper name  - Uses a paper size name (eg. a4, letter, etc)\n -f, --flip-detect \u003cmode\u003e\n             Flip Detection Mode, defaults to 'auto'\n             Inverts Width \u003c-\u003e Height of a Resized PDF\n             Modes: a, auto     Keeps source orientation, default\n                    f, force    Forces flip W \u003c-\u003e H\n                    d, disable  Disables flipping\n -a, --auto-rotate \u003cmode\u003e\n             Setting for GS -dAutoRotatePages, defaults to 'PageByPage'\n             Uses text-orientation detection to set Portrait/Landscape\n             Modes: p, pagebypage  Auto-rotates pages individually\n                    n, none        Retains orientation of each page\n                    a, all         Rotates all pages (or none) depending\n                                   on a kind of \"majority decision\"\n --no-fit-to-page\n             Disables GS option dPDFFitPage (used when resizing)\n --hor-align, --horizontal-alignment \u003cleft|center|right\u003e\n             Where to translate the scaled page\n             Default: center\n             Options: left, right, center\n --vert-align, --vertical-alignment \u003ctop|center|bottom\u003e\n             Where to translate the scaled page\n             Default: center\n             Options: top, bottom, center\n --xoffset, --xtrans-offset \u003cFloatNumber\u003e\n             Add/Subtract from the X translation (move left-right)\n             Default: 0.0 (zero)\n             Options: Positive or negative floating point number\n --yoffset, --ytrans-offset \u003cFloatNumber\u003e\n             Add/Subtract from the Y translation (move top-bottom)\n             Default: 0.0 (zero)\n             Options: Positive or negative floating point number\n --pdf-settings \u003cgs-pdf-profile\u003e\n             Ghostscript PDF Profile to use in -dPDFSETTINGS\n             Default: printer\n             Options: screen, ebook, printer, prepress, default\n --print-mode \u003cmode\u003e\n             Setting for GS -dPrinted, loads options for screen or printer\n             Defaults to nothing, which uses the print profile for files\n             The screen profile preserves URLs, but loses print annotations\n             Modes: s, screen   Use screen options \u003e '-dPrinted=false'\n                    p, printer  Use print options  \u003e '-dPrinted'\n --image-downsample \u003cgs-downsample-method\u003e\n             Ghostscript Image Downsample Method\n             Default: bicubic\n             Options: subsample, average, bicubic\n --image-resolution \u003cdpi\u003e\n             Resolution in DPI of color and grayscale images in output\n             Default: 300\n --background-gray \u003cpercentage\u003e\n             Creates a background with a gray color setting on PDF scaling\n             Percentage is a floating point percentage number between 0(black) and 1(white)\n --background-cmyk \u003c\"C M Y K\"\u003e\n             Creates a background with a CMYK color setting on PDF scaling\n             Must be quoted into a single parameter as in \"0.2 0.2 0.2 0.2\"\n             Each color parameter is a floating point percentage number (between 0 and 1)\n --background-rgb \u003c\"R G B\"\u003e\n             Creates a background with a RGB color setting on PDF scaling\n             Must be quoted into a single parameter as in \"100 100 200\"\n             RGB numbers are integers between 0 and 255 (255 122 50)\n --newpdf    Uses the -dNEWPDF flag in the GS Call (deprecated in new versions of GS)\n --dry-run, --simulate\n             Just simulate execution. Will not run ghostscript\n --print-gs-call, --gs-call\n             Print GS call to stdout. Will print at the very end between markers\n -p, --print-papers\n             Prints Standard Paper info tables to screen and exits\n\nScaling Mode:\n - The default mode of operation is scaling mode with fixed paper\n   size and scaling pre-set to 0.95\n - By not using the resize mode you are using scaling mode\n - Flip-Detection and Auto-Rotation are disabled in Scaling mode,\n   you can use '-r source -s \u003cscale\u003e' to override.\n - Ghostscript placement is from bottom-left position. This means that\n   a bottom-left placement has ZERO for both X and Y translations.\n\nResize Paper Mode:\n - Disables the default scaling factor! (0.95)\n - Changes the PDF Paper Size in points. Will fit-to-page\n\nMixed Mode:\n - In mixed mode both the -s option and -r option must be specified\n - The PDF will be first resized then scaled\n\nPage Ranges:\n - Please refer to the Ghostscript manual on '-sPageList' for more info and examples.\n - May cause execution warnings from Ghostscript if the PDF refences pages that were\n   removed. The output file should still be created, but with broken internal links.\n - Using a range with an inexistant page will raise a warning from Ghostscript and\n   may also generate blank pages.\n - Single page number | ex: --range 2\n - Interval           | ex: --range 2-4\n - List of pages      | ex: --range 1,3,6\n - From page to end   | ex: --range 3-\n - odd/even specifier | ex: --range odd\n - odd/even range     | ex: --range even:1-4\n - mixed entries      | ex: --range 1,3-5,8-\n\nOutput filename:\n - Having the extension .pdf on the output file name is optional,\n   it will be added if not present.\n - The output filename is optional. If no file name is passed\n   the output file will have the same name/destination of the\n   input file with added suffixes:\n   .SCALED.pdf             is added to scaled files\n   .\u003cPAPERSIZE\u003e.pdf        is added to resized files\n   .\u003cPAPERSIZE\u003e.SCALED.pdf is added in mixed mode\n\nStandard Paper Names: (case-insensitive)\n A0            A1            A2            A3            A4\n A4SMALL       A5            A6            A7            A8\n A9            A10           ISOB0         ISOB1         ISOB2\n ISOB3         ISOB4         ISOB5         ISOB6         C0\n C1            C2            C3            C4            C5\n C6            11X17         LEDGER        LEGAL         LETTER\n LETTERSMALL   ARCHE         ARCHD         ARCHC         ARCHB\n ARCHA         JISB0         JISB1         JISB2         JISB3\n JISB4         JISB5         JISB6         FLSA          FLSE\n HALFLETTER    HAGAKI\n\nCustom Paper Size:\n - Paper size can be set manually in Millimeters, Inches or Points\n - Custom paper definition MUST be quoted into a single parameter\n - Actual size is applied in points (mms and inches are transformed)\n - Measurements: mm, mms,  millimeters\n                 pt, pts,  points\n                 in, inch, inches\n Use: pdfScale.sh -r 'custom \u003cmeasurement\u003e \u003cwidth\u003e \u003cheight\u003e'\n Ex:  pdfScale.sh -r 'custom mm 300 300'\n\nUsing Source Paper Size: (no-resizing)\n - Wildcard 'source' is used to keep paper size the same as the input\n - Useful to run Auto-Rotation without resizing\n - Eg. pdfScale.sh -r source ./input.pdf\n\nBackgrounding: (paint a background)\n - Backgrounding only happens when scaling\n - Use a scale of 1.0 to force mixed mode and add background while resizing\n\nOptions and Parameters Parsing:\n - From v2.1.0 (long-opts) there is no need to pass file names at the end\n - Anything that is not a short-option is case-insensitive\n - Short-options: case-sensitive   Eg. -v for Verbose, -V for Version\n - Long-options:  case-insensitive Eg. --SCALE and --scale are the same\n - Subparameters: case-insensitive Eg. -m PdFinFo is valid\n - Grouping short-options is not supported Eg. -vv, or -vs 0.9\n\nAdditional Notes:\n - File and folder names with spaces should be quoted or escaped\n - Using a scale bigger than 1.0 may result on cropping parts of the PDF\n - For detailed paper types information, use: pdfScale.sh -p\n\nExamples:\n pdfScale.sh myPdfFile.pdf\n pdfScale.sh -i '/home/My Folder/My PDF File.pdf'\n pdfScale.sh myPdfFile.pdf \"My Scaled Pdf\"\n pdfScale.sh -v -v myPdfFile.pdf\n pdfScale.sh -s 0.85 myPdfFile.pdf My\\ Scaled\\ Pdf.pdf\n pdfScale.sh -m pdfinfo -s 0.80 -v myPdfFile.pdf\n pdfScale.sh -v -v -m i -s 0.7 myPdfFile.pdf\n pdfScale.sh -r A4 myPdfFile.pdf\n pdfScale.sh -v -v -r \"custom mm 252 356\" -s 0.9 -f \"../input file.pdf\" \"../my new pdf\"\n```  \n  \n## Standard Paper Tables\nThe `-p` parameter prints detailed paper types information\n```\n$ pdfscale -p\npdfscale v2.3.7\n\nPaper Sizes Information\n\n+-----------------------------------------------------------------+\n| ISO STANDARD                                                    |\n+-----------------------------------------------------------------+\n| Name            | inchW | inchH |  mm W |  mm H | pts W | pts H |\n+-----------------+-------+-------+-------+-------+-------+-------+\n| a0              |  33.1 |  46.8 |   841 |  1189 |  2384 |  3370 |\n| a1              |  23.4 |  33.1 |   594 |   841 |  1684 |  2384 |\n| a2              |  16.5 |  23.4 |   420 |   594 |  1191 |  1684 |\n| a3              |  11.7 |  16.5 |   297 |   420 |   842 |  1191 |\n| a4              |   8.3 |  11.7 |   210 |   297 |   595 |   842 |\n| a4small         |   8.3 |  11.7 |   210 |   297 |   595 |   842 |\n| a5              |   5.8 |   8.3 |   148 |   210 |   420 |   595 |\n| a6              |   4.1 |   5.8 |   105 |   148 |   297 |   420 |\n| a7              |   2.9 |   4.1 |    74 |   105 |   210 |   297 |\n| a8              |   2.1 |   2.9 |    52 |    74 |   148 |   210 |\n| a9              |   1.5 |   2.1 |    37 |    52 |   105 |   148 |\n| a10             |   1.0 |   1.5 |    26 |    37 |    73 |   105 |\n| isob0           |  39.4 |  55.7 |  1000 |  1414 |  2835 |  4008 |\n| isob1           |  27.8 |  39.4 |   707 |  1000 |  2004 |  2835 |\n| isob2           |  19.7 |  27.8 |   500 |   707 |  1417 |  2004 |\n| isob3           |  13.9 |  19.7 |   353 |   500 |  1001 |  1417 |\n| isob4           |   9.8 |  13.9 |   250 |   353 |   709 |  1001 |\n| isob5           |   6.9 |   9.8 |   176 |   250 |   499 |   709 |\n| isob6           |   4.9 |   6.9 |   125 |   176 |   354 |   499 |\n| c0              |  36.1 |  51.1 |   917 |  1297 |  2599 |  3677 |\n| c1              |  25.5 |  36.1 |   648 |   917 |  1837 |  2599 |\n| c2              |  18.0 |  25.5 |   458 |   648 |  1298 |  1837 |\n| c3              |  12.8 |  18.0 |   324 |   458 |   918 |  1298 |\n| c4              |   9.0 |  12.8 |   229 |   324 |   649 |   918 |\n| c5              |   6.4 |   9.0 |   162 |   229 |   459 |   649 |\n| c6              |   4.5 |   6.4 |   114 |   162 |   323 |   459 |\n+-----------------+-------+-------+-------+-------+-------+-------+\n\n+-----------------------------------------------------------------+\n| US STANDARD                                                     |\n+-----------------------------------------------------------------+\n| Name            | inchW | inchH |  mm W |  mm H | pts W | pts H |\n+-----------------+-------+-------+-------+-------+-------+-------+\n| 11x17           |  11.0 |  17.0 |   279 |   432 |   792 |  1224 |\n| ledger          |  17.0 |  11.0 |   432 |   279 |  1224 |   792 |\n| legal           |   8.5 |  14.0 |   216 |   356 |   612 |  1008 |\n| letter          |   8.5 |  11.0 |   216 |   279 |   612 |   792 |\n| lettersmall     |   8.5 |  11.0 |   216 |   279 |   612 |   792 |\n| archE           |  36.0 |  48.0 |   914 |  1219 |  2592 |  3456 |\n| archD           |  24.0 |  36.0 |   610 |   914 |  1728 |  2592 |\n| archC           |  18.0 |  24.0 |   457 |   610 |  1296 |  1728 |\n| archB           |  12.0 |  18.0 |   305 |   457 |   864 |  1296 |\n| archA           |   9.0 |  12.0 |   229 |   305 |   648 |   864 |\n+-----------------+-------+-------+-------+-------+-------+-------+\n\n+-----------------------------------------------------------------+\n| JIS STANDARD *Aproximated Points                                |\n+-----------------------------------------------------------------+\n| Name            | inchW | inchH |  mm W |  mm H | pts W | pts H |\n+-----------------+-------+-------+-------+-------+-------+-------+\n| jisb0           |    NA |    NA |  1030 |  1456 |  2920 |  4127 |\n| jisb1           |    NA |    NA |   728 |  1030 |  2064 |  2920 |\n| jisb2           |    NA |    NA |   515 |   728 |  1460 |  2064 |\n| jisb3           |    NA |    NA |   364 |   515 |  1032 |  1460 |\n| jisb4           |    NA |    NA |   257 |   364 |   729 |  1032 |\n| jisb5           |    NA |    NA |   182 |   257 |   516 |   729 |\n| jisb6           |    NA |    NA |   128 |   182 |   363 |   516 |\n+-----------------+-------+-------+-------+-------+-------+-------+\n\n+-----------------------------------------------------------------+\n| OTHERS                                                          |\n+-----------------------------------------------------------------+\n| Name            | inchW | inchH |  mm W |  mm H | pts W | pts H |\n+-----------------+-------+-------+-------+-------+-------+-------+\n| flsa            |   8.5 |  13.0 |   216 |   330 |   612 |   936 |\n| flse            |   8.5 |  13.0 |   216 |   330 |   612 |   936 |\n| halfletter      |   5.5 |   8.5 |   140 |   216 |   396 |   612 |\n| hagaki          |   3.9 |   5.8 |   100 |   148 |   283 |   420 |\n+-----------------+-------+-------+-------+-------+-------+-------+\n```\n\n## Dependencies  \nThe script uses `basename`, `grep`, `bc` and `gs` (ghostscript).   \nYou probably have everything installed already, except for ghostscript.   \nOptional dependencies are `imagemagick`, `pdfinfo` and `mdls` (Mac).  \nThis app is focused in `Bash`, so it will probably not run in other shells.  \nThe script will need to see the dependencies on your `$PATH` variable.\n\n##### apt-get\n```\nsudo apt-get install ghostscript bc\n```\n##### yum\n```\nsudo yum install ghostscript bc\n```\n##### homebrew MacOS\n```\nbrew install ghostscript\n```\n##### Optionals\nPage Size detection is by default in Adaptive Mode.  \nIt will try the following methods in sequence:   \n 1. Try to get `/MediaBox` with `grep` (fastest)\n 2. Failed AND MacOS ? Try `mdls`\n 3. Failed ? Try `pdfinfo`\n 4. Failed ? Try ImageMagick's `identify`\n 5. Failed ? Try Ghostscript with a PS script\n 6. Failed ? `Exit` with error message\n\nThe `grep` method will fail on PDFs without a `/MediaBox`.   \nYou may install any of the optionals to be used in that case.  \n\nMacOS is fine using `mdls` if the metadata of the file is accurate.  \nThe metadata is generated automatically by the OS (Spotlight)\n\n##### apt-get\n```\nsudo apt-get install imagemagick pdfinfo\n```\n##### yum\n```\nsudo yum install imagemagick pdfinfo\n```\n##### homebrew MacOS\n```\nbrew install imagemagick xpdf\n```\n  \n## Windows\n- The script should work fine in cygwin.\n- If you are using msys/git for windows, and the script exits with a 'file not found' error,\n- try running `export MSYS_NO_PATHCONV=1`\n- and `export MSYS2_ARG_CONV_EXCL=\"*\"`\n- and then running again.\n\n## Clone using git\n```\ngit clone https://github.com/tavinus/pdfScale.git\ncd ./pdfScale\n./pdfScale.sh --version\n```\n  \n## Self-Install\nSince `v2.3.0` *pdfScale* can install itself using the parameter `--install`.  \n  \nBy default it will install to `/usr/local/bin/pdfscale`  \n```\n./pdfScale.sh --install\n```\nA custom location can be specified as a parameter.  \nShould contain full path to executable file.  \n```\n./pdfScale.sh --install /opt/pdfscale/pdfscale\n```\n  \n## Run installer using `curl` or `wget`\n#### wget oneliners\n```bash\n# Normal install with prompts\nwget -q -O /tmp/pdfScale.sh 'https://raw.githubusercontent.com/tavinus/pdfScale/master/pdfScale.sh' \u0026\u0026 bash /tmp/pdfScale.sh --install\n\n# Automated install with --assume-yes\nwget -q -O /tmp/pdfScale.sh 'https://raw.githubusercontent.com/tavinus/pdfScale/master/pdfScale.sh' \u0026\u0026 bash /tmp/pdfScale.sh --install --assume-yes\n\n# To ignore SSL, use --no-check-certificate\nwget --no-check-certificate -q -O /tmp/pdfScale.sh 'https://raw.githubusercontent.com/tavinus/pdfScale/master/pdfScale.sh' \u0026\u0026 bash /tmp/pdfScale.sh --install\n```\n#### curl oneliners\n```bash\n# Normal install with prompts\ncurl -s -o /tmp/pdfScale.sh 'https://raw.githubusercontent.com/tavinus/pdfScale/master/pdfScale.sh' \u0026\u0026 bash /tmp/pdfScale.sh --install\n\n# Automated install with --assume-yes\ncurl -s -o /tmp/pdfScale.sh 'https://raw.githubusercontent.com/tavinus/pdfScale/master/pdfScale.sh' \u0026\u0026 bash /tmp/pdfScale.sh --install --assume-yes\n\n# To ignore SSL, use --insecure\ncurl --insecure -s -o /tmp/pdfScale.sh 'https://raw.githubusercontent.com/tavinus/pdfScale/master/pdfScale.sh' \u0026\u0026 bash /tmp/pdfScale.sh --install\n```\n#### Remove /tmp/pdfScale.sh after done\n```bash\nrm /tmp/pdfScale.sh\n```\n  \n## Install with `make`\nThe `make` installer will name the executable as `pdfscale` with no uppercase chars and without the `.sh` extension.  \n\nIf you have `make` installed you can use it to install to `/usr/local/bin/pdfscale` with:  \n```\nsudo make install\n```\nTo remove the installation use:  \n```\nsudo make uninstall\n```   \n  \n## Self-Upgrade\nSince `v2.3.0` *pdfScale* can upgrade itself using the parameter `--upgrade`.  \n  \nIt will try to get the master branch and update itself in-place.    \n```\npdfscale --upgrade\n```\nMore info on the [Self-Upgrade Wiki](https://github.com/tavinus/pdfScale/wiki/Self-Upgrade)  \n  \n---\n  \n# Links\n#### [ma.juii.net - The History](https://ma.juii.net/blog/scale-page-content-of-pdf-files)\n#### [SO - Scale pdf to add border for printing full size pages](https://stackoverflow.com/questions/18343813/scale-pdf-to-add-border-for-printing-full-size-pages/)\n#### [MichaelJCole original gist - pdfScale.sh](https://gist.github.com/MichaelJCole/86e4968dbfc13256228a)\n","funding_links":["https://github.com/sponsors/tavinus","https://ko-fi.com/tavinus","https://bit.ly/paypaltavinus","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=HP344TKTWXFXE\u0026source=url"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftavinus%2Fpdfscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftavinus%2Fpdfscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftavinus%2Fpdfscale/lists"}