IPDFDocument Interface Reference
[LitePDF]

IPDFDocument is the representation of a PDF document. More...

List of all members.

Public Member Functions

HRESULT Open ([in] BSTR strFileName)
 Open the PDF document.
HRESULT NewPage ([in] FLOAT fWidth,[in] FLOAT fHeight,[out, retval] IPDFPage **retval)
 Create a new PDF page with specified size.
HRESULT Close (void)
 Close the PDF document.
HRESULT SetKeywords ([in] BSTR strKeywords)
 Set the keywords of the PDF document.
HRESULT SetSubject ([in] BSTR strSubject)
 Set the subject of the PDF document.
HRESULT SetTitle ([in] BSTR strTitle)
 Set the title of the PDF document.
HRESULT SetCreator ([in] BSTR strCreator)
 Set the creator of the PDF document.
HRESULT SetAuthor ([in] BSTR strAuthor)
 Set the author of the PDF document.
HRESULT SetCompressLevel ([in] LONG nCompress)
 Set compressing level of the document.
HRESULT SetCompatibility ([in] BSTR strComp)
 Set PDF compatibility.
HRESULT SetFitMode ([in] LitePDFFitMode nFitMode)
 Set the fit mode of the first page when opening the resulting pdf document.
HRESULT SetPageMode ([in] LitePDFPageMode nPageMode)
 Set the page mode when opening the resulting pdf document, specifying how the document should be displayed when opened.
HRESULT SetImageQuality ([in] LONG nQuality)
 Set the image quality.
HRESULT SetRegInfo ([in] BSTR strRegName,[in] BSTR strRegCode)
 Set reg name and reg codes.
HRESULT SetPermission ([in] BSTR strOwnerPwd,[in] BSTR strUserPwd,[in] BSTR strPermission)
 Set the passwords and the permission to protect PDF document from unauthorized access.
HRESULT SetEncryptionMode ([in] LitePDFEncryptionMode nMode)
 Set the encryption mode for the document.
