ide: PDF export in .qtf designer

This commit is contained in:
Mirek Fidler 2026-04-28 11:37:59 +02:00
parent c402c6b7a0
commit e72b5bd4fb
6 changed files with 230 additions and 243 deletions

View file

@ -107,6 +107,8 @@ bool HasGit();
int MaxAscent(Font f);
void ExportPdf(const RichEdit& editor);
String LibClangCommandLine();
String LibClangCommandLineC();

View file

@ -1,4 +1,5 @@
#include "Common.h"
#include <PdfDraw/PdfDraw.h>
bool Debugger::Tip(const String&, CodeEditor::MouseTip&)
{
@ -264,3 +265,17 @@ int MaxAscent(Font f)
return max(f.GetAscent(), f().Bold().GetAscent(),
f().Italic().GetAscent(), f().Bold().Italic().GetAscent());
}
void ExportPdf(const RichEdit& editor)
{
FileSel fs;
fs.Type("PDF files", "*.pdf")
.AllFilesType()
.DefaultExt("pdf");
if(!fs.ExecuteSaveAs("Output PDF file"))
return;
Size page = Size(3968, 6074);
PdfDraw pdf(page + 400);
::Print(pdf, editor.Get(), page);
SaveFile(~fs, pdf.Finish());
}