FitArea() needed even though there is enough space
Author: znakeeyeCreated Sep 5, 2026Updated Sep 5, 2026
See attached sample project.
When creating an A5-sized PDF, adding an A5-sized SVG throws DocumentLayoutException. Is this expected? Certainly there is enough space when the SVG has the same size as the PDF? It works if you call FitArea() but why is it needed?
internal class Program
{
static void Main(string[] args)
{
QuestPDF.Settings.License = LicenseType.Evaluation;
try
{
Document.Create(container =>
{
container.Page(page =>
{
page.Size(PageSizes.A5);
// Size of test.svg is A5 (148x210 mm)
page.Content()
.Svg(@".\\Resources\\test.svg")
// .FitArea()
;
});
})
.GeneratePdf("hello.pdf");
}
catch (DocumentLayoutException ex)
{
// Unexpected?
throw;
}
}
}Source: QuestPDF/QuestPDF