Skip to main content
Participating Frequently
July 5, 2021
Question

Replace Font sub types in a PDF using DC SDK

  • July 5, 2021
  • 3 replies
  • 1883 views

Hi,

 

We have a PDF file which has font subtypes.

we need to replace all font sub types with courier new font.

we are using Adobe DC sdk for .net to do it.

we need to understnad how can we do that using Adobe DC sdk for .net

 

[Question moved to the Acrobat SDK forum]

This topic has been closed for replies.

3 replies

Thom Parker
Community Expert
Community Expert
July 6, 2021

You say you are using the "Acrobat SDK for .Net". Do you mean you are using the PDF Library for .Net? or the IAC (Inter application Communication) SDK?  If you mean the IAC, then no, it is not possible to replace the fonts. 

To replace a font you'll need to use either the C++ SDK for plug-in development, or an independant PDF library.  Also, as Mr. Test Screen indicated, fonts are a complex and deep topic. There are many considerations when performing a font replacment.  It may seem like it should be a simple thing, since you can easily change a font from the Acrobat UI, but the Acrobat SDK does not automatically reformat text to adjust to the new font. However, some 3rd party PDF libraries do handle this. 

 

If you want to explore the internals of a PDF to see how fonts are handled I'd suggeset purchasing this tool:

https://www.windjack.com/product/pdfcanopener/

 

And making a careful study of the PDF Reference.

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participating Frequently
July 7, 2021

Hi,

 

Please help if there is a way with adobe sdk for .net

Thom Parker
Community Expert
Community Expert
July 7, 2021

Please refer to my previous post. You'll need to tell us specifically which Acrobt SDK you are using.  The phrase "Acrobat SDK for .Net" doesn't mean anything by itself. 

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Legend
July 5, 2021

I don't understand what you mean by changing "font sub types".


Each font has a subtype key but it is Type1, TrueType, OpenType etc. It is not a font name.

If you mean font substitution, that happens when the font is not in the file and you cannot influence it.

If you mean font subsets, then you can replace them using the PDFEdit API, but spacing will be a severe issue.

Participating Frequently
July 6, 2021

I want to replace all fomt with courier new.

Is there any issue with alignment if i use PDFEdit API to change all the fonts ?

 

Legend
July 6, 2021

Your problems will come from font metrics (width). Courier New is much wider than most fonts.

 

If you change font to Courier New in Word, the text will reflow, and you may need many more pages. This WILL NOT HAPPEN in PDFEdit. You change the text, but it stays on the same line. It will be too long, cut off, or overlapping other text. A complete mess. Unless you are replacing fonts with the same metrics.

 

You want reflow? Use Word. PDF is not suitable.

Bernd Alheit
Community Expert
Community Expert
July 5, 2021

Want you change all fonts to Courier New?

Participating Frequently
July 6, 2021

yes.