PdfLoadedDocument pdfLoadedDocument = new PdfLoadedDocument(@"test.pdf");
pdfViewer.ItemSource = pdfLoadedDocument;
4. Text Insert (폰트 유의 - 한글지원 폰트) 5페이지의 해당 좌표위치에 '테스트 테스트' 문자열을 추가합니다.
PdfLoadedPage page = pdfLoadedDocument.Pages[5] as PdfLoadedPage;
var graphics = page.Graphics;
// 1. Text Insert
PdfFont font = new PdfCjkStandardFont(PdfCjkFontFamily.HanyangSystemsShinMyeongJoMedium, 13);
graphics.DrawString("테스트도 테스트시", font, PdfBrushes.Black, new PointF(170, 107));
5. Image Insert 5페이지의 해당 좌표위치에 'kei.jpg' 이미지를 추가합니다.
PdfLoadedPage page = pdfLoadedDocument.Pages[5] as PdfLoadedPage;
var graphics = page.Graphics;
// 2. Image Insert
PdfBitmap image = new PdfBitmap("kei.jpg");
graphics.DrawImage(image, 110, 190);
2. Nuget 설치 Serilog.Sinks.Console Serilog.Sinks.File
3. Log 설정
using Serilog;
using Serilog.Core;
namespace SerilogTest;
class Program
{
static void Main(string[] args)
{
var levelSwitch = new LoggingLevelSwitch();
Log.Logger = new LoggerConfiguration()
// 최소 지정 로그 레벨 : Info 레벨 이상 로그를 기록한다는 의미
.MinimumLevel.Information()
// 콘솔에도 내용을 남김
.WriteTo.Console()
//파일로 기록할 로그 파일명을 입력
.WriteTo.File(@"c:\log\log.txt", rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true)
.CreateLogger();
for (int idx = 0; idx < 100; idx++)
{
Log.Information($"{idx} - Serilog Test");
}
Log.CloseAndFlush();
}
}
Browse Seq 버튼을 클릭하면 웹이사이트가 열리고 아까 지정한 아이디와 비밀번호를 입력한다.
3. Seq 설정을 끝났고 프로젝트에 Nuget 설치 Serilog.Sinks.Seq
4. Serilog 를 이용해 Seq 연동 .WriteTo.Seq("http://localhost:5341") 코드를 추가하면된다.
using Serilog;
using Serilog.Core;
namespace SerilogTest;
class Program
{
static void Main(string[] args)
{
var levelSwitch = new LoggingLevelSwitch();
Log.Logger = new LoggerConfiguration()
// 최소 지정 로그 레벨 : Info 레벨 이상 로그를 기록한다는 의미
.MinimumLevel.Information()
// 콘솔에도 내용을 남김
.WriteTo.Console()
//파일로 기록할 로그 파일명을 입력
.WriteTo.File(@"c:\log\log.txt", rollingInterval: RollingInterval.Day, rollOnFileSizeLimit: true)
// Seq 에 로그 정보 입력
.WriteTo.Seq("http://localhost:5341", controlLevelSwitch: levelSwitch)
.CreateLogger();
for (int idx = 0; idx < 100; idx++)
{
Log.Information($"{idx} - Serilog Test");
}
Log.CloseAndFlush();
}
}