Set PDF fonts to be embedded.

This commit is contained in:
Rich
2013-10-04 20:30:14 +00:00
parent 4abeb80fb4
commit 48960152ac
6 changed files with 18 additions and 18 deletions

View File

@@ -1296,8 +1296,7 @@ namespace Volian.Print.Library
total.BoundingBox = new Rectangle(-20, -20, 100, 100);
//try
//{
helv = BaseFont.CreateFont(BaseFont.HELVETICA,
BaseFont.WINANSI, BaseFont.NOT_EMBEDDED);
helv = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
//}
//catch (Exception)
//{

View File

@@ -243,6 +243,7 @@ namespace Volian.Print.Library
try
{
writer = PdfWriter.GetInstance(document, new FileStream(outputFileName, FileMode.Create));
writer.PDFXConformance = PdfWriter.PDFA1B;
}
catch (Exception ex)
{
@@ -790,7 +791,7 @@ namespace Volian.Print.Library
if (textLayer != null) cb.BeginLayer(textLayer);
float fontSize = 30;
ColumnText ct = new ColumnText(cb);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", fontSize, new iTextSharp.text.Color(PrintOverride.TextColor));
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize,iTextSharp.text.Font.NORMAL, new iTextSharp.text.Color(PrintOverride.TextColor));
Chunk chk = new Chunk(message, font);
float xCenter = cb.PdfDocument.PageSize.Width / 2;
float yCenter = cb.PdfDocument.PageSize.Height / 2;

View File

@@ -165,7 +165,7 @@ namespace Volian.Print.Library
{
ColumnText ct = new ColumnText(cb);
ct.SetSimpleColumn(left, 4 + top - yDescent, right, top - yDescent - 50);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", 2);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 2);
Chunk chk = new Chunk(debugText + string.Format(" Top = {0}",top), font);
Phrase ph = new Phrase(chk);
ct.AddElement(ph);

View File

@@ -69,7 +69,7 @@ namespace Volian.Print.Library
public void WatermarkPageNumber(int pageNumber)
{
Rectangle pageSize = ContentByte.PdfWriter.PageSize; // Get page size
BaseFont myBasefont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, false);
BaseFont myBasefont = BaseFont.CreateFont(BaseFont.HELVETICA_BOLD, Encoding.ASCII.EncodingName, BaseFont.EMBEDDED);
string strPage = pageNumber.ToString();
float h = myBasefont.GetAscentPoint(strPage, 10);
float w = myBasefont.GetWidthPoint(strPage, 10);
@@ -119,7 +119,7 @@ namespace Volian.Print.Library
public static iTextSharp.text.Font GetFont(string fontName, float fontSize, int fontStyle, Color fontColor)
{
RegisterFont(fontName);
return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, true, fontSize, fontStyle, fontColor);
return iTextSharp.text.FontFactory.GetFont(fontName, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, fontSize, fontStyle, fontColor);
}
public static void RegisterFont(string fontName)
{

View File

@@ -359,7 +359,7 @@ namespace Volian.Print.Library
cb.BeginLayer(debugLayer);
ColumnText ct = new ColumnText(cb);
ct.SetSimpleColumn(left, top, left+50, top - 50);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", 2);
iTextSharp.text.Font font = FontFactory.GetFont("Arial", BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 2);
Chunk chk = new Chunk(DebugId.ToString(), font);
Phrase ph = new Phrase(chk);
ct.AddElement(ph);