HrckoV
Member
- Joined
- Oct 19, 2021
- Messages
- 7
- Programming Experience
- 10+
I'm using this code to save pdf file. With iTextSharp I'm defining a font, but on save my font in pdf is small.
What am I doing wrong?
What am I doing wrong?
C#:
private void savePDF(string filename)
{
iTextSharp.text.Document oDoc = new iTextSharp.text.Document();
SaveFileDialog svg = new SaveFileDialog();
svg.InitialDirectory = ConfigurationManager.AppSettings["shopPath"];
svg.RestoreDirectory = true;
svg.Filter = "pdf files(*.pdf)|*.pdf";
svg.ShowDialog();
if (svg.FileName != String.Empty)
{
using (FileStream stream = new FileStream(svg.FileName, FileMode.Create))
{
Document pdfDoc = new Document(PageSize.A1);
PdfWriter.GetInstance(pdfDoc, stream);
PdfWriter.GetInstance(pdfDoc, stream);
BaseFont bf = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
iTextSharp.text.Font font = new iTextSharp.text.Font(bf, 24, iTextSharp.text.Font.BOLD);
pdfDoc.Open();
pdfDoc.Add(new Paragraph(new Chunk(stream.ToString(), font)));
pdfDoc.Close();
stream.Close();
}
oDoc.Close();
}
}
Last edited by a moderator: