diff --git a/src/podofo/doc/PdfMemDocument.cpp b/src/podofo/doc/PdfMemDocument.cpp
index 4e2749e..28bb5f6 100644
--- a/src/podofo/doc/PdfMemDocument.cpp
+++ b/src/podofo/doc/PdfMemDocument.cpp
@@ -449,16 +449,9 @@ void PdfMemDocument::Write( const char* pszFilename )
 #ifdef _WIN32
 void PdfMemDocument::Write( const wchar_t* pszFilename )
 {
-    /** TODO:
-     *  We will get problems here on linux,
-     *  if we write to the same filename we read the 
-     *  document from.
-     *  Because the PdfParserObjects will read there streams 
-     *  data from the file while we are writing it.
-     *  The problem is that the stream data won't exist at this time
-     *  as we truncated the file already to zero length by opening
-     *  it writeable.
-     */
+    // makes sure pending subset-fonts are embedded
+    m_fontCache.EmbedSubsetFonts();
+
     PdfOutputDevice device( pszFilename );
 
     this->Write( &device );
@@ -478,6 +471,9 @@ void PdfMemDocument::Write( PdfOutputDevice* pDevice )
      *  it writeable.
      */
 
+     // makes sure pending subset-fonts are embedded
+    m_fontCache.EmbedSubsetFonts();
+
     PdfWriter writer( &(this->GetObjects()), this->GetTrailer() );
     writer.SetPdfVersion( this->GetPdfVersion() );
     writer.SetWriteMode( m_eWriteMode );
@@ -523,6 +519,9 @@ void PdfMemDocument::WriteUpdate( const wchar_t* pszFilename )
         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
     }
 
+    // makes sure pending subset-fonts are embedded
+    m_fontCache.EmbedSubsetFonts();
+
     bool bTruncate = !m_wchar_pszUpdatingFilename || wcscmp( m_wchar_pszUpdatingFilename, pszFilename) != 0;
 
     PdfOutputDevice device( pszFilename, bTruncate );
@@ -538,6 +537,9 @@ void PdfMemDocument::WriteUpdate( PdfOutputDevice* pDevice, bool bTruncate )
         PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
     }
 
+    // makes sure pending subset-fonts are embedded
+    m_fontCache.EmbedSubsetFonts();
+
     /** TODO:
      *  We will get problems here on linux,
      *  if we write to the same filename we read the 
