Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Setting font in existing Redact annotation

New Here ,
Mar 12, 2016 Mar 12, 2016

My goal is for my addin to get the font from underlying pdf text, and update a redact annotation to use that font.

I now have a font CosObj created from the text using PDEFontGetCosObj.

I also have the redact annotation CosObj created using PDAnnotGetCosObj.

I'm stuck on how to get the font into the redact annotation so that it uses that font. Do I need to use the cos dictionary get and put methods? Ie get key value from the one dictionary, then update the font key value of the other? How do I find out the keys they have?

Am I on the right track?

Any help is appreciated.

Rick

Message was edited by: Richard Grear

TOPICS
Acrobat SDK and JavaScript
507
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 13, 2016 Mar 13, 2016

The way I work on issues like this is to do this manually in Acrobat first and then look at the resulting PDF. Working at the COS level is possible, but wherever possible use a higher level method such as the PD or PDE interfaces. If you aren't already using it WindJack PDFCanOpener is a great tool that will not only allow you to browse the internals of PDF files, but also edit the internals. I am not affiliated with them, but use this tool almost daily. I am not very familiar with the Redact annotation, but most annotations have an appearance dictionary and also another entry that will specify the font to use such as the /DA dictionary entry in form fields. Within the appearance dictionary there should be a Resource dictionary that holds the information on the font.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 23, 2016 Mar 23, 2016

Thanks

I've opted to enumerate the fonts in the document using PDDocEnumFonts(). And then I can set the textFont of the annotations from one the fonts returned.

However the fonts returned from PDDocEnumFonts and also PDDocEnumLoadedFonts aren't any that I'm seeing in the document. For example it's returning NewBaskerville-Roman and GillSans-Bold. Actual font used in the document text is mainly Adobe Serif MM.

Perhaps Adobe Serif MM is being detected but I'm not accessing it?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 23, 2016 Mar 23, 2016
LATEST

‌Adobe Serif MM is a substitution font not the one used in the PDF. Look deeper.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines