AI OnAI Off
If i understand the question correctly, in theory this should work
public class PDFBlockController : BlockControllerBase<PDFBlock> { public override ActionResult Index(PDFBlock currentContent) { YourBlockViewModel model = new YourBlockViewModel(); model.PDFFile = new File(//Prepare file) return model; } } View .cshtml <embed src="model.PDFFile" type="application/pdf" />
Are you doing something differently?
Regards
/K
Hello everyone,
I'm trying to create a block that generates a PDF using some data that are send from user by POST. I created an action controller and PDF is being generated just fine. The problem is when I want to create a Response of "application/pdf" type in this controller the PDF is corrupted as it contains website HTML. I tried several things like returning the pdf by stream or saving the file and pointing to it using FilePathResult. I cleared Response before transmitting the file and close / end it after that but it keeps showing corrupted PDFs. The problem disappears when I place the action handler in PageController instead of BlockController. Do you know a way to fix this issue?
Regards,
Konrad