- Code: Select all
var pdfDoc = new PdfDocument();
pdfDoc.LoadFromBytes(file);
var widget = pdfDoc.Form as PdfFormWidget;
var fields = widget.FieldsWidget.List;
using (var ms = new MemoryStream())
{
pdfDoc.SaveToStream(ms, FileFormat.PDF);
var model = new UploadDynamicDocumentViewModel
{
DocumentData = doc,
File = Convert.ToBase64String(ms.ToArray())
};
if (uploadedDoc != null)
{
model.CustomerDocumentId = uploadedDoc.Id;
}
return View(model);
}
This is not preserving the font sizes (for text boxes) that are already embedded into the PDF document.
This code does preserve the font sizes:
- Code: Select all
pdfDoc.SaveToFile("C:\\Users\\mike.henry\\Desktop\\mike.pdf");
What can I do to preserve the font sizes for text boxes when saving to stream?