如何将 Word 文档另存为 PDF *没有*任何嵌入字体?

sli*_*sec 9 fonts pdf microsoft-word microsoft-word-2010

我有 Microsoft Word 2010,我正在尝试使用它来创建一个带有捕获的 PDF 文档。我希望嵌入任何使用的字体。但是,我尝试过的所有保存选项都会产生“嵌入式子集”字体。有没有办法在不嵌入任何字体的情况下保存为 PDF?

sli*_*sec 0

[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()
Run Code Online (Sandbox Code Playgroud)