GithubHelp home page GithubHelp logo

4d-component-wkhtmltopdf's Introduction

platform version license downloads

4d-component-wkhtmltopdf

4D wrapper for wkhtmltopdf

Discussion

It is very hard to use libwkhtmltopdf as a plugin-style module for 4D. The menu bar is corrupted, the event loop is disrupted...just not worth it. Much easier to run the CLI with LAUNCH EXTERNAL PROCESS. Thankfully the command is now thread safe.

About Apple Silicon

see https://wkhtmltopdf.org/status

there is no native support (needs Rosetta 2)

About Notarisation

If wkhtmltopdf is notarised without entitlements,

i.e.

codesign 
	--verbose 
	--deep 
	--timestamp
	--force 
	--sign "Developer ID Application: keisuke miyako (Y69CWUC25B)" 
	--options=runtime 

it will not work anymore.

Loading pages (1/6)
Bus error: 10                                                ] 10%

It must be codesigned and notarised with sufficient entitlements.

Usage

Pass the standard arguments in camelcase.

$path:=Get 4D folder(Current resources folder)+"test.html"

$html:=Document to text($path;"utf-8")

C_OBJECT($options)
$options:=New object
$options.grayscale:=True
$options.dpi:=72
$options.logLevel:="none"
$options.externalLinks:=False
$options.collate:=False
$options.copies:=1
$options.imageDpi:=300
$options.imageQuality:=100
$options.lowquality:=True
$options.orientation:="Landscape"  //Portrait
$options.marginBottom:="0mm"
$options.marginLeft:="0mm"
$options.marginRight:="0mm"
$options.marginTop:="0mm"
  //$options.pageHeight:="30cm"
  //$options.pageWidth:="30cm"
$options.pageSize:="A4"
$options.title:="TEST"
$options.pdfCompression:=False

$options.outline:=True
$options.outlineDepth:=8

$options.background:=True
$options.loadErrorHandling:="skip"  //abort,ignore
$options.loadMediaErrorHandling:="skip"  //abort,ignore
$options.localFileAccess:=True
  //$options.minimumFontSize:=20

$options.zoom:=2

  //repeatable properties not implemented;
  //allow,bypassProxyFor,cookie*,customHeader,post,postFile,runScript,replace

$pdf:=wkhtmltopdf ($options;$html;"utf-8")

  //$pdf is empty in case of conversion failure
  //$options.errors[] may contain error information (may not be failure)
  //$options.value contains the command line string

If (BLOB size($pdf)#0)
	
	$path:=System folder(Desktop)+Generate UUID+".pdf"
	
	BLOB TO DOCUMENT($path;$pdf)
	OPEN URL($path)
	
End if 

4d-component-wkhtmltopdf's People

Contributors

miyako avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.