% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/printers.R
\name{save_as_image}
\alias{save_as_image}
\title{Save a flextable in a 'png' or 'svg' file}
\usage{
save_as_image(x, path, expand = 10, res = 200, ...)
}
\arguments{
\item{x}{a 'flextable' object, see \link{flextable-package} to learn how to create
'flextable' object.}

\item{path}{image file to be created. It should end with '.png'
or '.svg'.}

\item{expand}{space in pixels to add around the table.}

\item{res}{The resolution of the device}

\item{...}{unused arguments}
}
\value{
a string containing the full name of the generated file
}
\description{
Save a flextable as a png or svg image.
This function uses R graphic system to create an image from the flextable,
allowing for high-quality image output. See \code{\link[=gen_grob]{gen_grob()}} for more options.
}
\section{caption}{

It's important to note that captions are not part of the table itself.
This means when exporting a table to PNG or SVG formats (image formats),
the caption won't be included. Captions are intended for document outputs
like Word, HTML, or PDF, where tables are embedded within the document
itself.
}

\examples{
library(gdtools)
register_liberationsans()
set_flextable_defaults(font.family = "Liberation Sans")

ft <- flextable(head(mtcars))
ft <- autofit(ft)
tf <- tempfile(fileext = ".png")
save_as_image(x = ft, path = tf)

init_flextable_defaults()
}
\seealso{
Other functions for flextable output and export:
\code{\link[=df_printer]{df_printer()}},
\code{\link[=flextable_to_rmd]{flextable_to_rmd()}},
\code{\link[=gen_grob]{gen_grob()}},
\code{\link[=htmltools_value]{htmltools_value()}},
\code{\link[=knit_print.flextable]{knit_print.flextable()}},
\code{\link[=plot.flextable]{plot.flextable()}},
\code{\link[=print.flextable]{print.flextable()}},
\code{\link[=repair_docx]{repair_docx()}},
\code{\link[=save_as_docx]{save_as_docx()}},
\code{\link[=save_as_html]{save_as_html()}},
\code{\link[=save_as_pptx]{save_as_pptx()}},
\code{\link[=save_as_rtf]{save_as_rtf()}},
\code{\link[=to_html.flextable]{to_html.flextable()}},
\code{\link[=wrap_flextable]{wrap_flextable()}}
}
\concept{flextable_output_export}
