Logo Search packages:      
Sourcecode: libpodofo version File versions  Download package

void EncryptTest::CreatedEncrypedPdf ( const char *  pszFilename ) [private]

Create an encrypted PDF.

Parameters:
pszFilenamesave the encrypted PDF here.

Definition at line 277 of file EncryptTest.cpp.

References PoDoFo::PdfDocument::CreateFont(), PoDoFo::PdfDocument::CreatePage(), PoDoFo::PdfPage::CreateStandardPageSize(), PoDoFo::PdfPainter::DrawText(), PoDoFo::ePdfError_InvalidHandle, PoDoFo::ePdfPageSize_A4, PoDoFo::PdfPainter::FinishPage(), PoDoFo::PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), PODOFO_RAISE_ERROR, PoDoFo::PdfMemDocument::SetEncrypted(), PoDoFo::PdfPainter::SetFont(), PoDoFo::PdfFont::SetFontSize(), PoDoFo::PdfPainter::SetPage(), and PoDoFo::PdfMemDocument::Write().

{
    PdfMemDocument  writer;
    PdfPage* pPage = writer.CreatePage( PdfPage::CreateStandardPageSize( ePdfPageSize_A4 ) );
    PdfPainter painter;
    painter.SetPage( pPage );

    PdfFont* pFont = writer.CreateFont( "Arial", PdfEncodingFactory::GlobalWinAnsiEncodingInstance(), false );
    if( !pFont )
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    pFont->SetFontSize( 16.0 );
    painter.SetFont( pFont );
    painter.DrawText( 100, 100, "Hello World" );
    painter.FinishPage();

    writer.SetEncrypted( "user", "owner" );
    writer.Write( pszFilename );

    printf( "Wrote: %s\n", pszFilename );
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index