Is possible to embed font into pdf using xml?
my vb code to create pdf is this :
Dim strPdfFilePath As String =
HttpContext.Current.Server.MapPath(v_strFilePath + "\" +
System.Text.RegularExpressions.Regex.Replace(v_strFileName,
"[\\/:\*\?""<>|]", "") + ".pdf")
'file stream del pdf
If System.IO.File.Exists(strPdfFilePath) Then
System.IO.File.Delete(strPdfFilePath)
Dim fsPdfFileStream As New System.IO.FileStream(strPdfFilePath,
System.IO.FileMode.CreateNew)
Dim itsDocument As iTextSharp.text.Document = New iTextSharp.text.Document()
'path del file temporaneo da salvare
Dim strTempFilePath As String =
HttpContext.Current.Server.MapPath(v_strTempFilePath + "/" +
System.Guid.NewGuid().ToString.Replace("-", "") + ".tmp")
Try
' we set the ContentType and create an instance of the Writer
' HttpContext.Current.Response.ContentType = "application/pdf"
iTextSharp.text.pdf.PdfWriter.getInstance(itsDocument,
fsPdfFileStream)
itsDocument.Open()
'using this way my Paragraph is written correctly.
'CIRILLICO
Dim bfComic As iTextSharp.text.pdf.BaseFont =
iTextSharp.text.pdf.BaseFont.createFont("C:\\WINDOWS\\Fonts\\comic.ttf",
iTextSharp.text.pdf.BaseFont.IDENTITY_H,
iTextSharp.text.pdf.BaseFont.EMBEDDED)
Dim font As Font = New Font(bfComic, 12)
Dim text3 As String = "Some cyrillic characters: ???????? ?? ?????
????????? ? ????? ??? ????? ????. ?"
itsDocument.Add(New Paragraph(text3, font))
'get the XML content
Dim xmlDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
'leggo il template xml
xmlDoc.Load(v_strTemplateXmlUrl)
'salvo il file temporaneo
xmlDoc.Save(strTempFilePath)
'Transformo il file in Pdf
iTextSharp.text.xml.XmlParser.Parse(itsDocument, strTempFilePath)
'step 5: Close document
itsDocument.Close()
'se son qui tutto è andato bene
blnCreation = True
Catch ex As System.Exception
blnCreation = False
Finally
'rimuovo il file temporaneo
' System.IO.File.Delete(strTempFilePath)
End Try
a simple xml template where i would like to show some cyrillic
characters.they aren't written.
<?xml version="1.0" encoding="utf-16"?>
компания РМ может продукции в более чем стран ми
how can i embed font into pdf using only xml template ?
i dont' want to use the code :
Dim bfComic As iTextSharp.text.pdf.BaseFont =
iTextSharp.text.pdf.BaseFont.createFont("C:\\WINDOWS\\Fonts\\comic.ttf",
iTextSharp.text.pdf.BaseFont.IDENTITY_H,
iTextSharp.text.pdf.BaseFont.EMBEDDED)
Dim font As Font = New Font(bfComic, 12)
i want to embed font only by xml.
--
View this message in context:
http://www.nabble.com/font-embedded-in-template-xml-tp14373922p14373922.html
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/