Replies: 1 comment
-
Thank you for sharing your feedback. I have enhanced the Getting Started tutorial by adding missing using System.IO;
using QuestPDF.Drawing;
using QuestPDF.Fluent;
using QuestPDF.Infrastructure;
static void Main(string[] args)
{
var model = InvoiceDocumentDataSource.GetInvoiceDetails();
var document = new InvoiceDocument(model);
document.GeneratePdfAndShow();
// document.GeneratePdf("invoice.pdf");
} You can also test the entire project by cloning this repository: https://github.com/QuestPDF/QuestPDF |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
i am new in QuestPDF. I was reading the invoice document example Link. I understood everything, except how to run the damn thing. At the end of the tutorial there is the code for Main method:
The problem is - there is no method GeneratePdf. It seems like in the tutorial someone skipped the part where it was implemented...
There is a Compose method, that must recieve an object with type IDocumentContainer and then generate my PDF.
public void Compose(IDocumentContainer container) { container .Page(page => ...... }
In Main method of the tutorial no one uses it, but you must use it to create the PDF, am I right? Then how do you do that? IDocumentContainer is an empty Interface. I tried to create my own class, that implements the empty interface, but surprise, it didn't work.
MyDocument.Compose(new InitializeContainer());
and i recieved System.NullReferenceException: 'Object reference not set to an instance of an object.'Everyone in youtube shows the
Document.Create(container => blablabla...)
way, but it is only for very very simple PDFs, and i would want to use the normal classes with my own Models, my own data, etc. In the main video of JetBrains from Marcin Ziabek there is also the Document.Create way of implementation.Please help!
Beta Was this translation helpful? Give feedback.
All reactions