How to generate PDF invoice from HTML template for HTML to ...
[Pages:4]
How to generate PDF invoice from HTML template for HTML to PDF API in PowerShell using PDF.co Web API
How to generate PDF invoice from HTML template for HTML to PDF API in PowerShell: Step By Step Tutorial
ByteScout tutorials explain the code material for beginners and advanced programmers who are using PowerShell. PDF.co Web API was made to help with HTML to PDF API in PowerShell. PDF.co Web API is the Web API with a set of tools for documents manipulation, data conversion, data extraction, splitting and merging of documents. Includes image recognition, built-in OCR, barcode generation and barcode decoders to decode bar codes from scans, pictures and pdf. This rich sample source code in PowerShell for PDF.co Web API includes the number of functions and options you should do calling the API to implement HTML to PDF API. This PowerShell sample code should be copied and pasted into your project. After doing this just compile your project and click Run. Enjoy writing a code with ready-to-use sample PowerShell codes to implement HTML to PDF API using PDF.co Web API. Our website provides free trial version of PDF.co Web API that includes source code samples to help with your PowerShell project.
FOR MORE INFORMATION AND FREE TRIAL:
Download Free Trial SDK (on-premise version) Read more about PDF.co Web API Explore API Documentation Get Free Training for PDF.co Web API Get Free API key for Web API visit
Source Code Files:
GeneratePdfInvoiceFromHtmlTemplate.ps1
# The authentication key (API Key). # Get your own by registering at $API_KEY = "***********************************"
# HTML template $Template = [IO.File]::ReadAllText(".\invoice_template.html") # Data to fill the template $TemplateData = [IO.File]::ReadAllText(".\invoice_data.json") # Destination PDF file name $DestinationFile = ".\result.pdf"
# Prepare URL for HTML to PDF API call $query = "$(Split-Path $DestinationFile -Lea $query = [System.Uri]::EscapeUriString($query)
# Prepare request body (will be auto-converted to JSON by Invoke-RestMethod) $body = @{
"html" = $Template "templateData" = $TemplateData } | ConvertTo-Json
try { # Execute request $response = Invoke-WebRequest -Method Post -Headers @{ "x-api-key" = $API_KEY; "Content-T
if ($response.StatusCode -eq 200) {
$jsonResponse = $response.Content | ConvertFrom-Json
if ($jsonResponse.error -eq $false) { # Get URL of generated PDF file $resultFileUrl = $jsonResponse.url;
# Download PDF file Invoke-WebRequest -Headers @{ "x-api-key" = $API_KEY } -OutFile $DestinationFile
Write-Host "Generated PDF file saved as `"$($DestinationFile)`" file." } else {
# Display service reported error Write-Host $jsonResponse.message } } else { # Display request error status Write-Host $response.StatusCode + " " + $response.StatusDescription } } catch { # Display request error Write-Host $_.Exception }
run.bat
@echo off powershell -NoProfile -ExecutionPolicy Bypass -Command "& .\GeneratePdfInvoiceFromHtmlTemplat echo Script finished with errorlevel=%errorlevel% pause
VIDEO
ON-PREMISE OFFLINE SDK
60 Day Free Trial or Visit PDF.co Web API Home Page Explore PDF.co Web API Documentation Explore Samples Sign Up for PDF.co Web API Online Training
ON-DEMAND REST WEB API
Get Your API Key Explore Web API Docs Explore Web API Samples
visit visit PDF.co
................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- administration center
- automating zvr with powershell and rest apis whitepaper
- google ocr to read pdf
- detect text from image python
- the con daily holiday hack challenge
- how to generate pdf invoice from html template for html to
- chef in windows
- managing unity arrays with new generation tools
- the powerof rest api
- openstack cinder as an sds api snia
Related searches
- how to generate monthly income
- how to export pdf to excel
- how to convert pdf to excel spreadsheet
- how to convert pdf to excel
- how to generate retirement income
- how to generate income fast
- how to generate a number in python
- how to generate normal distribution
- how to email pdf from edge
- how to generate random numbers in excel
- how to download pdf for laptop
- how to edit pdf files for free