### Install pdfcrowd from GitHub with pip install Source: https://pdfcrowd.com/api/client-library/command-line Clones the GitHub repository and installs the tools from the cloned directory. ```bash git clone https://github.com/pdfcrowd/pdfcrowd-python cd pdfcrowd-python pip install . ``` -------------------------------- ### Install pdfcrowd by extracting archive and running pip install Source: https://pdfcrowd.com/api/client-library/command-line Downloads the archive, extracts it, and installs the package from the extracted directory. ```bash cd pdfcrowd-6.7.0 pip install . ``` -------------------------------- ### Install pdfcrowd from PyPI using pip Source: https://pdfcrowd.com/api/client-library/command-line Installs the PDFCrowd command-line tools from PyPI. ```bash pip install pdfcrowd ``` -------------------------------- ### Convert HTML or URL to PNG with .NET SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the .NET SDK to convert an HTML file and a URL to PNG images. The example uses the demo credentials and the HtmlToImageClient class. ```csharp pdfcrowd.HtmlToImageClient api = new pdfcrowd.HtmlToImageClient("demo", "demo"); api.convertFileToFile("document.html", "html.png"); api.convertUrlToFile("https://example.com", "url.png"); ``` -------------------------------- ### Convert HTML or URL to PNG with Go SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the Go SDK to convert an HTML file and a URL to PNG images. Requires the pdfcrowd-go package. The example uses the demo credentials and the HtmlToImageClient type. ```go // install: "go get github.com/pdfcrowd/pdfcrowd-go" import ("github.com/pdfcrowd/pdfcrowd-go") api := pdfcrowd.NewHtmlToImageClient("demo", "demo") api.ConvertFileToFile("document.html", "html.png") api.ConvertUrlToFile("https://example.com", "url.png") ``` -------------------------------- ### libPdfcrowd.highlightHtmlElements() example Source: https://pdfcrowd.com/api/libpdfcrowd Example that highlights elements and adds spacing around them to visualize the element hierarchy. ```javascript libPdfcrowd.highlightHtmlElements({backgroundColor: null, padding: '4px', margin: '4px'}); ``` -------------------------------- ### Convert HTML file or URL to PDF with Go SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the pdfcrowd-go client to convert an HTML file and a URL to PDF. Requires installing the github.com/pdfcrowd/pdfcrowd-go package. ```go // install: "go get github.com/pdfcrowd/pdfcrowd-go" import ("github.com/pdfcrowd/pdfcrowd-go") api := pdfcrowd.NewHtmlToPdfClient("demo", "demo") api.ConvertFileToFile("document.html", "html.pdf") api.ConvertUrlToFile("https://example.com", "url.pdf") ``` -------------------------------- ### Convert HTML or URL to PNG with Ruby SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the Ruby SDK to convert an HTML file and a URL to PNG images. Requires the pdfcrowd gem. The example uses the demo credentials and the HtmlToImageClient class. ```ruby # install: "gem install pdfcrowd" require "pdfcrowd" api = Pdfcrowd::HtmlToImageClient.new("demo", "demo") api.convertFileToFile("document.html", "html.png") api.convertUrlToFile("https://example.com", "url.png") ``` -------------------------------- ### Convert HTML or URL to PNG with Java SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the Java SDK to convert an HTML file and a URL to PNG images. The example uses the demo credentials and the HtmlToImageClient class. ```java import com.pdfcrowd.*; Pdfcrowd.HtmlToImageClient api = new Pdfcrowd.HtmlToImageClient("demo", "demo"); api.convertFileToFile("document.html", "html.png"); api.convertUrlToFile("https://example.com", "url.png"); ``` -------------------------------- ### Convert HTML or URL to PNG with Python SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the Python SDK to convert an HTML file and a URL to PNG images. Requires the pdfcrowd package. The example uses the demo credentials and the HtmlToImageClient class. ```python # install: "pip install pdfcrowd" import pdfcrowd api = pdfcrowd.HtmlToImageClient("demo", "demo") api.convertFileToFile("document.html", "html.png") api.convertUrlToFile("https://example.com", "url.png") ``` -------------------------------- ### Convert URL to PDF and PNG with cURL Source: https://pdfcrowd.com/api/coding-agent-guide Minimal HTTP conversion examples for PDF and PNG output from a URL. Both use the same API endpoint and demo credentials; the PNG variant adds output_format and screenshot_width parameters. ```bash curl -f -u "demo:demo" \ -F "url=https://example.com" \ -o "output.pdf" \ https://api.pdfcrowd.com/convert/24.04/ ``` ```bash curl -f -u "demo:demo" \ -F "url=https://example.com" \ -F "output_format=png" \ -F "screenshot_width=1280" \ -o "output.png" \ https://api.pdfcrowd.com/convert/24.04/ ``` -------------------------------- ### Convert HTML file or URL to PDF with Ruby SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the Pdfcrowd Ruby client to convert an HTML file and a URL to PDF. Requires installing the pdfcrowd gem. ```ruby # install: "gem install pdfcrowd" require "pdfcrowd" api = Pdfcrowd::HtmlToPdfClient.new("demo", "demo") api.convertFileToFile("document.html", "html.pdf") api.convertUrlToFile("https://example.com", "url.pdf") ``` -------------------------------- ### Convert PNG to JPG with Image to Image API (cURL, Python, PHP, Node.js, Java, .NET, Ruby, Go) Source: https://pdfcrowd.com/api/image-to-image-api Convert a local PNG image to JPG using the Image to Image API. The cURL example uses the HTTP endpoint with form parameters; the SDK examples use the ImageToImageClient with setOutputFormat and convertFileToFile. All use the demo credentials and save the result as image.jpg. ```bash curl --fail --user "demo:demo" \ --form "input_format=image" \ --form "output_format=jpg" \ --form "file=@image.png" \ --output "image.jpg" \ https://api.pdfcrowd.com/convert/24.04/ ``` ```python import pdfcrowd api = pdfcrowd.ImageToImageClient("demo", "demo") api.setOutputFormat("jpg") api.convertFileToFile("image.png", "image.jpg") ``` ```php setOutputFormat("jpg"); $api->convertFileToFile("image.png", "image.jpg"); ``` ```javascript var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.ImageToImageClient("demo", "demo"); api.setOutputFormat("jpg"); api.convertFileToFile("image.png", "image.jpg", function(error, fileName) { if (error) return console.error(error); console.log("Created " + fileName); }); ``` ```java import com.pdfcrowd.*; Pdfcrowd.ImageToImageClient api = new Pdfcrowd.ImageToImageClient("demo", "demo"); api.setOutputFormat("jpg"); api.convertFileToFile("image.png", "image.jpg"); ``` ```csharp pdfcrowd.ImageToImageClient api = new pdfcrowd.ImageToImageClient("demo", "demo"); api.setOutputFormat("jpg"); api.convertFileToFile("image.png", "image.jpg"); ``` ```ruby require "pdfcrowd" api = Pdfcrowd::ImageToImageClient.new("demo", "demo") api.setOutputFormat("jpg") api.convertFileToFile("image.png", "image.jpg") ``` ```go package main import "github.com/pdfcrowd/pdfcrowd-go" func main() { api := pdfcrowd.NewImageToImageClient("demo", "demo") api.SetOutputFormat("jpg") err := api.ConvertFileToFile("image.png", "image.jpg") if err != nil { panic(err) } } ``` -------------------------------- ### libPdfcrowd.insertStyle() example Source: https://pdfcrowd.com/api/libpdfcrowd Example that sets the body text color to red using the insertStyle function. ```javascript libPdfcrowd.insertStyle({style: 'body { color: red; }'}); ``` -------------------------------- ### Convert HTML or URL to PNG with PHP SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the PHP SDK to convert an HTML file and a URL to PNG images. Requires the pdfcrowd package via Composer. The example uses the demo credentials and the HtmlToImageClient class. ```php // install: "composer require pdfcrowd/pdfcrowd" require "pdfcrowd.php"; $api = new \Pdfcrowd\HtmlToImageClient("demo", "demo"); $api->convertFileToFile("document.html", "html.png"); $api->convertUrlToFile("https://example.com", "url.png"); ``` -------------------------------- ### Convert HTML or URL to PNG with Node.js SDK Source: https://pdfcrowd.com/api/html-to-image-api Use the Node.js SDK to convert an HTML file and a URL to PNG images. Requires the pdfcrowd package via npm. The example uses the demo credentials and the HtmlToImageClient class with a callback. ```javascript // install: "npm install pdfcrowd" var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.HtmlToImageClient("demo", "demo"); function done(err, fileName) { /* handle the result */ } api.convertFileToFile("document.html", "html.png", done); api.convertUrlToFile("https://example.com", "url.png", done); ``` -------------------------------- ### Convert HTML file or URL to PDF with Python SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the pdfcrowd Python client to convert an HTML file and a URL to PDF. Requires installing the pdfcrowd package with pip. ```python # install: "pip install pdfcrowd" import pdfcrowd api = pdfcrowd.HtmlToPdfClient("demo", "demo") api.convertFileToFile("document.html", "html.pdf") api.convertUrlToFile("https://example.com", "url.pdf") ``` -------------------------------- ### Convert HTML file or URL to PDF with PHP SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the Pdfcrowd PHP client to convert an HTML file and a URL to PDF. Requires installing the pdfcrowd/pdfcrowd package via Composer. ```php // install: "composer require pdfcrowd/pdfcrowd" require "pdfcrowd.php"; $api = new \Pdfcrowd\HtmlToPdfClient("demo", "demo"); $api->convertFileToFile("document.html", "html.pdf"); $api->convertUrlToFile("https://example.com", "url.pdf"); ``` -------------------------------- ### Convert HTML file or URL to PDF with Node.js SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the pdfcrowd Node.js client to convert an HTML file and a URL to PDF. Requires installing the pdfcrowd package via npm. ```javascript // install: "npm install pdfcrowd" var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.HtmlToPdfClient("demo", "demo"); function done(err, fileName) { /* handle the result */ } api.convertFileToFile("document.html", "html.pdf", done); api.convertUrlToFile("https://example.com", "url.pdf", done); ``` -------------------------------- ### Convert HTML or URL to PNG with cURL Source: https://pdfcrowd.com/api/html-to-image-api Use cURL to send an HTML file or a URL to the HTML to Image API and save the result as a PNG. The example uses the demo credentials and the 24.04 API version. Two commands are shown: one for a local HTML file and one for a URL screenshot. ```bash # HTML file to image curl --user "demo:demo" \ --form "output_format=png" \ --form "file=@document.html" \ --output "from-file.png" \ https://api.pdfcrowd.com/convert/24.04/ # URL screenshot curl --user "demo:demo" \ --form "output_format=png" \ --form "url=https://example.com" \ --output "from-url.png" \ https://api.pdfcrowd.com/convert/24.04/ ``` -------------------------------- ### Go: Convert PDF to text with pdfcrowd-go Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the github.com/pdfcrowd/pdfcrowd-go package. Creates a PdfToTextClient with demo credentials and converts input.pdf to document.txt, panicking on error. ```go package main import "github.com/pdfcrowd/pdfcrowd-go" func main() { api := pdfcrowd.NewPdfToTextClient("demo", "demo") err := api.ConvertFileToFile("input.pdf", "document.txt") if err != nil { panic(err) } } ``` -------------------------------- ### libPdfcrowd.disableHyperlinks() example Source: https://pdfcrowd.com/api/libpdfcrowd Example that disables all hyperlinks in the document body. ```javascript libPdfcrowd.disableHyperlinks({element: document.body}); ``` -------------------------------- ### Render PDF page to PNG with Go SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the Go pdfcrowd client. Import the pdfcrowd-go package, create a PdfToImageClient, set output format and page range, and convert the file. Panic on error. ```go package main import "github.com/pdfcrowd/pdfcrowd-go" func main() { api := pdfcrowd.NewPdfToImageClient("demo", "demo") api.SetOutputFormat("png") api.SetPrintPageRange("1") err := api.ConvertFileToFile("input.pdf", "page.png") if err != nil { panic(err) } } ``` -------------------------------- ### libPdfcrowd.removeZIndexHigherThan() example Source: https://pdfcrowd.com/api/libpdfcrowd Example that removes all elements with z-index greater than 1000. ```javascript libPdfcrowd.removeZIndexHigherThan({zlimit: 1000}); ``` -------------------------------- ### libPdfcrowd.removeBySelector() example Source: https://pdfcrowd.com/api/libpdfcrowd Example that removes all images from the document, including those inside iframes. ```javascript libPdfcrowd.removeBySelector({selector: 'img', recursive: true}); ``` -------------------------------- ### Convert image to PDF with Go Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd-go library to convert a local JPG image to a PDF. Panics on error. ```go package main import "github.com/pdfcrowd/pdfcrowd-go" func main() { api := pdfcrowd.NewImageToPdfClient("demo", "demo") err := api.ConvertFileToFile("image.jpg", "document.pdf") if err != nil { panic(err) } } ``` -------------------------------- ### Convert image to PDF with .NET Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd .NET client to convert a local JPG image to a PDF. Requires the pdfcrowd library and demo credentials. ```csharp pdfcrowd.ImageToPdfClient api = new pdfcrowd.ImageToPdfClient("demo", "demo"); api.convertFileToFile("image.jpg", "document.pdf"); ``` -------------------------------- ### Convert PDF to HTML with Go Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd-go library to convert a local PDF to HTML. Requires the pdfcrowd-go package and demo credentials. Panics on error. ```go package main import "github.com/pdfcrowd/pdfcrowd-go" func main() { api := pdfcrowd.NewPdfToHtmlClient("demo", "demo") err := api.ConvertFileToFile("input.pdf", "document.html") if err != nil { panic(err) } } ``` -------------------------------- ### Convert image to PDF with Java Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd Java client to convert a local JPG image to a PDF. Requires the pdfcrowd library and demo credentials. ```java import com.pdfcrowd.*; Pdfcrowd.ImageToPdfClient api = new Pdfcrowd.ImageToPdfClient("demo", "demo"); api.convertFileToFile("image.jpg", "document.pdf"); ``` -------------------------------- ### Convert image to PDF with Python Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd Python client to convert a local JPG image to a PDF. Requires the pdfcrowd library and demo credentials. ```python import pdfcrowd api = pdfcrowd.ImageToPdfClient("demo", "demo") api.convertFileToFile("image.jpg", "document.pdf") ``` -------------------------------- ### Convert image to PDF with Ruby Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd Ruby client to convert a local JPG image to a PDF. Requires the pdfcrowd gem and demo credentials. ```ruby require "pdfcrowd" api = Pdfcrowd::ImageToPdfClient.new("demo", "demo") api.convertFileToFile("image.jpg", "document.pdf") ``` -------------------------------- ### Convert image to PDF with PHP Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd PHP client to convert a local JPG image to a PDF. Requires the pdfcrowd.php file and demo credentials. ```php convertFileToFile("image.jpg", "document.pdf"); ``` -------------------------------- ### .NET: Convert PDF to text with Pdfcrowd client Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the pdfcrowd .NET library. Creates a PdfToTextClient with demo credentials and converts input.pdf to document.txt. ```csharp pdfcrowd.PdfToTextClient api = new pdfcrowd.PdfToTextClient("demo", "demo"); api.convertFileToFile("input.pdf", "document.txt"); ``` -------------------------------- ### Render PDF page to PNG with .NET SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the .NET pdfcrowd client. Create a PdfToImageClient, set output format, page range, and convert the file. ```csharp pdfcrowd.PdfToImageClient api = new pdfcrowd.PdfToImageClient("demo", "demo"); api.setOutputFormat("png"); api.setPrintPageRange("1"); api.convertFileToFile("input.pdf", "page.png"); ``` -------------------------------- ### Render PDF page to PNG with Java SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the Java pdfcrowd client. Import the com.pdfcrowd package, set credentials, output format, and page range, then convert the file. ```java import com.pdfcrowd.*; Pdfcrowd.PdfToImageClient api = new Pdfcrowd.PdfToImageClient("demo", "demo"); api.setOutputFormat("png"); api.setPrintPageRange("1"); api.convertFileToFile("input.pdf", "page.png"); ``` -------------------------------- ### Convert PDF to HTML with .NET Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd .NET client to convert a local PDF to HTML. Requires the pdfcrowd library and demo credentials. ```csharp pdfcrowd.PdfToHtmlClient api = new pdfcrowd.PdfToHtmlClient("demo", "demo"); api.convertFileToFile("input.pdf", "document.html"); ``` -------------------------------- ### Python: Convert PDF to text with pdfcrowd client Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the pdfcrowd Python library. Creates a PdfToTextClient with demo credentials and converts input.pdf to document.txt. ```python import pdfcrowd api = pdfcrowd.PdfToTextClient("demo", "demo") api.convertFileToFile("input.pdf", "document.txt") ``` -------------------------------- ### Render PDF page to PNG with Python SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the Python pdfcrowd client. Initialize with demo credentials, set output format to PNG and page range to the first page, then convert the input PDF file to an output image file. ```python import pdfcrowd api = pdfcrowd.PdfToImageClient("demo", "demo") api.setOutputFormat("png") api.setPrintPageRange("1") api.convertFileToFile("input.pdf", "page.png") ``` -------------------------------- ### Java: Convert PDF to text with Pdfcrowd client Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the com.pdfcrowd Java library. Creates a PdfToTextClient with demo credentials and converts input.pdf to document.txt. ```java import com.pdfcrowd.*; Pdfcrowd.PdfToTextClient api = new Pdfcrowd.PdfToTextClient("demo", "demo"); api.convertFileToFile("input.pdf", "document.txt"); ``` -------------------------------- ### Render PDF page to PNG with Ruby SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the Ruby pdfcrowd client. Require the gem, create a PdfToImageClient, set output format and page range, and convert the file. ```ruby require "pdfcrowd" api = Pdfcrowd::PdfToImageClient.new("demo", "demo") api.setOutputFormat("png") api.setPrintPageRange("1") api.convertFileToFile("input.pdf", "page.png") ``` -------------------------------- ### Ruby: Convert PDF to text with Pdfcrowd client Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the pdfcrowd Ruby library. Creates a PdfToTextClient with demo credentials and converts input.pdf to document.txt. ```ruby require "pdfcrowd" api = Pdfcrowd::PdfToTextClient.new("demo", "demo") api.convertFileToFile("input.pdf", "document.txt") ``` -------------------------------- ### Convert HTML file or URL to PDF with .NET SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the pdfcrowd .NET client to convert an HTML file and a URL to PDF. ```csharp pdfcrowd.HtmlToPdfClient api = new pdfcrowd.HtmlToPdfClient("demo", "demo"); api.convertFileToFile("document.html", "html.pdf"); api.convertUrlToFile("https://example.com", "url.pdf"); ``` -------------------------------- ### Convert HTML file or URL to PDF with Java SDK Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the Pdfcrowd Java client to convert an HTML file and a URL to PDF. Requires importing com.pdfcrowd.*. ```java import com.pdfcrowd.*; Pdfcrowd.HtmlToPdfClient api = new Pdfcrowd.HtmlToPdfClient("demo", "demo"); api.convertFileToFile("document.html", "html.pdf"); api.convertUrlToFile("https://example.com", "url.pdf"); ``` -------------------------------- ### Merge PDFs with Go SDK Source: https://pdfcrowd.com/api/pdf-to-pdf-api Uses the pdfcrowd-go client to merge two PDF files. Panics on error. ```go package main import "github.com/pdfcrowd/pdfcrowd-go" func main() { api := pdfcrowd.NewPdfToPdfClient("demo", "demo") api.AddPdfFile("first.pdf") api.AddPdfFile("second.pdf") err := api.ConvertToFile("document.pdf") if err != nil { panic(err) } } ``` -------------------------------- ### Render PDF page to PNG with Node.js SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the Node.js pdfcrowd client. Set credentials, output format, and page range, then convert the file. The callback logs the created file name or an error. ```javascript var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.PdfToImageClient("demo", "demo"); api.setOutputFormat("png"); api.setPrintPageRange("1"); api.convertFileToFile("input.pdf", "page.png", function(error, fileName) { if (error) return console.error(error); console.log("Created " + fileName); }); ``` -------------------------------- ### Render PDF page to PNG with PHP SDK Source: https://pdfcrowd.com/api/pdf-to-image-api Use the PHP pdfcrowd client. Require the library, set the API credentials, set output format and page range, and convert the input file. ```php setOutputFormat("png"); $api->setPrintPageRange("1"); $api->convertFileToFile("input.pdf", "page.png"); ``` -------------------------------- ### Node.js: Convert PDF to text with pdfcrowd client Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the pdfcrowd Node.js library. Creates a PdfToTextClient with demo credentials and converts input.pdf to document.txt, logging the created file name or an error. ```javascript var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.PdfToTextClient("demo", "demo"); api.convertFileToFile("input.pdf", "document.txt", function(error, fileName) { if (error) return console.error(error); console.log("Created " + fileName); }); ``` -------------------------------- ### Convert PDF to HTML with Java Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd Java client to convert a local PDF to HTML. Requires the pdfcrowd library and demo credentials. ```java import com.pdfcrowd.*; Pdfcrowd.PdfToHtmlClient api = new Pdfcrowd.PdfToHtmlClient("demo", "demo"); api.convertFileToFile("input.pdf", "document.html"); ``` -------------------------------- ### Convert PDF to HTML with Ruby Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd Ruby client to convert a local PDF to HTML. Requires the pdfcrowd gem and demo credentials. ```ruby require "pdfcrowd" api = Pdfcrowd::PdfToHtmlClient.new("demo", "demo") api.convertFileToFile("input.pdf", "document.html") ``` -------------------------------- ### Convert image to PDF with Node.js Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the pdfcrowd Node.js client to convert a local JPG image to a PDF. The callback logs the created file name or an error. ```javascript var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.ImageToPdfClient("demo", "demo"); api.convertFileToFile("image.jpg", "document.pdf", function(error, fileName) { if (error) return console.error(error); console.log("Created " + fileName); }); ``` -------------------------------- ### PHP: Convert PDF to text with Pdfcrowd client Source: https://pdfcrowd.com/api/pdf-to-text-api Uses the pdfcrowd PHP library. Requires pdfcrowd.php and creates a PdfToTextClient with demo credentials to convert input.pdf to document.txt. ```php convertFileToFile("input.pdf", "document.txt"); ``` -------------------------------- ### Convert PDF to HTML with Python Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd Python client to convert a local PDF to HTML. Requires the pdfcrowd library and demo credentials. ```python import pdfcrowd api = pdfcrowd.PdfToHtmlClient("demo", "demo") api.convertFileToFile("input.pdf", "document.html") ``` -------------------------------- ### Merge PDFs with .NET SDK Source: https://pdfcrowd.com/api/pdf-to-pdf-api Uses the pdfcrowd .NET client to merge two PDF files. Requires the pdfcrowd library and demo credentials. ```csharp pdfcrowd.PdfToPdfClient api = new pdfcrowd.PdfToPdfClient("demo", "demo"); api.addPdfFile("first.pdf"); api.addPdfFile("second.pdf"); api.convertToFile("document.pdf"); ``` -------------------------------- ### Convert image to PDF with cURL Source: https://pdfcrowd.com/api/image-to-pdf-api Uses the PDFCrowd API with demo credentials to convert a local JPG image to a PDF. The --fail flag makes curl fail on HTTP errors. ```bash curl --fail --user "demo:demo" \ --form "input_format=image" \ --form "output_format=pdf" \ --form "file=@image.jpg" \ --output "document.pdf" \ https://api.pdfcrowd.com/convert/24.04/ ``` -------------------------------- ### Convert PDF to HTML with PHP Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd PHP client to convert a local PDF to HTML. Requires the pdfcrowd.php file and demo credentials. ```php convertFileToFile("input.pdf", "document.html"); ``` -------------------------------- ### Render first PDF page to PNG using cURL Source: https://pdfcrowd.com/api/pdf-to-image-api Use cURL to call the PDF to Image API endpoint. Set the API credentials (demo user) and specify input format, output format, and page range. The output is saved to 'page.png'. ```bash curl --fail --user "demo:demo" \ --form "input_format=pdf" \ --form "output_format=png" \ --form "print_page_range=1" \ --form "file=@input.pdf" \ --output "page.png" \ https://api.pdfcrowd.com/convert/24.04/ ``` -------------------------------- ### Merge PDFs with Ruby SDK Source: https://pdfcrowd.com/api/pdf-to-pdf-api Uses the Pdfcrowd Ruby client to merge two PDF files. Requires the pdfcrowd gem and demo credentials. ```ruby require "pdfcrowd" api = Pdfcrowd::PdfToPdfClient.new("demo", "demo") api.addPdfFile("first.pdf") api.addPdfFile("second.pdf") api.convertToFile("document.pdf") ``` -------------------------------- ### Convert PDF to HTML with Node.js Source: https://pdfcrowd.com/api/pdf-to-html-api Uses the pdfcrowd Node.js client to convert a local PDF to HTML. Requires the pdfcrowd npm package and demo credentials. Logs the created file name or error. ```javascript var pdfcrowd = require("pdfcrowd"); var api = new pdfcrowd.PdfToHtmlClient("demo", "demo"); api.convertFileToFile("input.pdf", "document.html", function(error, fileName) { if (error) return console.error(error); console.log("Created " + fileName); }); ``` -------------------------------- ### Merge PDFs with PHP SDK Source: https://pdfcrowd.com/api/pdf-to-pdf-api Uses the Pdfcrowd PHP client to merge two PDF files. Requires the pdfcrowd.php library and demo credentials. ```php addPdfFile("first.pdf"); $api->addPdfFile("second.pdf"); $api->convertToFile("document.pdf"); ``` -------------------------------- ### Merge PDFs with Java SDK Source: https://pdfcrowd.com/api/pdf-to-pdf-api Uses the Pdfcrowd Java client to merge two PDF files. Requires the pdfcrowd library and demo credentials. ```java import com.pdfcrowd.*; Pdfcrowd.PdfToPdfClient api = new Pdfcrowd.PdfToPdfClient("demo", "demo"); api.addPdfFile("first.pdf"); api.addPdfFile("second.pdf"); api.convertToFile("document.pdf"); ``` -------------------------------- ### Convert HTML file or URL to PDF with cURL Source: https://pdfcrowd.com/api/html-to-pdf-api Uses the PDFCrowd API with basic authentication (demo:demo) to convert an HTML file or a URL to PDF. The --form flag sends the input and --output saves the PDF locally. ```bash # HTML file to PDF curl --user "demo:demo" \ --form "file=@document.html" \ --output "from-file.pdf" \ https://api.pdfcrowd.com/convert/24.04/ # URL to PDF curl --user "demo:demo" \ --form "url=https://example.com" \ --output "from-url.pdf" \ https://api.pdfcrowd.com/convert/24.04/ ``` -------------------------------- ### ImageToImageClient Source: https://pdfcrowd.com/api/image-to-image-api SDK client for the Image to Image API. Provides methods to set the output format and convert image files. ```APIDOC ## ImageToImageClient ### Description Client for the Image to Image API. Provides methods to convert image files to a specified output format. ### Methods #### setOutputFormat(format) - **format** (string) - Required - The desired output format, e.g., "jpg". #### convertFileToFile(inputFile, outputFile) - **inputFile** (string) - Required - Path to the input image file. - **outputFile** (string) - Required - Path where the converted image will be saved. ### Example (Python) ```python import pdfcrowd api = pdfcrowd.ImageToImageClient("demo", "demo") api.setOutputFormat("jpg") api.convertFileToFile("image.png", "image.jpg") ``` ``` -------------------------------- ### Merge PDFs with Python SDK Source: https://pdfcrowd.com/api/pdf-to-pdf-api Uses the pdfcrowd Python client to merge two PDF files. Requires the pdfcrowd library and demo credentials. ```python import pdfcrowd api = pdfcrowd.PdfToPdfClient("demo", "demo") api.addPdfFile("first.pdf") api.addPdfFile("second.pdf") api.convertToFile("document.pdf") ```