{"id":16065083,"url":"https://github.com/jtbandes/pdfsnip","last_synced_at":"2025-03-18T05:30:53.357Z","repository":{"id":137514557,"uuid":"334538877","full_name":"jtbandes/pdfsnip","owner":"jtbandes","description":"CLI tool to extract images from PDFs, and Swift library with other CGPDF* API wrappers.","archived":false,"fork":false,"pushed_at":"2021-09-10T18:26:35.000Z","size":15,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T07:14:53.140Z","etag":null,"topics":["coregraphics","pdf","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jtbandes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2021-01-31T00:10:19.000Z","updated_at":"2024-04-27T14:53:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"b69224af-b104-4ed0-bbaf-ae6d53c4038b","html_url":"https://github.com/jtbandes/pdfsnip","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"cbb8905e95276a77414227ef52e67aba90da2b1c"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtbandes%2Fpdfsnip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtbandes%2Fpdfsnip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtbandes%2Fpdfsnip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtbandes%2Fpdfsnip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtbandes","download_url":"https://codeload.github.com/jtbandes/pdfsnip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902940,"owners_count":20366381,"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":["coregraphics","pdf","swift"],"created_at":"2024-10-09T05:10:59.701Z","updated_at":"2025-03-18T05:30:53.349Z","avatar_url":"https://github.com/jtbandes.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pdfsnip\n\nThis Swift package provides two targets:\n\n- `pdfsnip`, a command-line utility to extract images from PDF files.\n- `PDFWrappers`, a Swift library wrapping raw pointer-based types from CoreGraphics with a nicer API.\n\n## Usage\n\n### Extract images from a PDF\n\n```sh\n$ cd pdfsnip   # directory containing the pdfsnip package and this readme :)\n$ swift run pdfsnip [file.pdf] [outdir]\n```\n\nExtracts images from the given PDF file and saves them to the output directory.\n\n### Using `PDFWrappers` to traverse PDF data\n\nIn your Package.swift, add this package to your package's dependencies, and its `PDFWrappers` product to your target's dependencies. Example:\n```swift\nlet package = Package(\n  ...\n  dependencies: [\n    .package(url: \"https://github.com/jtbandes/pdfsnip.git\", from: \"0.0.1\")\n  ],\n  targets: [\n    .target(\n      ...\n      dependencies: [\n        .product(name: \"PDFWrappers\", package: \"pdfsnip\"),\n      ]),\n  ]\n)\n```\n\nNow you can use `PDFDictionary` and other wrapper types to access PDF data more safely and conveniently:\n```swift\nlet doc: CGPDFDocument = ...\nif let rawPageDict = doc.page(at: 1)?.dictionary {\n  let pageDict = PDFDictionary(dictionary: rawPageDict)\n\n  // Instead of:\n  var str: CGPDFStringRef?\n  if CGPDFDictionaryGetString(rawPageDict, \"Key\", \u0026str) { ... }\n\n  // Use:\n  if let str = pageDict[string: \"Key\"] { ... }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtbandes%2Fpdfsnip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtbandes%2Fpdfsnip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtbandes%2Fpdfsnip/lists"}