I have the same problem but i don't understand (VB)


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

  

in the attachment i have a simple xml template and i would like to show some
cyrillic characters.they aren't written.
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.






my xml is:
<?xml version="1.0" encoding="utf-8"?>

        
        
                 компания РМ может   продукции в более чем  стран ми
        
















Bruno Lowagie (iText) wrote:
> 
> Fabio Masini wrote:
>> Is possible to embed font into pdf using xml?
> 
> Yes.
> Try it, and if it doesn't work: explain what you've tried
> and why you think it doesn't work.
> br,
> Bruno
> 
>  
> -------------------------------------------------------------------------
> 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/
> 
> 
http://www.nabble.com/file/p14370189/test.xml test.xml 
http://www.nabble.com/file/p14370189/test.xml test.xml 
-- 
View this message in context: 
http://www.nabble.com/Font-embedding-using-xml-tp14348788p14370189.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/

Reply via email to