HRESULT GetPaperWidth ([in] BSTR strPaper,[out, retval] FLOAT *retval)
 Get preset paper width (such as A4, B5, etc.
HRESULT GetPaperHeight ([in] BSTR strPaper,[out, retval] FLOAT *retval)
 Get preset paper height (such as A4, B5, etc.


Detailed Description

IPDFDocument is the representation of a PDF document.

Please see Hello World sample to learn about how to create a simple PDF document using IPDFDocument.
See also:
Open, Close, NewPage


Member Function Documentation

HRESULT Open ( [in] BSTR  strFileName  ) 

Open the PDF document.

This function internally opens a FILE handle for PDF output. If the specified file does not exist, it will create a new file with specified file name. If the specified file is opened by another program, an error will occur. Once finished PDF output, Close() should be called to close the document.

Please see Hello World sample to learn about how to create a hello world PDF document.

Parameters:
strFileName The PDF document's file name.
See also:
Close, NewPage

HRESULT NewPage ( [in] FLOAT  fWidth,
[in] FLOAT  fHeight,
[out, retval] IPDFPage **  retval 
)

Create a new PDF page with specified size.

This function will return a new created IPDFPage instance, which could be used to draw text, images, paths, etc. IPDFPage::Close() should be called to close the current page before creating a new page.

Parameters:
fWidth Width of the PDF page.
fHeight Height of the PDF page.
Returns:
Created IPDFPage instance
See also:
IPDFPage::Close

HRESULT Close ( void   ) 

Close the PDF document.

A PDF document must be closed by calling Close(), in which all content will be flushed into the local PDF file.

Please see Hello World sample to learn about how to create a hello world PDF document.

See also:
Open

HRESULT SetKeywords ( [in] BSTR  strKeywords  ) 

Set the keywords of the PDF document.

Please see Infos sample to learn about how to set PDF document infos.

Parameters:
strKeywords Keywords to be set.
See also:
SetSubject, SetTitle, SetCreator, SetAuthor

HRESULT SetSubject ( [in] BSTR  strSubject  ) 

Set the subject of the PDF document.

Please see Infos sample to learn about how to set PDF document infos.

Parameters:
strSubject Subject to be set.
See also:
SetKeywords, SetTitle, SetCreator, SetAuthor

HRESULT SetTitle ( [in] BSTR  strTitle  ) 

Set the title of the PDF document.

Please see Infos sample to learn about how to set PDF document infos.

Parameters:
strTitle Title to be set.
See also:
SetKeywords, SetSubject, SetCreator, SetAuthor

HRESULT SetCreator ( [in] BSTR  strCreator  ) 

Set the creator of the PDF document.

Please see Infos sample to learn about how to set PDF document infos.

Parameters:
strCreator Creator to be set.
See also:
SetKeywords, SetSubject, SetTitle, SetAuthor

HRESULT SetAuthor ( [in] BSTR  strAuthor  ) 

Set the author of the PDF document.

Please see Infos sample to learn about how to set PDF document infos.

Parameters:
strAuthor Author to be set.
See also:
SetKeywords, SetSubject, SetTitle, SetCreator

HRESULT SetCompressLevel ( [in] LONG  nCompress  ) 

Set compressing level of the document.

This will affects later output calls (such as IPDFPage::DrawText, IPDFPage::DrawImage, etc.).

Parameters:
nCompress A integer in [0 - 9] indicates compress level. 0 to disable compression.
Remarks:
The following pseudo codes show how to use this method. In the sample, the PDF output between two SetCompressLevel() calls will be compressed.
     doc.SetCompressLevel(9);                           // Enable output compression and set compressing level to 9 (best).
     IPDFPage page = doc.NewPage(600, 900);             // Outputs
     page.DrawText("Hello world."); 
     page.Close();
     doc.SetCompressLevel(0);                           // Disable output compression

See also:
Open

HRESULT SetCompatibility ( [in] BSTR  strComp  ) 

Set PDF compatibility.

Currently, only PDF-1.3 and PDF-1.4 are supported by LitePDF.

Please call this method before calling Open() function to take effect.

Parameters:
strComp A string that indicates the PDF compatibility. It should be "PDF-1.3" or "PDF-1.4".
See also:
Open

HRESULT SetFitMode ( [in] LitePDFFitMode  nFitMode  ) 

Set the fit mode of the first page when opening the resulting pdf document.

Default fit mode value is LPFM_DEFAULT.

Parameters:
nFitMode A FitMode enumerate value that indicates the fit mode.
See also:
FitMode

HRESULT SetPageMode ( [in] LitePDFPageMode  nPageMode  ) 

Set the page mode when opening the resulting pdf document, specifying how the document should be displayed when opened.

Default page mode value is LPPM_DEFAULT, which means neither document outline nor thumbnail images visible.

Parameters:
nPageMode An PageMode enumerate value that indicates the page mode.
See also:
PageMode

HRESULT SetImageQuality ( [in] LONG  nQuality  ) 

Set the image quality.

Remarks:
LitePDF can load PNG and JPEG images directly into PDF. For other types of images, LitePDF convert them to JPEG images first and then save them to PDF document. This ImageQuality property is the JPEG quality when encoding JPEG images. So it has no effect when loading PNG and JPEG images.
See also:
IPDFPage::DrawImage

HRESULT SetRegInfo ( [in] BSTR  strRegName,
[in] BSTR  strRegCode 
)

Set reg name and reg codes.

Call this function with correct reg name and reg codes before calling Open() function to remove the trial information watermark in the resulting PDF document. Once you purchase LitePDF online, an email with your reg name and reg codes will be sent to you automatically.

To purchase LitePDF, please click HERE.

Parameters:
strRegName The reg name string.
strRegCode The reg codes string.
See also:
Open

HRESULT SetPermission ( [in] BSTR  strOwnerPwd,
[in] BSTR  strUserPwd,
[in] BSTR  strPermission 
)

Set the passwords and the permission to protect PDF document from unauthorized access.

LitePDF allows two passwords to be specified for a document: an owner password and a user password. Correctly supplying the owner password will gain the full permissions to access the document. Supplying the user password will gain the permissions specified in strPermission.

Please call this method before Open to take effect. For an example how to use this method, see SetEncryptionMode.

Parameters:
strOwnerPwd The owner password string. The value of each character in it should be in 33-126.
strUserPwd The user password string. The value of each character in it should be in 33-126.
strPermission The permission string. Each character in it specifies one type of permission. See remark section.
Remarks:
There are three special circumstances to be noted:
  • If both strOwnerPwd and strUserPwd are empty strings, the method will fail.
  • If only strUserPwd is empty, PDF viewer will not request a password when opening the document. But the user will only gain the permissions specified in nPermission.
  • If only strOwnerPwd is empty, the user, correctly supplying the strUserPwd, will gain the full permissions

Full list of permission character is listed below.
  • R - allow reading document.
  • P - allow printing document.
  • M - allow modifying contents other than text annotations and interactive form fields.
  • C - allow copying text and graphics from document
  • A - allow modifying text annotations and interactive form fields.
  • * - specifies all above permissions

The following pseudo codes show how to use this method.
     SetPermission("owner", "", "R");           // PDF viewer will not request user password, and user have Read permission.

     SetPermission("", "user", "");             // Since owner password is empty, user who supplying correct password will have full permission.

     SetPermission("owner", "user", "RP");      // Setting permission to Allow reading and Allow Printing.

Please see Encryption sample to learn about how to encrypt PDF document and set permissions.
See also:
SetEncryptionMode

HRESULT SetEncryptionMode ( [in] LitePDFEncryptionMode  nMode  ) 

Set the encryption mode for the document.

Please call this method before Open to take effect. To set passwords or permissions for the document, please call SetPermission. Default EncryptionMode value is LPEM_RC4_40.

Parameters:
nMode An enum value of LitePDFEncryptionMode that indicates the encryption mode.
Remarks:
Since PDF-1.3 supports only 40 bits RC4, setting EncryptionMode to values other than LPEM_RC4_40 will change the PDF compatibility to PDF-1.4.
The following pseudo codes show how to use this method.
     litepdf.SetEncryptionMode(LPEM_RC4_128);           // Set encryption mode to RC4 with 128 bits key.
     litepdf.SetPermission("owner", "user", "R");       // Set permission to allow reading.
     litepdf.Open(L"test.pdf");                         // Open the document

See also:
SetPermission, LitePDFEncryptionMode, SetCompatibility

HRESULT GetPaperWidth ( [in] BSTR  strPaper,
[out, retval] FLOAT *  retval 
)

Get preset paper width (such as A4, B5, etc.

)

Parameters:
strPaper A string specifies paper type. For a list of valid values, see Remark section.
Returns:
The requested width. -1.0 means an error.
Remarks:
A list of valid paper string are listed below.
  • "A0"
  • "A1"
  • "A2"
  • "A3"
  • "A4"
  • "A5"
  • "A6"
  • "B5"
  • "LETTER"
  • "LEGAL"
  • "LEDGER"
  • "P11X17"
See also:
GetPaperHeight

HRESULT GetPaperHeight ( [in] BSTR  strPaper,
[out, retval] FLOAT *  retval 
)

Get preset paper height (such as A4, B5, etc.

)

Parameters:
strPaper A string specifies paper type. For a list of valid values, see GetPaperWidth.
Returns:
The requested width. -1.0 means an error.
See also:
GetPaperWidth


Generated on Sun Mar 18 15:55:35 2007 for LitePDF by  doxygen 1.5.1-p1