Replace Font sub types in a PDF using DC SDK
Copy link to clipboard
Copied
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]
Copy link to clipboard
Copied
Want you change all fonts to Courier New?
Copy link to clipboard
Copied
yes.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Hi,
Below is some thing we want to try.
Read the content from one pdf and remove the font subtypes and add couriner new font.
After that we will save the content to new pdf file.
Please suggest if possible.
Copy link to clipboard
Copied
You can do this with PDFEdit, and you will face the obstacles I described. The result will be unreadable/unusable in most cases.
Copy link to clipboard
Copied
PS to use PDFEdit you will need a basic knowledge of the PDF graphics and text model, so I suggest you spend some months studying the PDF Reference, ISO 32000.
Copy link to clipboard
Copied
Thanks for the reply.
One last question.
after reading the existing pdf, If i can note down the positions of each element like paragraph, image and textbox positions while creating new pdf, can i apply the same positions ?
Copy link to clipboard
Copied
There are no paragraphs in a PDF. There are no text boxes. However, each run of text has a starting position, and it can be noted.
Copy link to clipboard
Copied
Hi,
Thanks for the help.
Can i have any code snippet/documentation link to read and save the text positions.
Copy link to clipboard
Copied
No, detailed study is required.
Copy link to clipboard
Copied
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.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Hi,
Please help if there is a way with adobe sdk for .net
Copy link to clipboard
Copied
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.
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
What does you mean with "adobe sdk for .net" ?

