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. | |
| 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.
| strFileName | The PDF document's file name. |
| 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.
| fWidth | Width of the PDF page. | |
| fHeight | Height of the PDF page. |
| 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.
| 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.
| strKeywords | Keywords to be set. |
| 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.
| strSubject | Subject to be set. |
| 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.
| strTitle | Title to be set. |
| 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.
| strCreator | Creator to be set. |
| 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.
| strAuthor | Author to be set. |
| HRESULT SetCompressLevel | ( | [in] LONG | nCompress | ) |
Set compressing level of the document.
This will affects later output calls (such as IPDFPage::DrawText, IPDFPage::DrawImage, etc.).
| nCompress | A integer in [0 - 9] indicates compress level. 0 to disable compression. |
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
| HRESULT SetCompatibility | ( | [in] BSTR | strComp | ) |
| 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.
| nFitMode | A FitMode enumerate value that indicates the fit mode. |
| 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.
| nPageMode | An PageMode enumerate value that indicates the page mode. |
| HRESULT SetImageQuality | ( | [in] LONG | nQuality | ) |
Set the image quality.
| 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.
| strRegName | The reg name string. | |
| strRegCode | The reg codes string. |
| 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.
| 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. |
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.
| 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.
| nMode | An enum value of LitePDFEncryptionMode that indicates the encryption mode. |
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
| HRESULT GetPaperWidth | ( | [in] BSTR | strPaper, | |
| [out, retval] FLOAT * | retval | |||
| ) |
Get preset paper width (such as A4, B5, etc.
)
| strPaper | A string specifies paper type. For a list of valid values, see Remark section. |
| HRESULT GetPaperHeight | ( | [in] BSTR | strPaper, | |
| [out, retval] FLOAT * | retval | |||
| ) |
Get preset paper height (such as A4, B5, etc.
)
| strPaper | A string specifies paper type. For a list of valid values, see GetPaperWidth. |
1.5.1-p1