@@ -168,15 +168,15 @@ which will be converted to PDF.</p>
< span class = "p" > < < / span > < span class = "p" > /< / span > < span class = "nt" > html< / span > < span class = "p" > > < / span >
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.basic.guzzle " href = "#html.basic.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.basic.c_url " href = "#html.basic.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/html < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.basic.go" href = "#html.basic.go" >
@@ -199,7 +199,16 @@ which will be converted to PDF.</p>
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\HTMLRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $index = DocumentFactory::makeFromPath(' index.html' , ' index.html' );
< / span > < span class = "x" > $request = new HTMLRequest($index);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< h2 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.header_and_footer" href = "#html.header_and_footer" >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
@@ -241,17 +250,17 @@ Respectively, a file named <code>header.html</code> and <code>footer.html</code>
Also, < code > footer.html< / code > CSS properties override the ones from < code > header.html< / code > .< / p >
< / blockquote >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.header_and_footer.guzzle " href = "#html.header_and_footer.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.header_and_footer.c_url " href = "#html.header_and_footer.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/html < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @header.html
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @footer.html
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @header.html < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @footer.html < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.header_and_footer.go" href = "#html.header_and_footer.go" >
@@ -278,13 +287,26 @@ Also, <code>footer.html</code> CSS properties override the ones from <code>heade
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\HTMLRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $index = DocumentFactory::makeFromPath(' index.html' , ' index.html' );
< / span > < span class = "x" > $header = DocumentFactory::makeFromPath(' header.html' , ' header.html' );
< / span > < span class = "x" > $footer = DocumentFactory::makeFromPath(' footer.html' , ' footer.html' );
< / span > < span class = "x" > $request = new HTMLRequest($index);
< / span > < span class = "x" > $request-> setHeader($header);
< / span > < span class = "x" > $request-> setFooter($footer);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< h2 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.assets" href = "#html.assets" >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Assets< / h2 >
< p > You may also send additional files. For instance, images, fonts, stylesheets and so on.< / p >
< p > You may also send additional files. For instance: images, fonts, stylesheets and so on.< / p >
< p > The only requirement is to make sure that their paths
are on the same level as the < code > index.html< / code > file.< / p >
@@ -326,18 +348,18 @@ are on the same level as the <code>index.html</code> file.</p>
see to the < a href = "#office.fonts" > fonts section< / a > .< / p >
< / blockquote >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.assets.guzzle " href = "#html.assets.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.assets.c_url " href = "#html.assets.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/html < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @style.css
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @img.png
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @font.woff
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @style.css < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @img.png < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @font.woff < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.assets.go" href = "#html.assets.go" >
@@ -365,37 +387,52 @@ see to the <a href="#office.fonts">fonts section</a>.</p>
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\HTMLRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $index = DocumentFactory::makeFromPath(' index.html' , ' index.html' );
< / span > < span class = "x" > $assets = [
< / span > < span class = "x" > DocumentFactory::makeFromPath(' style.css' , ' style.css' ),
< / span > < span class = "x" > DocumentFactory::makeFromPath(' img.png' , ' img.png' ),
< / span > < span class = "x" > DocumentFactory::makeFromPath(' font.woff' , ' font.woff' ),
< / span > < span class = "x" > ];
< / span > < span class = "x" > $request = new HTMLRequest($index);
< / span > < span class = "x" > $request-> setAssets($assets);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< h2 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.paper_size_margins_orientation" href = "#html.paper_size_margins_orientation" >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Paper size, margins, orientation< / h2 >
< p > You may also customize the resulting PDF paper .< / p >
< p > You may also customize the resulting PDF format .< / p >
< p > By default, it will be rendered in < code > A4< / code > size with < code > 1 inch< / code > margins and < code > portrait< / code > orientation.< / p >
< p > By default, it will be rendered with < code > A4< / code > size, < code > 1 inch< / code > margins and < code > portrait< / code > orientation.< / p >
< blockquote >
< p > Paper size and margins have to be provided in < code > inches< / code > .
Also, you have to set both < code > paperWidth< / code > and < code > paperHeight< / code > . Same for margins.< / p >
< / blockquote >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.paper_size_margins_orientation.guzzle " href = "#html.paper_size_margins_orientation.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.paper_size_margins_orientation.c_url " href = "#html.paper_size_margins_orientation.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/html < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html
--form < span class = "nv" > paperWidth< / span > < span class = "o" > =< / span > < span class = "m" > 8< / span > .27
--form < span class = "nv" > paperHeight< / span > < span class = "o" > =< / span > < span class = "m" > 11< / span > .27
--form < span class = "nv" > marginTop< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span >
--form < span class = "nv" > marginBottom< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span >
--form < span class = "nv" > marginLeft< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span >
--form < span class = "nv" > marginRight< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span >
--form < span class = "nv" > landscape< / span > < span class = "o" > =< / span > < span class = "nb" > true< / span >
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > paperWidth< / span > < span class = "o" > =< / span > < span class = "m" > 8< / span > .27 < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > paperHeight< / span > < span class = "o" > =< / span > < span class = "m" > 11< / span > .27 < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > marginTop< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > marginBottom< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > marginLeft< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > marginRight< / span > < span class = "o" > =< / span > < span class = "m" > 0< / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > landscape< / span > < span class = "o" > =< / span > < span class = "nb" > true< / span > < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "html.paper_size_margins_orientation.go" href = "#html.paper_size_margins_orientation.go" >
@@ -423,7 +460,20 @@ Also, you have to set both <code>paperWidth</code> and <code>paperHeight</code>.
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\HTMLRequest;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\Request;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $index = DocumentFactory::makeFromPath(' index.html' , ' index.html' );
< / span > < span class = "x" > $request = new HTMLRequest($index);
< / span > < span class = "x" > $request-> setPaperSize(Request::A4);
< / span > < span class = "x" > $request-> setMargins(Request::NO_MARGINS);
< / span > < span class = "x" > $request-> setLandscape(true);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< / div >
@@ -442,7 +492,7 @@ Also, you have to set both <code>paperWidth</code> and <code>paperHeight</code>.
< p > Markdown conversions work the same as HTML conversions.< / p >
< p > Only difference is that you have access to the Go template function < code > toHTML< / code >
in the file < code > index.html< / code > which will convert a given markdown file to HTML.< / p >
in the file < code > index.html< / code > . This function will convert a given markdown file to HTML.< / p >
< p > For instance:< / p >
@@ -458,16 +508,16 @@ in the file <code>index.html</code> which will convert a given markdown file to
< span class = "p" > < < / span > < span class = "p" > /< / span > < span class = "nt" > html< / span > < span class = "p" > > < / span >
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "markdown.basic.guzzle " href = "#markdown.basic.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "markdown.basic.c_url " href = "#markdown.basic.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/markdown < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @file.md
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @file.md < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "markdown.basic.go" href = "#markdown.basic.go" >
@@ -493,7 +543,19 @@ in the file <code>index.html</code> which will convert a given markdown file to
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\MarkdownRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $index = DocumentFactory::makeFromPath(' index.html' , ' index.html' );
< / span > < span class = "x" > $markdowns = [
< / span > < span class = "x" > DocumentFactory::makeFromPath(' file.md' , ' file.md' ),
< / span > < span class = "x" > ];
< / span > < span class = "x" > $request = new MarkdownRequest($index, $markdowns);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< / div >
@@ -501,7 +563,7 @@ in the file <code>index.html</code> which will convert a given markdown file to
< h1 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "office" href = "#office" >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Office< / h1 >
< p > Gotenberg provides the endpoint < code > /convert/office< / code > for Office documents conversions.< / p >
< p > Gotenberg provides the endpoint < code > /convert/office< / code > for Office document conversions.< / p >
< p > It accepts < code > POST< / code > requests with a < code > multipart/form-data< / code > Content-Type.< / p >
@@ -531,16 +593,16 @@ That’ s why for Office conversions, the API does only one conversion at a time.
See the < a href = "#scalability" > scalability section< / a > to find how to mitigate this issue.< / p >
< / blockquote >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "office.basic.guzzle " href = "#office.basic.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "office.basic.c_url " href = "#office.basic.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/office < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @document.docx
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @document2.docx
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @document.docx < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @document2.docx < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "office.basic.go" href = "#office.basic.go" >
@@ -566,7 +628,19 @@ See the <a href="#scalability">scalability section</a> to find how to mitigate t
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\OfficeRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $files = [
< / span > < span class = "x" > DocumentFactory::makeFromPath(' document.docx' , ' document.docx' ),
< / span > < span class = "x" > DocumentFactory::makeFromPath(' document2.docx' , ' document2.docx' ),
< / span > < span class = "x" > ];
< / span > < span class = "x" > $request = new OfficeRequest($files);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< h2 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "office.fonts" href = "#office.fonts" >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
@@ -598,16 +672,16 @@ See the <a href="#scalability">scalability section</a> to find how to mitigate t
< p > Nothing special here: you may send one or more PDF files and the API
will merge them and return the resulting PDF file.< / p >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "merge.basic.guzzle " href = "#merge.basic.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "merge.basic.c_url " href = "#merge.basic.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/merge < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @file.pdf
--form < span class = "nv" > files< / span > < span class = "o" > =< / span > @file2.pdf
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @file.pdf < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @file2.pdf < span class = "se" > \
< / span > < span class = "se" > < / span > > result.pdf
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "merge.basic.go" href = "#merge.basic.go" >
@@ -633,7 +707,19 @@ will merge them and return the resulting PDF file.</p>
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\MergeRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $files = [
< / span > < span class = "x" > DocumentFactory::makeFromPath(' file.pdf' , ' file.pdf' ),
< / span > < span class = "x" > DocumentFactory::makeFromPath(' file2.pdf' , ' file2.pdf' ),
< / span > < span class = "x" > ];
< / span > < span class = "x" > $request = new MergeRequest($files);
< / span > < span class = "x" > $dirPath = " /foo" ;
< / span > < span class = "x" > $filename = $client-> store($request, $dirPath);
< / span > < span class = "x" > < / span > < / pre >
< / div >
@@ -646,22 +732,21 @@ will merge them and return the resulting PDF file.</p>
< p > If provided, the API will send the resulting PDF file in a < code > POST< / code > request with the < code > application/pdf< / code > Content-Type
to given URL.< / p >
< p > By doing so, your requests to the API will be done before the conversions are actually done!< / p >
< p > By doing so, your requests to the API will be over before the conversions are actually done!< / p >
< h2 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "webhook.examples" href = "#webhook.examples" >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Examples< / h2 >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "webhook.examples.guzzle " href = "#webhook.examples.guzzle " >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "webhook.examples.c_url " href = "#webhook.examples.c_url " >
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > Guzzle < / h3 >
< / a > cURL < / h3 >
< pre class = "chroma" > $ curl --request POST < span class = "se" > \
< / span > < span class = "se" > < / span > --url http://localhost:3000/convert/html < span class = "se" > \
< / span > < span class = "se" > < / span > --header < span class = "s1" > ' Content-Type: multipart/form-data' < / span > < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html
--form < span class = "nv" > webhookURL< / span > < span class = "o" > =< / span > < span class = "s1" > ' http://myapp.com/webhook/' < / span >
> result.pdf
< / span > < span class = "se" > < / span > --form < span class = "nv" > files< / span > < span class = "o" > =< / span > @index.html < span class = "se" > \
< / span > < span class = "se" > < / span > --form < span class = "nv" > webhookURL< / span > < span class = "o" > =< / span > < span class = "s1" > ' http://myapp.com/webhook/' < / span >
< / pre >
< h3 class = "Heading" > < a class = "Anchor" aria-hidden = "true" id = "webhook.examples.go" href = "#webhook.examples.go" >
@@ -687,7 +772,16 @@ to given URL.</p>
< svg xmlns = "http://www.w3.org/2000/svg" aria-hidden = "true" width = "14" height = "14" viewBox = "0 0 24 24" fill = "none" stroke = "currentColor" stroke-width = "2" stroke-linecap = "round" stroke-linejoin = "round" class = "feather feather-link" > < path d = "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" > < / path > < path d = "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" > < / path > < / svg >
< / a > PHP< / h3 >
< p> TODO< / p >
< pre class = "chroma" > < span class = "x" > use TheCodingMachine\Gotenberg\Client;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\DocumentFactory;
< / span > < span class = "x" > use TheCodingMachine\Gotenberg\HTMLRequest;
< / span > < span class = "x" >
< / span > < span class = "x" > $client = new Client(' http://localhost:3000' , new \Http\Adapter\Guzzle6\Client());
< / span > < span class = "x" > $index = DocumentFactory::makeFromPath(' index.html' , ' index.html' );
< / span > < span class = "x" > $request = new HTMLRequest($index);
< / span > < span class = "x" > $request-> setWebhookURL(' http://myapp.com/webhook/' );
< / span > < span class = "x" > $resp = $client-> post($request);
< / span > < span class = "x" > < / span > < / pre >
< / div >