Docs/Exporting
Chitra supports exporting to PDF, PNG and SVG formats.
Export to PDF
import chitra;
void main()
{
auto ctx = new Chitra(700);
with (ctx)
{
rect(100, 100, 500, 200);
saveAs("rect.pdf");
}
}
Export to PNG
import chitra;
void main()
{
auto ctx = new Chitra(700);
with (ctx)
{
rect(100, 100, 500, 200);
saveAs("rect.png");
}
}
Export to SVG
import chitra;
void main()
{
auto ctx = new Chitra(700);
with (ctx)
{
rect(100, 100, 500, 200);
saveAs("rect.svg");
}
}
Resolution
Default resolution is 300. Change the resolution while saving.
saveAs("rect.pdf", resolution: 72);
saveAs("rect.png", resolution: 72);
saveAs("rect.svg", resolution: 72);