Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have Microsoft Word 2010 and I am trying to use it to create a PDF document with a catch. I do NOT want any of the fonts used embedded. However, all the save options I have tried result in "Embedded Subset" fonts. Is there any way to save as PDF without embedding ANY fonts?

share|improve this question
1  
What are you currently using to create these PDFs? PDFs are basically meant to be printed electronic documents and more or less immutable. Also, what are you reading them with that you don't want the fonts actually printed onto the document? What are you using them for? –  AthomSfere Jun 15 '13 at 1:02
    
I am testing conversion to other image formats (e.g. tiff), and need to test scenarios where the fonts were NOT embedded to be sure they are mapped to something that doesn't throw off alignment and spacing. It's easy enough to generate a word doc that includes all installed system fonts, but I want to save/export as a pdf without the fonts being embedded. –  slipsec Jun 17 '13 at 12:45

2 Answers 2

up vote 0 down vote accepted
[System.Reflection.Assembly]::LoadFrom("C:\path\to\itextsharp.dll")
#by default fonts are NOT embedded
#[iTextSharp.text.FontFactory]::DefaultEmbedding -eq false

$doc = New-Object iTextSharp.text.Document
$fileStream = New-Object IO.FileStream("C:\foo\test\allFonts2.pdf", [System.IO.FileMode]::Create)
[iTextSharp.text.pdf.PdfWriter]::GetInstance($doc, $filestream)

#iTextSharp provides a class to work with fonts, but first we have to register them:
[iTextSharp.text.FontFactory]::RegisterDirectories()

#Phrase is the smallest bit of text that will understand a newline if needed.  it is a chunk[] and paragraph is a phrase[]
$phrase = new-object iTextSharp.text.Phrase 
$paragraph = New-Object iTextSharp.text.Paragraph

#Different fonts for mapping tests
$fN = [iTextSharp.text.Font]::NORMAL
$fB = [iTextSharp.text.Font]::BOLD
$fI = [iTextSharp.text.Font]::ITALIC
$fBI = [iTextSharp.text.Font]::BOLDITALIC

#Sample string
$string = "The quick brown fox jumps over the lazy dog 1234567890 ?.,:;!@#$%^&*()`"'`n"
#something I know maps nicely (I love fixed width fonts!)
$consolas = [iTextSharp.text.FontFactory]::GetFont("consolas", 9)

#create all the nesting needed.
[iTextSharp.text.FontFactory]::RegisteredFamilies | %{

    $chunk = new-object iTextSharp.text.Chunk("`n$_`n", $consolas)
    $phrase.Add($chunk) | out-null

    $a = [iTextSharp.text.FontFactory]::GetFont($_, 9, $fN)
    "adding font: $_"
    $chunk = new-object iTextSharp.text.Chunk($string, $a)
    $phrase.Add($chunk) | out-null

    $b = [iTextSharp.text.FontFactory]::GetFont($_, 9, $fB)
    $chunk = new-object iTextSharp.text.Chunk($string, $b) 
    $phrase.Add($chunk) | out-null

    $c = [iTextSharp.text.FontFactory]::GetFont($_, 9, $fI)
    $chunk = new-object iTextSharp.text.Chunk($string, $c) 
    $phrase.Add($chunk) | out-null

    $d = [iTextSharp.text.FontFactory]::GetFont($_, 9, $fBI)
    $chunk = new-object iTextSharp.text.Chunk($string, $d) 
    $phrase.Add($chunk) | out-null
}

$paragraph.add($phrase) | out-null
$doc.Open()
$doc.add($paragraph) | out-null
$doc.close()
share|improve this answer

It is possible to remove all the fonts forming xml document type WordML.

<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Word.Document"?>
    <w:wordDocument xml:space="preserve" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
     <w:body>

      <w:tbl>
       <w:tblPr>
        <w:tblW w:w="9570" w:type="dxa"></w:tblW>
         <w:tblBorders> <w:top w:val="nil" /><w:left w:val="nil" /><w:bottom w:val="nil" /><w:right w:val="nil" />
         </w:tblBorders>
       </w:tblPr>

    <w:tr>
     <w:tc>
    <w:tcPr><w:tcW w:w="4785" w:type="dxa" /></w:tcPr>  <w:p></w:p>  </w:tc>
     <w:tc>  
    <w:tcPr><w:tcW w:w="4785" w:type="dxa" /></w:tcPr>  <w:p></w:p>  </w:tc>
    </w:tr>   

     <w:tr>    
         <w:tc>
          <w:tcPr><w:tcW w:w="0" w:type="auto" /></w:tcPr>  <w:p><w:pPr><w:jc w:val="right" /></w:pPr>
       <w:r><w:t>Company: </w:t></w:r> 
      </w:p>
     </w:tc>   

        <w:tc>
          <w:tcPr><w:tcW w:w="0" w:type="auto" />
           <w:tcBorders>      <w:top w:val="single" w:sz="2" w:color="0070C0" />    <w:left w:val="single" w:sz="2" w:color="0070C0" /> <w:bottom w:val="single" w:sz="2" w:color="0070C0" /> <w:right w:val="single" w:sz="2" w:color="0070C0" />
           </w:tcBorders>
          </w:tcPr>
         <w:p><w:pPr><w:jc w:val="left" /></w:pPr><w:r><w:t></w:t></w:r></w:p>
        </w:tc>      
       </w:tr>       
      </w:tbl>
     </w:body>
    </w:wordDocument>

But, even if you delete all the styles and fonts of the original document, Word will assign during the opening of the document style by default. Also, at least one font will be in the Acrobat document when you open it, as if you did not act.

Office WordML XML File, Word load default style:

Office WordML XML File

After save as PDF in Acrobat view one font

Acrobat document font prop

A good solution is to choose at least one font that will still be in the pdf file and use it.

Way 2: Removing Unused Styles from Word

enter image description here

Sub DeleteUnusedStyles()
    Dim oStyle As Style
    For Each oStyle In ActiveDocument.Styles
        ‘Only check out non-built-in styles
        If oStyle.BuiltIn = False Then
            With ActiveDocument.Content.Find
                .ClearFormatting
                .Style = oStyle.NameLocal
                .Execute FindText:=””, Format:=True
                If .Found = False Then oStyle.Delete
            End With
        End If
    Next oStyle
End Sub 

See Format Fonts for Text Field Default Values

Style almost always includes the font and font size used for the determination of other sizes. Paragraph, line spacing, and so on ... If you need a different style mechanics generate the document itself. Including substitute fonts. If the final PDF document then use the built-in Adobe JavaScript. Or Adobe LiveCycle Designer ES and XDP XML.

Font at Adobe LiveCycle Designer XDP XML

Using Acrobat JavaScript in Forms: Importing and Exporting Form Data

XML Forms Architecture PDF!

share|improve this answer
    
Won't this remove the style settings themselves not the embedded fonts? I want to retain the style, but remove the embedded fonts to force a "guess" for mapping by the conversion software I'm trying to test. –  slipsec Jun 17 '13 at 12:47
    
@slipsec May be need create PDF manualy? –  STTR Jun 17 '13 at 14:16
    
@slipsec, You might need to use a paid third party component to achieve this. –  Adam Jun 18 '13 at 10:13
    
used iText, will post when I have it finished. –  slipsec Jun 18 '13 at 15:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.