@@ -976,6 +976,49 @@ private void GenerateMigraDoc_Click(object sender, RoutedEventArgs e)
976976 }
977977 }
978978
979+ private void Generate_iTextSharpLGPL_Click ( object sender , RoutedEventArgs e )
980+ {
981+ var pdfFilePath = "iTextSharpLGPL.pdf" ;
982+ var rtfFilePath = "iTextSharpLGPL.rtf" ;
983+ var htmlFilePath = "iTextSharpLGPL.html" ;
984+ var docxFilePath = "iTextSharpLGPL.docx" ;
985+
986+ // Generate PDF, HTML and RTF document using iTextSharp.LGPLv2.Core
987+ var document = new iTextSharp . text . Document ( iTextSharp . text . PageSize . A4 ) ;
988+ var pdfFileStream = new FileStream ( pdfFilePath , FileMode . Create ) ;
989+ var rtfFileStream = new FileStream ( rtfFilePath , FileMode . Create ) ;
990+ var htmlFileStream = new FileStream ( htmlFilePath , FileMode . Create ) ;
991+ var pdfWriter = iTextSharp . text . pdf . PdfWriter . GetInstance ( document , pdfFileStream ) ;
992+ var rtfWriter = iTextSharp . text . rtf . RtfWriter2 . GetInstance ( document , rtfFileStream ) ;
993+ var htmlWriter = iTextSharp . text . html . HtmlWriter . GetInstance ( document , htmlFileStream ) ;
994+ document . AddAuthor ( System . Environment . UserName ) ;
995+ document . Open ( ) ;
996+ var fontTitle = iTextSharp . text . FontFactory . GetFont ( iTextSharp . text . FontFactory . HELVETICA , 16 , iTextSharp . text . Font . BOLD ) ;
997+ var parTitle = new iTextSharp . text . Paragraph ( "This is a new document" , fontTitle ) ;
998+ var phrase = new iTextSharp . text . Phrase ( ) ;
999+ var boldChunk = new iTextSharp . text . Chunk ( "Bold, " , iTextSharp . text . FontFactory . GetFont ( iTextSharp . text . FontFactory . HELVETICA , 12 , iTextSharp . text . Font . BOLD ) ) ;
1000+ var italicChunk = new iTextSharp . text . Chunk ( "italic, " , iTextSharp . text . FontFactory . GetFont ( iTextSharp . text . FontFactory . HELVETICA , 12 , iTextSharp . text . Font . ITALIC ) ) ;
1001+ var underlineChunk = new iTextSharp . text . Chunk ( "underlined, " , iTextSharp . text . FontFactory . GetFont ( iTextSharp . text . FontFactory . HELVETICA , 12 , iTextSharp . text . Font . UNDERLINE ) ) ;
1002+ var strikeChunk = new iTextSharp . text . Chunk ( "strikethrough " , iTextSharp . text . FontFactory . GetFont ( iTextSharp . text . FontFactory . HELVETICA , 12 , iTextSharp . text . Font . STRIKETHRU ) ) ;
1003+ var regularChunk = new iTextSharp . text . Chunk ( "text" , iTextSharp . text . FontFactory . GetFont ( iTextSharp . text . FontFactory . HELVETICA , 12 , iTextSharp . text . Font . NORMAL ) ) ;
1004+ phrase . Add ( boldChunk ) ;
1005+ phrase . Add ( italicChunk ) ;
1006+ phrase . Add ( underlineChunk ) ;
1007+ phrase . Add ( strikeChunk ) ;
1008+ phrase . Add ( regularChunk ) ;
1009+ var parBody = new iTextSharp . text . Paragraph ( phrase ) ;
1010+ document . Add ( parTitle ) ;
1011+ document . Add ( parBody ) ;
1012+ document . Dispose ( ) ;
1013+ pdfFileStream . Dispose ( ) ;
1014+ rtfFileStream . Dispose ( ) ;
1015+ htmlFileStream . Dispose ( ) ;
1016+
1017+ // Convert RTF to DOCX
1018+ var converter = new RtfToDocxConverter ( ) ;
1019+ converter . Convert ( rtfFilePath , docxFilePath ) ;
1020+ }
1021+
9791022 private void GenerateXlsx_Click ( object sender , RoutedEventArgs e )
9801023 {
9811024 var sfd = new SaveFileDialog ( )
0 commit comments