Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Apr 22, 2015 2:35 pm

Hello,

How can I embed the current font used in an existing pdf.
I am using Free Spire.PDF for .NET.

Regards

Norbert

nscholten@greefa.nl
 
Posts: 5
Joined: Wed Apr 22, 2015 2:28 pm

Thu Apr 23, 2015 2:16 am

Hello,

Thanks for your inquiry.
The following method is for your reference.
Code: Select all
PdfDocument doc = new PdfDocument();
            PdfPageBase page = doc.Pages.Add();
            String fontFileName = "arial.ttf";
            PdfTrueTypeFont trueTypeFont = new PdfTrueTypeFont(fontFileName, 20f);
            page.Canvas.DrawString("Hello World", trueTypeFont, new PdfSolidBrush(Color.Black), 10, 10);
            doc.SaveToFile("result.pdf");

If there are any questions, welcome to get it back to us.

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Apr 23, 2015 6:15 am

Hello,
Your code is for new Text. but i have an exsiting pdf. When I rotate the section(file needs to be rotated efore printing) the text will not be printed.
If I embedded the font first(using trail of Acrobat) then I have no problem with the text not being printed.

regards

Norbert Scholten

nscholten@greefa.nl
 
Posts: 5
Joined: Wed Apr 22, 2015 2:28 pm

Thu Apr 23, 2015 7:29 am

Hello,

Thanks for your inquiry.
Could you please share the code with us? It would be helpful to replicate the issue and work out the solution for you ASAP.

Thanks,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Apr 23, 2015 8:11 am

Hello support,
this is the code:

Code: Select all
 Dim DocPdf As PdfDocument = New PdfDocument()
  DocPdf.LoadFromFile(sFile) 'filename
  Dim section As PdfSection
  section = DocPdf.Sections.Add()
  section.PageSettings.Rotate = PdfPageRotateAngle.RotateAngle270
  DocPdf.PrinterName = PrintO 'printerqueue
  Dim printDoc As New PrintDocument
  printDoc = DocPdf.PrintDocument
  printDoc.DefaultPageSettings.PaperSize = printDoc.PrinterSettings.PaperSizes.Item(28) '(A3)
  printDoc.DocumentName = f.Name 'name of Doc
  printDoc.Print()

And a sample file

nscholten@greefa.nl
 
Posts: 5
Joined: Wed Apr 22, 2015 2:28 pm

Thu Apr 23, 2015 9:08 am

Hello,

Thanks for your code.
Sorry, I need also your sample pdf file, please package it into ZIP file format and upload it. And please tell us which font you want to embed in your file.
Thanks.

Sincerely,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Apr 23, 2015 9:12 am

The current Font is ArialMT
It can be replaced by arial.

nscholten@greefa.nl
 
Posts: 5
Joined: Wed Apr 22, 2015 2:28 pm

Fri Apr 24, 2015 10:46 am

Hello,

Thanks for your information.
I have tested your pdf file with Free Spire.PDF for .NET Version:3.2. When I rotated the section, the text was not printed. If that is your issue, please download commercial version (Spire.PDF Pack(Hot Fix) Version:3.2.178 ) via link below and have a try:
http://www.e-iceblue.com/Download/downl ... t-now.html
If it is not your issue, please tell us your issue in detail.
About your words"The current Font is ArialMT. It can be replaced by arial." Do you mean that the ArialMT font was replaced by arial font after printing?
If I miss something or you have other problems, please feel free to contact us.

Thanks,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Apr 28, 2015 6:40 am

Hello support,

This update fixed my problem. But I was using the Free Spire.PDF for .NET.
I was not aware that document rotation was restricted in the free version.
The only restriction I was aware of was the number of pages created.

Regards,

Norbert

nscholten@greefa.nl
 
Posts: 5
Joined: Wed Apr 22, 2015 2:28 pm

Tue Apr 28, 2015 8:56 am

Hello,

Thanks for your reply.
In my last email, the version I have gaven to you is the Commercial Edition. Because of Commercial Version updates faster than Free Version, so Free version has some bugs on some functions.
The bugs in Free version are fixed only when our dev team have enough time to work with it.
If there are any questions, welcome to get it back to us.

Thanks,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF