`
shappy1978
  • 浏览: 698479 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

Add font in PDF

 
阅读更多

http://stackoverflow.com/questions/6922959/how-to-add-new-fonts-to-itext-using-java

 

protected final static Font FONT_SIZE_11_BOLD = new Font(Font.HELVETICA, 11f, Font.BOLD);
monthSize11 = new Chunk(month, FONT_SIZE_11_BOLD);

 

//From font file

accepted  BaseFont base = BaseFont.createFont("c:/windows/fonts/arial.ttf", BaseFont.WINANSI);
Font font = new Font(base, 11f, Font.BOLD);

  

分享到:
评论

相关推荐

    Spire.Pdf C#代码操作PDF

    在实际项目中,你可以结合`Spire.Pdf`的API创建一个新的PDF文档,添加内容,然后调用`AddHeader`和`AddWatermark`方法来完成操作。如果`WritePDF`包含具体代码,分析这部分内容可以帮助你更好地理解如何结合`Spire....

    编辑任意PDF文件

    Making Editor more intelligent and user-friendly, users now are able to set the attributes of the text in the “Add new text objects” dialog box directly, including font, color, size, horizontal ...

    Aspose生成EXCEL转PDF

    cells[12, 0].PutValue("Please enter a number other than 0 to 10 in B1 to activate data validation:"); cells[12, 0].Style.IsTextWrapped = true; cells[12, 1].PutValue(10); ``` 生成EXCEL文件并转换为PDF...

    pdf editor

    Adds an Object attributes option in Add new text objects dialog box, making it easier for users to set preferences for text objects, such as font size, text mode, word space, color, etc. 9. Property ...

    用iTextSharp生成中文PDF

    foreach (var item in yourDataList) { PdfPCell cell1 = new PdfPCell(new Phrase(item.Property1, chineseFont)); PdfPCell cell2 = new PdfPCell(new Phrase(item.Property2, chineseFont)); PdfPCell cell3 =...

    swift-PDFGenerator-Swift编写的简单易用的PDF生成UIImage框架

    pdf.addPage(page) let text = "Hello, PDF!" let attributes: [NSAttributedString.Key: Any] = [.font: UIFont.systemFont(ofSize: 24)] let textRect = CGRect(x: 50, y: 50, width: page.size.width - 100, ...

    python批量向多个PDF文件添加中文水印.rar

    watermark_pdf.set_font("Arial", size=40, style="B") text = "中文水印" # 这里替换为你的中文水印内容 watermark_pdf.cell(0, 10, txt=text, ln=1, align='C') ``` 4. **合并水印和原PDF**:将水印PDF叠加到...

    用C#制作PDF文件全攻略.docx

    document.Add(new Paragraph("这是我的第一个PDF文件", font)); ``` 这样,中文字符就能正确显示在生成的PDF中了。 第二部分 iText的高级应用 除了基本的文字添加,iText还允许你添加图像、表格、列表、超链接等...

    Python批量PDF添加水印、加密

    new_pdf.addPage(image_pdf.getPage(0)) # 写入新的PDF文件 with open('带水印的文件.pdf', 'wb') as output: new_pdf.write(output) ``` 接下来,我们讨论PDF文件的加密。PyPDF2允许我们设置用户密码以限制访问...

    C#生成PDF 读取PDF文本内容 获取PDF内图片_《0528》.rar

    foreach (PdfPage page in document.Pages) { string text = PdfTextExtractor.GetTextFromPage(page); Console.WriteLine(text); } document.Close(); ``` - 提取PDF内图片: ```csharp using PDFsharp....

    PDF_To_JPG[无水印]

    ADD:You can use Add to add PDF file to the list, Click Add button, You will be prompt to select PDF files which you need to convert and then Add these files to the list. REMOVE:Remove selected file ...

    FastReport.v4.15 for.Delphi.BCB.Full.Source企业版含ClientServer中文修正版支持D4-XE5

    - fixed bug with lost of focus in font size combo-box in designer - fixed bug with truncate of font size combo-box in Windows Vista/7 in designer (lost of vertical scroll bar) - fixed bug when lost ...

    iTexSharp创建pdf合并等功能

    foreach (string file in filesToMerge.Skip(1)) { using (FileStream fs = File.OpenRead(file)) { PdfReader reader = new PdfReader(fs); copy.AddDocument(reader); reader.Close(); } } copy.Close(); ``...

    PDF添加水印文字或图片

    watermark.TextState.Font = FontRepository.FindFont("Arial"); watermark.TextState.FontSize = 48; watermark.TextState.ForegroundColor = Color.Gray; watermark.TextState.BackgroundColor = Color.Gray; ...

    itext_in_action源代码

    例如,通过 `Document` 类的 `add()` 方法可以添加元素,`Font` 类则用于设置字体样式。 2. **表单处理**:iText 提供了处理 PDF 表单的功能,可以创建、填充和导出表单数据。`AcroFields` 类是核心,它允许我们...

    FastReport Studio Site v3.20

    fixed bug in AddVariable method of TfrxReport interface- fixed bug in RTF export with font style attributes- fixed bug with frames in PDF export- fixed paper size bug- fixed ParagraphGap in PDF ...

    tfpdf-1.2.4

    $pdf->AddFont('Yahei','','Monaco_Yahei.ttf',true); $pdf->SetFont('Yahei','',8); // Load a UTF-8 string from a file and print it //$txt = file_get_contents('HelloWorld.txt'); $pdf->Write(8, "中文...

    FastReport 4.9

    + added ability to decrease font size in barcode object + added ability to inseret FNC1 to "code 128" barcode + added event TfrxPreview.OnMouseDown + added support of new unicode-PDF export in D4-D6 ...

    jspdf快速组件jspdf快速组件

    例如,使用`addFont()`引入自定义字体,然后使用`setFont()`切换字体。`text()`方法接受文本、坐标参数,可指定文本在页面上的位置。 ```javascript var doc = new jsPDF(); doc.addFont('myfont.ttf', 'MyFont', '...

Global site tag (gtag.js) - Google Analytics